Java Code Examples for com.android.reverse.util.Logger#log()

The following examples show how to use com.android.reverse.util.Logger#log() . 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 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 2
Source File: DumpClassCommandHandler.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Override
public void doAction() {
	// TODO Auto-generated method stub
	String[] loadClass = DexFileInfoCollecter.getInstance().dumpLoadableClass(dexpath);
	if (loadClass != null) {
		Logger.log("Start Loadable ClassName ->");
		String className = null;
		for (int i = 0; i < loadClass.length; i++) {
			className = loadClass[i];
			if (!this.isFilterClass(className)) {
				Logger.log("ClassName = " + className);
			}
		}
		Logger.log("End Loadable ClassName");
	}else{
		Logger.log("Can't find class loaded by the dex");
	}
}
 
Example 3
Source File: DexBackedMethod.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
public DexBackedMethod(@Nonnull DexReader reader,
                       @Nonnull DexBackedClassDef classDef,
                       int previousMethodIndex) {
    this.dexFile = reader.dexBuf;
    this.classDef = classDef;

    // large values may be used for the index delta, which cause the cumulative index to overflow upon
    // addition, effectively allowing out of order entries.
    int methodIndexDiff = reader.readLargeUleb128();
    this.methodIndex = methodIndexDiff + previousMethodIndex;
    this.accessFlags = reader.readSmallUleb128();
    this.codeOffset = reader.readSmallUleb128();
    Logger.log("the codeoffset :" +this.codeOffset);
    this.methodAnnotationSetOffset = 0;
    this.parameterAnnotationSetListOffset = 0;
}
 
Example 4
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 5
Source File: DexFileInfoCollecter.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
public String[] dumpLoadableClass(String dexPath) {
	int mCookie = this.getCookie(dexPath);
	if (mCookie != 0) {
		return (String[]) RefInvoke.invokeStaticMethod("dalvik.system.DexFile", "getClassNameList", new Class[] { int.class },
				new Object[] { mCookie });
	} else {
		Logger.log("the cookie is not right");
	}
	return null;

}
 
Example 6
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 7
Source File: LuaScriptInvoker.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public int execute() throws LuaException {
	
	int param_size = this.L.getTop();
	if(param_size ==2 ){
		String message = this.L.getLuaObject(2).getString();
		Logger.log(message);
	}
	
	return 0;
}
 
Example 8
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 9
Source File: DexBackedDexFile.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
public DexBackedDexFile(Opcodes opcodes,MemoryDexFileItemPointer pointer, MemoryReader reader){
	super(reader,pointer.getBaseAddr());
	this.pointer = pointer;
	this.opcodes = opcodes;
	this.reader = reader;
	this.type = DexFileDataType.MEMORYTYPE;
    stringCount = 0;
    stringStartOffset = this.pointer.getpStringIds()-this.pointer.getBaseAddr();
    typeCount = 0;
    typeStartOffset = this.pointer.getpTypeIds() - this.pointer.getBaseAddr();
    protoCount = 0;
    protoStartOffset = this.pointer.getpProtoIds() - this.pointer.getBaseAddr();
    fieldCount = 0;
    fieldStartOffset = this.pointer.getpFieldIds()-this.pointer.getBaseAddr();
    methodCount = 0;
    methodStartOffset = this.pointer.getpMethodIds()- this.pointer.getBaseAddr();
    classCount = this.pointer.getClassCount();
    classStartOffset = this.pointer.getpClassDefs() - this.pointer.getBaseAddr();
    Logger.log("the dexfile header item info start-->>>>>>>>>>");
    Logger.log("the stringStartOffset =" + stringStartOffset);
    Logger.log("the typeStartOffset =" + typeStartOffset);
    Logger.log("the protoStartOffset =" + protoStartOffset);
    Logger.log("the fieldStartOffset =" + fieldStartOffset);
    Logger.log("the methodStartOffset =" + methodStartOffset);
    Logger.log("the classStartOffset =" + classStartOffset);
    Logger.log("the classCount =" + classCount);
    Logger.log("the dexfile header item info end<<<<<<<<<<<--");
    
}
 
Example 10
Source File: InvokeScriptCommandHandler.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	Logger.log("The Script invoke start");
	if (this.type == ScriptType.TEXTTYPE) {
		LuaScriptInvoker.getInstance().invokeScript(script);
	} else if (this.type == ScriptType.FILETYPE) {
		LuaScriptInvoker.getInstance().invokeFileScript(filePath);
	} else {
		Logger.log("the script type is invalid");
	}
	Logger.log("The Script invoke end");

}
 
Example 11
Source File: CommandBroadcastReceiver.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(final Context arg0, Intent arg1) {
	// TODO Auto-generated method stub
	if (INTENT_ACTION.equals(arg1.getAction())) {
		try {
			int pid = arg1.getIntExtra(TARGET_KEY, 0);
			if (pid == android.os.Process.myPid()) {
				String cmd = arg1.getStringExtra(COMMAND_NAME_KEY);
				final CommandHandler handler = CommandHandlerParser
						.parserCommand(cmd);
				if (handler != null) {
					new Thread(new Runnable() {
						@Override
						public void run() {
							// TODO Auto-generated method stub
							handler.doAction();
						}
					}).start();
				}else{
					Logger.log("the cmd is invalid");
				}
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
 
Example 12
Source File: LuaScriptInvoker.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
public void invokeFileScript(String scriptFilePath){
	LuaState luaState = LuaStateFactory.newLuaState();
	luaState.openLibs();
	this.initLuaContext(luaState);
	int error = luaState.LdoFile(scriptFilePath);
	if(error!=0){
		Logger.log("Read/Parse lua error. Exit");
		return;
	}
	luaState.close();
}
 
Example 13
Source File: DumpDexInfoCommandHandler.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	HashMap<String, DexFileInfo> dexfileInfo = DexFileInfoCollecter.getInstance().dumpDexFileInfo();
	Iterator<DexFileInfo> itor = dexfileInfo.values().iterator();
	DexFileInfo info = null;
	Logger.log("The DexFile Infomation ->");
	while (itor.hasNext()) {
		info = itor.next();
		Logger.log("filepath:"+ info.getDexPath()+" mCookie:"+info.getmCookie());
	}
	Logger.log("End DexFile Infomation");
}
 
Example 14
Source File: LuaScriptInvoker.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
public void invokeScript(String script){
	LuaState luaState = LuaStateFactory.newLuaState();
	luaState.openLibs();
	this.initLuaContext(luaState);
	int error = luaState.LdoString(script);
	if(error!=0){
		Logger.log("Read/Parse lua error. Exit");
		return;
	}
	
	luaState.close();
}
 
Example 15
Source File: LuaScriptInvoker.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public int execute() throws LuaException {
	
	int param_size = this.L.getTop();
	for(int i=2; i<=param_size; i++){
		try {
			String objDsrc = JsonWriter.parserInstanceToJson(this.getParam(i).getObject());
			Logger.log(objDsrc);
		} catch (Exception e) {
			e.printStackTrace();
		}				
	}
	return 0;
}
 
Example 16
Source File: InvokeScriptCommandHandler.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public void doAction() {
	Logger.log("The Script invoke start");
	if (this.type == ScriptType.TEXTTYPE) {
		LuaScriptInvoker.getInstance().invokeScript(script);
	} else if (this.type == ScriptType.FILETYPE) {
		LuaScriptInvoker.getInstance().invokeFileScript(filePath);
	} else {
		Logger.log("the script type is invalid");
	}
	Logger.log("The Script invoke end");

}
 
Example 17
Source File: LuaScriptInvoker.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public void invokeScript(String script){
	LuaState luaState = LuaStateFactory.newLuaState();
	luaState.openLibs();
	this.initLuaContext(luaState);
	int error = luaState.LdoString(script);
	if(error!=0){
		Logger.log("Read/Parse lua error. Exit");
		return;
	}
	
	luaState.close();
}
 
Example 18
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 19
Source File: NativeHookCollecter.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
public void parserNativeHookInfo() {
	Logger.log("The parser native hook info start");
	if (initSysLinkInfo == null) {
		Logger.log("the init syslink info == null");
		return;
	}

	int hookcount =0;
	HashMap<String, HashMap<String, Integer>> currentInfo = NativeFunction
			.getSyslinkSnapshot();
	Iterator<String> libkeys = currentInfo.keySet().iterator();
	HashMap<String, Integer> currentlinks;
	HashMap<String, Integer> initlinks;
	while (libkeys.hasNext()) {
		String libName = libkeys.next();
		if (initSysLinkInfo.containsKey(libName)) {
			currentlinks = currentInfo.get(libName);
			initlinks = initSysLinkInfo.get(libName);
			Iterator<String> sysNamekeys = currentlinks.keySet().iterator();
			while (sysNamekeys.hasNext()) {
				String sysName = sysNamekeys.next();
				if (initlinks.containsKey(sysName)) {
					int currentAddr = currentlinks.get(sysName);
					int initAddr = initlinks.get(sysName);
					if (currentAddr != initAddr) {
						Logger.log("The " + libName + " syslink:" + sysName
								+ " oldAddr:" + initAddr + " newAddr:"
								+ currentAddr);
						hookcount++;
					} 
					
				}
			}
		}
	}
	if(hookcount == 0 ){
		Logger.log("the app can't hook native function");
	}else{
		Logger.log("The app total hook native function = "+hookcount);
	}
	Logger.log("The parser native hook info end");
}
 
Example 20
Source File: NativeHookCollecter.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public void parserNativeHookInfo() {
	Logger.log("The parser native hook info start");
	if (initSysLinkInfo == null) {
		Logger.log("the init syslink info == null");
		return;
	}

	int hookcount =0;
	HashMap<String, HashMap<String, Integer>> currentInfo = NativeFunction
			.getSyslinkSnapshot();
	Iterator<String> libkeys = currentInfo.keySet().iterator();
	HashMap<String, Integer> currentlinks;
	HashMap<String, Integer> initlinks;
	while (libkeys.hasNext()) {
		String libName = libkeys.next();
		if (initSysLinkInfo.containsKey(libName)) {
			currentlinks = currentInfo.get(libName);
			initlinks = initSysLinkInfo.get(libName);
			Iterator<String> sysNamekeys = currentlinks.keySet().iterator();
			while (sysNamekeys.hasNext()) {
				String sysName = sysNamekeys.next();
				if (initlinks.containsKey(sysName)) {
					int currentAddr = currentlinks.get(sysName);
					int initAddr = initlinks.get(sysName);
					if (currentAddr != initAddr) {
						Logger.log("The " + libName + " syslink:" + sysName
								+ " oldAddr:" + initAddr + " newAddr:"
								+ currentAddr);
						hookcount++;
					} 
					
				}
			}
		}
	}
	if(hookcount == 0 ){
		Logger.log("the app can't hook native function");
	}else{
		Logger.log("The app total hook native function = "+hookcount);
	}
	Logger.log("The parser native hook info end");
}