Coder Social home page Coder Social logo

kr328 / zygoteloader Goto Github PK

View Code? Open in Web Editor NEW
53.0 5.0 11.0 354 KB

A library for building Java only Zygisk/Riru modules.

License: MIT License

Java 37.18% Shell 4.62% CMake 1.85% C++ 31.67% C 24.68%
riru zygisk magisk magisk-module android

zygoteloader's Introduction

Zygote Loader

A library for building Java only Zygisk/Riru modules.

Getting Start

  1. Add plugin repository to settings.gradle.kts
pluginManagement { 
    repositories { 
        // ... other repositories 
        maven(url = "https://maven.kr328.app/releases") 
    } 
}
  1. Add an android application module and create entrypoint
class Entrypoint {
    // ZygoteLoader will invoke this method after injected to target process
    public static void main() {
        // ... your code
    }
}
  1. Apply com.github.kr328.gradle.zygote plugin
plugins {
    id("com.android.application") // required
    id("com.github.kr328.gradle.zygote") version "3.1" // apply plugin
    // ... other plugins
}
  1. Configure your module properties
zygote {
    // initial inject packages
    packages(ZygoteLoader.PACKAGE_SYSTEM_SERVER) // initial inject to system_server

    // riru related properties
    riru {
        id = "your module id"
        name = "your module name"
        author = "your name"
        description = "your module description"
        entrypoint = "your entrypoint class qualified name" // see also step 2
        archiveName = "generated zip archive name" // optional
        updateJson = "your updateJson property" // optional, see also https://topjohnwu.github.io/Magisk/guides.html#moduleprop
    }

    // zygisk related properties
    zygisk {
        // same with riru
    }
}
  1. Build module

    1. Run gradle task <module>:assembleRelease

    2. Pick generated zip from <module>/build/outputs/magsisk

Examples

zygoteloader's People

Contributors

kr328 avatar yujincheng08 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

zygoteloader's Issues

Load ClassLoader of a targer process.

I need an app to see classes from a custom framework file I have, and since the target application uses reflection to do this, I tough I could easily add the jar to the ClassLoader path of the application, but it seems that it might not be this easily?

I managed to load the framework, and call it with Class.forName, but my wrong understanding is that once I load it in my module it will also load it in the app which it wasn't the case. I'm lost on how could I retrieve the ClassLoader of the target app and then add it to it's path.

I was hoping I could get some help here.

Thanks!

    static void init() throws InvocationTargetException, NoSuchMethodException, IllegalAccessException, ClassNotFoundException {

        String NT_FRAMEWORK_PATH = "/system/framework/not-a-framework.jar";

        BaseDexClassLoader baseDexClassLoader = (BaseDexClassLoader) ClassLoader.getSystemClassLoader();

        Method method = HiddenApiBypass.getDeclaredMethod(BaseDexClassLoader.class, "addDexPath", String.class);
        method.setAccessible(true);
        method.invoke(baseDexClassLoader, NT_FRAMEWORK_PATH);

        // Test
        String testCls = "com.nothing.onlineconfig.ConfigObserver";
        Class<?> myClass = Class.forName(testCls);
        log(String.format("Class name: %s", myClass.getName()));
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.