com.android.reverse.collecter.ModuleContext Java Examples

The following examples show how to use com.android.reverse.collecter.ModuleContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReverseXposedModule.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
	// TODO Auto-generated method stub
	if(lpparam.appInfo == null || 
			(lpparam.appInfo.flags & (ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) !=0){
		return;
	}else if(lpparam.isFirstApplication && !ZJDROID_PACKAGENAME.equals(lpparam.packageName)){
	  Logger.PACKAGENAME = lpparam.packageName;
	  Logger.log("the package = "+lpparam.packageName +" has hook");
	  Logger.log("the app target id = "+android.os.Process.myPid());
	  PackageMetaInfo pminfo = PackageMetaInfo.fromXposed(lpparam);
	  ModuleContext.getInstance().initModuleContext(pminfo);
	  DexFileInfoCollecter.getInstance().start();
	  LuaScriptInvoker.getInstance().start();
	  ApiMonitorHookManager.getInstance().startMonitor();
	}else{
		
	}
}
 
Example #2
Source File: MemoryBackSmali.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
private static baksmaliOptions configOptions() {

		baksmaliOptions options = new baksmaliOptions();
		options.apiLevel = ModuleContext.getInstance().getApiLevel();
		options.outputDirectory = ModuleContext.getInstance().getAppContext().getFilesDir().getAbsolutePath()+"/smali";
		options.allowOdex = true;
		options.deodex = true;
		options.jobs = 8;
		options.bootClassPathDirs.add("/system/framework/");
		if (options.apiLevel >= 17) {
			options.checkPackagePrivateAccess = true;
		}
		options.registerInfo = 128;
		options.noAccessorComments = false;
		options.useLocalsDirective = true;
		options.noParameterRegisters = false;
		options.useSequentialLabels = true;
		options.outputDebugInfo = true;
		options.addCodeOffsets = false;
		return options;
	}
 
Example #3
Source File: MemoryBackSmali.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
private static baksmaliOptions configOptions() {

		baksmaliOptions options = new baksmaliOptions();
		options.apiLevel = ModuleContext.getInstance().getApiLevel();
		options.outputDirectory = ModuleContext.getInstance().getAppContext().getFilesDir().getAbsolutePath()+"/smali";
		options.allowOdex = true;
		options.deodex = true;
		options.jobs = 8;
		options.bootClassPathDirs.add("/system/framework/");
		if (options.apiLevel >= 17) {
			options.checkPackagePrivateAccess = true;
		}
		options.registerInfo = 128;
		options.noAccessorComments = false;
		options.useLocalsDirective = true;
		options.noParameterRegisters = false;
		options.useSequentialLabels = true;
		options.outputDebugInfo = true;
		options.addCodeOffsets = false;
		return options;
	}
 
Example #4
Source File: NativeFunction.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
public static MemoryDexFileItemPointer queryDexFileItemPointer(long cookie){
	int version = ModuleContext.getInstance().getApiLevel();
	//TODO change int to long
	DexFileHeadersPointer iteminfo = getHeaderItemPtr(cookie,version);
	MemoryDexFileItemPointer pointer = new MemoryDexFileItemPointer();
	pointer.setBaseAddr((int) iteminfo.getBaseAddr());
	pointer.setpClassDefs((int) iteminfo.getpClassDefs());
	pointer.setpFieldIds((int) iteminfo.getpFieldIds());
	pointer.setpMethodIds((int) iteminfo.getpMethodIds());
	pointer.setpProtoIds((int) iteminfo.getpProtoIds());
	pointer.setpStringIds((int) iteminfo.getpStringIds());
	pointer.setpTypeIds((int) iteminfo.getpTypeIds());
       pointer.setClassCount((int) iteminfo.getClassCount());
	return pointer;

}
 
Example #5
Source File: ReverseXposedModule.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
	// TODO Auto-generated method stub
	if(lpparam.appInfo == null || 
			(lpparam.appInfo.flags & (ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) !=0){
		return;
	}else if(lpparam.isFirstApplication && !ZJDROID_PACKAGENAME.equals(lpparam.packageName)){
	  Logger.PACKAGENAME = lpparam.packageName;
	  Logger.log("the package = "+lpparam.packageName +" has hook");
	  Logger.log("the app target id = "+android.os.Process.myPid());
	  PackageMetaInfo pminfo = PackageMetaInfo.fromXposed(lpparam);
	  ModuleContext.getInstance().initModuleContext(pminfo);
	  DexFileInfoCollecter.getInstance().start();
	  ApiMonitorHookManager.getInstance().startMonitor();
	}else{
		
	}
}
 
Example #6
Source File: MemoryBackSmali.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
private static baksmaliOptions configOptions() {

		baksmaliOptions options = new baksmaliOptions();
		options.apiLevel = ModuleContext.getInstance().getApiLevel();
		options.outputDirectory = ModuleContext.getInstance().getAppContext().getFilesDir().getAbsolutePath()+"/smali";
		options.allowOdex = true;
		options.deodex = true;
		options.jobs = 8;
		options.bootClassPathDirs.add("/system/framework/");
		if (options.apiLevel >= 17) {
			options.checkPackagePrivateAccess = true;
		}
		options.registerInfo = 128;
		options.noAccessorComments = false;
		options.useLocalsDirective = true;
		options.noParameterRegisters = false;
		options.useSequentialLabels = true;
		options.outputDebugInfo = true;
		options.addCodeOffsets = false;
		return options;
	}
 
Example #7
Source File: ReverseXposedModule.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
	// TODO Auto-generated method stub
	if(lpparam.appInfo == null || 
			(lpparam.appInfo.flags & (ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) !=0){
		return;
	}else if(lpparam.isFirstApplication && !ZJDROID_PACKAGENAME.equals(lpparam.packageName)){
	  Logger.PACKAGENAME = lpparam.packageName;
	  Logger.log("the package = "+lpparam.packageName +" has hook");
	  Logger.log("the app target id = "+android.os.Process.myPid());
	  PackageMetaInfo pminfo = PackageMetaInfo.fromXposed(lpparam);
	  ModuleContext.getInstance().initModuleContext(pminfo);
	  DexFileInfoCollecter.getInstance().start();
	  LuaScriptInvoker.getInstance().start();
	  ApiMonitorHookManager.getInstance().startMonitor();
	}else{
		
	}
}
 
Example #8
Source File: MemoryBackSmali.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
private static baksmaliOptions configOptions() {

		baksmaliOptions options = new baksmaliOptions();
		options.apiLevel = ModuleContext.getInstance().getApiLevel();
		options.outputDirectory = ModuleContext.getInstance().getAppContext().getFilesDir().getAbsolutePath()+"/smali";
		options.allowOdex = true;
		options.deodex = true;
		options.jobs = 8;
		options.bootClassPathDirs.add("/system/framework/");
		if (options.apiLevel >= 17) {
			options.checkPackagePrivateAccess = true;
		}
		options.registerInfo = 128;
		options.noAccessorComments = false;
		options.useLocalsDirective = true;
		options.noParameterRegisters = false;
		options.useSequentialLabels = true;
		options.outputDebugInfo = true;
		options.addCodeOffsets = false;
		return options;
	}
 
Example #9
Source File: BackSmaliCommandHandler.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	// TODO Auto-generated method stub
	String filename = ModuleContext.getInstance().getAppContext().getFilesDir()+"/dexfile.dex";
	DexFileInfoCollecter.getInstance().backsmaliDexFile(filename, dexpath);
	Logger.log("the dexfile data save to ="+filename);
}
 
Example #10
Source File: NativeFunction.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public static MemoryDexFileItemPointer queryDexFileItemPointer(int cookie){
	int version = ModuleContext.getInstance().getApiLevel();
	DexFileHeadersPointer iteminfo = getHeaderItemPtr(cookie,version);
	MemoryDexFileItemPointer pointer = new MemoryDexFileItemPointer();
	pointer.setBaseAddr(iteminfo.getBaseAddr());
	pointer.setpClassDefs(iteminfo.getpClassDefs());
	pointer.setpFieldIds(iteminfo.getpFieldIds());
	pointer.setpMethodIds(iteminfo.getpMethodIds());
	pointer.setpProtoIds(iteminfo.getpProtoIds());
	pointer.setpStringIds(iteminfo.getpStringIds());
	pointer.setpTypeIds(iteminfo.getpTypeIds());
       pointer.setClassCount(iteminfo.getClassCount());
	return pointer;

}
 
Example #11
Source File: DumpDexFileCommandHandler.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	// TODO Auto-generated method stub
	String filename = ModuleContext.getInstance().getAppContext().getFilesDir()+"/dexdump.odex";
	DexFileInfoCollecter.getInstance().dumpDexFile(filename, dexpath);
	Logger.log("the dexfile data save to ="+filename);
}
 
Example #12
Source File: DumpMemCommandHandler.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	// TODO Auto-generated method stub
	String memfilePath = ModuleContext.getInstance().getAppContext().getFilesDir()+"/"+dumpFileName;
       MemDump.dumpMem(memfilePath,start, length);       
       Logger.log("the mem data save to ="+ memfilePath);
}
 
Example #13
Source File: DumpHeapCommandHandler.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	// TODO Auto-generated method stub
	String heapfilePath =ModuleContext.getInstance().getAppContext().getFilesDir()+"/"+dumpFileName;
       HeapDump.dumpHeap(heapfilePath);
       Logger.log("the heap data save to ="+ heapfilePath);
}
 
Example #14
Source File: BackSmaliCommandHandler.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	// TODO Auto-generated method stub
	String filename = ModuleContext.getInstance().getAppContext().getFilesDir()+"/dexfile.dex";
	DexFileInfoCollecter.getInstance().backsmaliDexFile(filename, dexpath);
	Logger.log("the dexfile data save to ="+filename);
}
 
Example #15
Source File: NativeFunction.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
public static MemoryDexFileItemPointer queryDexFileItemPointer(int cookie){
	int version = ModuleContext.getInstance().getApiLevel();
	DexFileHeadersPointer iteminfo = getHeaderItemPtr(cookie,version);
	MemoryDexFileItemPointer pointer = new MemoryDexFileItemPointer();
	pointer.setBaseAddr(iteminfo.getBaseAddr());
	pointer.setpClassDefs(iteminfo.getpClassDefs());
	pointer.setpFieldIds(iteminfo.getpFieldIds());
	pointer.setpMethodIds(iteminfo.getpMethodIds());
	pointer.setpProtoIds(iteminfo.getpProtoIds());
	pointer.setpStringIds(iteminfo.getpStringIds());
	pointer.setpTypeIds(iteminfo.getpTypeIds());
       pointer.setClassCount(iteminfo.getClassCount());
	return pointer;

}
 
Example #16
Source File: DumpDexFileCommandHandler.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	// TODO Auto-generated method stub
	String filename = ModuleContext.getInstance().getAppContext().getFilesDir()+"/dexdump.odex";
	DexFileInfoCollecter.getInstance().dumpDexFile(filename, dexpath);
	Logger.log("the dexfile data save to ="+filename);
}
 
Example #17
Source File: DumpMemCommandHandler.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	// TODO Auto-generated method stub
	String memfilePath = ModuleContext.getInstance().getAppContext().getFilesDir()+"/"+dumpFileName;
       MemDump.dumpMem(memfilePath,start, length);       
       Logger.log("the mem data save to ="+ memfilePath);
}
 
Example #18
Source File: DumpHeapCommandHandler.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	// TODO Auto-generated method stub
	String heapfilePath =ModuleContext.getInstance().getAppContext().getFilesDir()+"/"+dumpFileName;
       HeapDump.dumpHeap(heapfilePath);
       Logger.log("the heap data save to ="+ heapfilePath);
}
 
Example #19
Source File: BackSmaliCommandHandler.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {

    if (Build.VERSION.SDK_INT >= 20) {
        //TODO 增加art虚拟机中backsmali的支持
        Logger.log("Forbidden ! in Art, ZjDroid was unable to back smali dex file automaticly!");
        return;
    }

    String filename = ModuleContext.getInstance().getAppContext().getFilesDir() + "/dexfile" + mCookie + ".dex";
    DexFileInfoCollecter.getInstance().backsmaliDexFile(filename, mCookie);
    Logger.log("the dexfile data save to =" + filename);
}
 
Example #20
Source File: NativeFunction.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
public static MemoryDexFileItemPointer queryDexFileItemPointer(int cookie){
	int version = ModuleContext.getInstance().getApiLevel();
	DexFileHeadersPointer iteminfo = getHeaderItemPtr(cookie,version);
	MemoryDexFileItemPointer pointer = new MemoryDexFileItemPointer();
	pointer.setBaseAddr(iteminfo.getBaseAddr());
	pointer.setpClassDefs(iteminfo.getpClassDefs());
	pointer.setpFieldIds(iteminfo.getpFieldIds());
	pointer.setpMethodIds(iteminfo.getpMethodIds());
	pointer.setpProtoIds(iteminfo.getpProtoIds());
	pointer.setpStringIds(iteminfo.getpStringIds());
	pointer.setpTypeIds(iteminfo.getpTypeIds());
       pointer.setClassCount(iteminfo.getClassCount());
	return pointer;

}
 
Example #21
Source File: DumpDexFileCommandHandler.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	// TODO Auto-generated method stub
	String filename = ModuleContext.getInstance().getAppContext().getFilesDir()+"/dexdump.odex";
	DexFileInfoCollecter.getInstance().dumpDexFile(filename, dexpath);
	Logger.log("the dexfile data save to ="+filename);
}
 
Example #22
Source File: DumpMemCommandHandler.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	// TODO Auto-generated method stub
	String memfilePath = ModuleContext.getInstance().getAppContext().getFilesDir()+"/"+dumpFileName;
       MemDump.dumpMem(memfilePath,start, length);       
       Logger.log("the mem data save to ="+ memfilePath);
}
 
Example #23
Source File: DumpHeapCommandHandler.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	// TODO Auto-generated method stub
	String heapfilePath =ModuleContext.getInstance().getAppContext().getFilesDir()+"/"+dumpFileName;
       HeapDump.dumpHeap(heapfilePath);
       Logger.log("the heap data save to ="+ heapfilePath);
}
 
Example #24
Source File: BackSmaliCommandHandler.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	// TODO Auto-generated method stub
	String filename = ModuleContext.getInstance().getAppContext().getFilesDir()+"/dexfile.dex";
	DexFileInfoCollecter.getInstance().backsmaliDexFile(filename, dexpath);
	Logger.log("the dexfile data save to ="+filename);
}
 
Example #25
Source File: ReverseXposedModule.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
    public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {


        XMMultiDex.install(ReverseXposedModule.class.getClassLoader(),MODULE_PATH,lpparam.appInfo);

        APPINFO_DATA_DIR = lpparam.appInfo.dataDir;

//        addNativeLibDic();



        if (lpparam.appInfo == null ||
                (lpparam.appInfo.flags & (ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) != 0) {
            return;
        } else if (lpparam.isFirstApplication && !ZJDROID_PACKAGENAME.equals(lpparam.packageName)) {
            Logger.PACKAGENAME = lpparam.packageName;
            Logger.log("the package = " + lpparam.packageName + " has hook");
            Logger.log("the app target id = " + android.os.Process.myPid());
            PackageMetaInfo pminfo = PackageMetaInfo.fromXposed(lpparam);
            ModuleContext.getInstance().initModuleContext(pminfo);
            DexFileInfoCollecter.getInstance().start();
            LuaScriptInvoker.getInstance().start();


            Logger.log_behavior("the package = " + lpparam.packageName + " has hook");
            Logger.log_behavior("the app target id = " + android.os.Process.myPid());
            ApiMonitorHookManager.getInstance().startMonitor();
        } else {

        }
    }
 
Example #26
Source File: DumpDexFileCommandHandler.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override
public void doAction() {
    String filename = ModuleContext.getInstance().getAppContext().getFilesDir() + "/dexdump" + mCookie + ".odex";
    DexFileInfoCollecter.getInstance().dumpDexFile(filename, Long.parseLong(mCookie));
    Logger.log("the dexfile data save to =" + filename);
}
 
Example #27
Source File: DumpMemCommandHandler.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override
public void doAction() {
	String memfilePath = ModuleContext.getInstance().getAppContext().getFilesDir()+"/"+dumpFileName;
       MemDump.dumpMem(memfilePath, start, length);
       Logger.log("the mem data save to ="+ memfilePath);
}
 
Example #28
Source File: DumpHeapCommandHandler.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override
public void doAction() {
	String heapfilePath =ModuleContext.getInstance().getAppContext().getFilesDir()+"/"+dumpFileName;
       HeapDump.dumpHeap(heapfilePath);
       Logger.log("the heap data save to ="+ heapfilePath);
}