com.android.reverse.util.RefInvoke Java Examples

The following examples show how to use com.android.reverse.util.RefInvoke. 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: ActivityThreadHook.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	try {
		Class receiverDataClass = Class.forName("android.app.ActivityThread$ReceiverData");
		if (receiverDataClass != null) {
			Method handleReceiverMethod = RefInvoke.findMethodExact("android.app.ActivityThread", ClassLoader.getSystemClassLoader(),
					"handleReceiver", receiverDataClass);
			hookhelper.hookMethod(handleReceiverMethod, new AbstractBahaviorHookCallBack() {

				@Override
				public void descParam(HookParam param) {
					Logger.log_behavior("The Receiver Information:");
					Object data = param.args[0];
					Logger.log_behavior(data.toString());
					
				}
			});
		}
	} catch (ClassNotFoundException e) {
		e.printStackTrace();
	}
}
 
Example #2
Source File: ConnectivityManagerHook.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	
	Method setMobileDataEnabledmethod = RefInvoke.findMethodExact(
			"android.net.ConnectivityManager", ClassLoader.getSystemClassLoader(),
			"setMobileDataEnabled",boolean.class);
	hookhelper.hookMethod(setMobileDataEnabledmethod, new AbstractBahaviorHookCallBack() {
		
		@Override
		public void descParam(HookParam param) {
			boolean status = (Boolean) param.args[0];
			Logger.log("Set MobileDataEnabled = "+status);
		}
	});
	
}
 
Example #3
Source File: AlarmManagerHook.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	
	Method setImplmethod = RefInvoke.findMethodExact(
			"android.app.AlarmManager", ClassLoader.getSystemClassLoader(),
			"setImpl",int.class,long.class,long.class,long.class,PendingIntent.class,WorkSource.class);
	hookhelper.hookMethod(setImplmethod, new AbstractBahaviorHookCallBack() {
		
		@Override
		public void descParam(HookParam param) {
			Logger.log_behavior("The Alarm Information:");
			PendingIntent intent = (PendingIntent) param.args[4];
			descPendingIntent(intent);
			Logger.log_behavior("TriggerAtMillis = "+param.args[1]);
			Logger.log_behavior("windowMillis = "+param.args[2]);
			Logger.log_behavior("intervalMillis = "+param.args[3]);

		}
	});
	
}
 
Example #4
Source File: ProcessBuilderHook.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	// TODO Auto-generated method stub
	Method execmethod = RefInvoke.findMethodExact(
			"java.lang.ProcessBuilder", ClassLoader.getSystemClassLoader(),
			"start");
	hookhelper.hookMethod(execmethod, new AbstractBahaviorHookCallBack() {			
		@Override
		public void descParam(HookParam param) {
			// TODO Auto-generated method stub
			Logger.log_behavior("Create New Process ->");
			ProcessBuilder pb = (ProcessBuilder) param.thisObject;
			List<String> cmds = pb.command();
			StringBuilder sb = new StringBuilder();
			for(int i=0 ;i <cmds.size(); i++){
			   sb.append("CMD"+i+":"+cmds.get(i)+" ");
			}
			Logger.log_behavior("Command" + sb.toString());
		}
	});
}
 
Example #5
Source File: RuntimeHook.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {

	Method execmethod = RefInvoke.findMethodExact(
			"java.lang.Runtime", ClassLoader.getSystemClassLoader(),
			"exec", String[].class,String[].class,File.class);
	hookhelper.hookMethod(execmethod, new AbstractBahaviorHookCallBack() {			
		@Override
		public void descParam(HookParam param) {
			// TODO Auto-generated method stub
			Logger.log_behavior("Create New Process ->");
			String[] progs = (String[]) param.args[0];
			for(int i=0 ;i <progs.length; i++){
			   Logger.log_behavior("Command" + i + " = "+progs[i]);
			}
		}
	});
	
}
 
Example #6
Source File: AudioRecordHook.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	// TODO Auto-generated method stub
	Method startRecordingMethod = RefInvoke.findMethodExact(
			"android.media.AudioRecord", ClassLoader.getSystemClassLoader(),
			"startRecording");
	hookhelper.hookMethod(startRecordingMethod, new AbstractBahaviorHookCallBack() {
		
		@Override
		public void descParam(HookParam param) {
			// TODO Auto-generated method stub
			Logger.log_behavior("Audio Recording ->");
		}
	});
	
}
 
Example #7
Source File: ActivityThreadHook.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	// TODO Auto-generated method stub
	try {
		Class receiverDataClass = Class.forName("android.app.ActivityThread$ReceiverData");
		if (receiverDataClass != null) {
			Method handleReceiverMethod = RefInvoke.findMethodExact("android.app.ActivityThread", ClassLoader.getSystemClassLoader(),
					"handleReceiver", receiverDataClass);
			hookhelper.hookMethod(handleReceiverMethod, new AbstractBahaviorHookCallBack() {

				@Override
				public void descParam(HookParam param) {
					Logger.log_behavior("The Receiver Information:");
					Object data = param.args[0];
					Logger.log_behavior(data.toString());
					
				}
			});
		}
	} catch (ClassNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
Example #8
Source File: ContextImplHook.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	// TODO Auto-generated method stub
	Method registerReceivermethod = RefInvoke.findMethodExact(
			"android.app.ContextImpl", ClassLoader.getSystemClassLoader(),
			"registerReceiver", BroadcastReceiver.class,IntentFilter.class);
	hookhelper.hookMethod(registerReceivermethod, new AbstractBahaviorHookCallBack() {
		
		@Override
		public void descParam(HookParam param) {
			// TODO Auto-generated method stub				
			Logger.log_behavior("Register BroatcastReceiver");
			Logger.log_behavior("The BroatcastReceiver ClassName = "+param.args[0].getClass().toString());
			if(param.args[1] != null){
			   String intentstr = descIntentFilter((IntentFilter) param.args[1]);
			   Logger.log_behavior("Intent Action = ["+intentstr+"]");
			}
		}
	});
}
 
Example #9
Source File: ConnectivityManagerHook.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	
	Method setMobileDataEnabledmethod = RefInvoke.findMethodExact(
			"android.net.ConnectivityManager", ClassLoader.getSystemClassLoader(),
			"setMobileDataEnabled",boolean.class);
	hookhelper.hookMethod(setMobileDataEnabledmethod, new AbstractBahaviorHookCallBack() {
		
		@Override
		public void descParam(HookParam param) {
			boolean status = (Boolean) param.args[0];
			Logger.log("Set MobileDataEnabled = "+status);
		}
	});
	
}
 
Example #10
Source File: AlarmManagerHook.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	
	Method setImplmethod = RefInvoke.findMethodExact(
			"android.app.AlarmManager", ClassLoader.getSystemClassLoader(),
			"setImpl",int.class,long.class,long.class,long.class,PendingIntent.class,WorkSource.class);
	hookhelper.hookMethod(setImplmethod, new AbstractBahaviorHookCallBack() {
		
		@Override
		public void descParam(HookParam param) {
			Logger.log_behavior("The Alarm Information:");
			PendingIntent intent = (PendingIntent) param.args[4];
			if(intent != null)
			   descPendingIntent(intent);
			Logger.log_behavior("TriggerAtMillis = "+param.args[1]);
			Logger.log_behavior("windowMillis = "+param.args[2]);
			Logger.log_behavior("intervalMillis = "+param.args[3]);

		}
	});
	
}
 
Example #11
Source File: ProcessBuilderHook.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	// TODO Auto-generated method stub
	Method execmethod = RefInvoke.findMethodExact(
			"java.lang.ProcessBuilder", ClassLoader.getSystemClassLoader(),
			"start");
	hookhelper.hookMethod(execmethod, new AbstractBahaviorHookCallBack() {			
		@Override
		public void descParam(HookParam param) {
			// TODO Auto-generated method stub
			Logger.log_behavior("Create New Process ->");
			ProcessBuilder pb = (ProcessBuilder) param.thisObject;
			List<String> cmds = pb.command();
			StringBuilder sb = new StringBuilder();
			for(int i=0 ;i <cmds.size(); i++){
			   sb.append("CMD"+i+":"+cmds.get(i)+" ");
			}
			Logger.log_behavior("Command" + sb.toString());
		}
	});
}
 
Example #12
Source File: RuntimeHook.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {

	Method execmethod = RefInvoke.findMethodExact(
			"java.lang.Runtime", ClassLoader.getSystemClassLoader(),
			"exec", String[].class,String[].class,File.class);
	hookhelper.hookMethod(execmethod, new AbstractBahaviorHookCallBack() {			
		@Override
		public void descParam(HookParam param) {
			// TODO Auto-generated method stub
			Logger.log_behavior("Create New Process ->");
			String[] progs = (String[]) param.args[0];
			for(int i=0 ;i <progs.length; i++){
			   Logger.log_behavior("Command" + i + " = "+progs[i]);
			}
		}
	});
	
}
 
Example #13
Source File: AudioRecordHook.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	// TODO Auto-generated method stub
	Method startRecordingMethod = RefInvoke.findMethodExact(
			"android.media.AudioRecord", ClassLoader.getSystemClassLoader(),
			"startRecording");
	hookhelper.hookMethod(startRecordingMethod, new AbstractBahaviorHookCallBack() {
		
		@Override
		public void descParam(HookParam param) {
			// TODO Auto-generated method stub
			Logger.log_behavior("Audio Recording ->");
		}
	});
	
}
 
Example #14
Source File: ActivityThreadHook.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	// TODO Auto-generated method stub
	try {
		Class receiverDataClass = Class.forName("android.app.ActivityThread$ReceiverData");
		if (receiverDataClass != null) {
			Method handleReceiverMethod = RefInvoke.findMethodExact("android.app.ActivityThread", ClassLoader.getSystemClassLoader(),
					"handleReceiver", receiverDataClass);
			hookhelper.hookMethod(handleReceiverMethod, new AbstractBahaviorHookCallBack() {

				@Override
				public void descParam(HookParam param) {
					Logger.log_behavior("The Receiver Information:");
					Object data = param.args[0];
					Logger.log_behavior(data.toString());
					
				}
			});
		}
	} catch (ClassNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
Example #15
Source File: ContextImplHook.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	// TODO Auto-generated method stub
	Method registerReceivermethod = RefInvoke.findMethodExact(
			"android.app.ContextImpl", ClassLoader.getSystemClassLoader(),
			"registerReceiver", BroadcastReceiver.class,IntentFilter.class);
	hookhelper.hookMethod(registerReceivermethod, new AbstractBahaviorHookCallBack() {
		
		@Override
		public void descParam(HookParam param) {
			// TODO Auto-generated method stub				
			Logger.log_behavior("Register BroatcastReceiver");
			if(param.args[0] != null){
			   Logger.log_behavior("The BroatcastReceiver ClassName = "+param.args[0].getClass().toString());
			}
			if(param.args[1] != null){
			   String intentstr = descIntentFilter((IntentFilter) param.args[1]);
			   Logger.log_behavior("Intent Action = ["+intentstr+"]");
			}
		}
	});
}
 
Example #16
Source File: ConnectivityManagerHook.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	
	Method setMobileDataEnabledmethod = RefInvoke.findMethodExact(
			"android.net.ConnectivityManager", ClassLoader.getSystemClassLoader(),
			"setMobileDataEnabled",boolean.class);
	hookhelper.hookMethod(setMobileDataEnabledmethod, new AbstractBahaviorHookCallBack() {
		
		@Override
		public void descParam(HookParam param) {
			boolean status = (Boolean) param.args[0];
			Logger.log("Set MobileDataEnabled = "+status);
		}
	});
	
}
 
Example #17
Source File: RuntimeHook.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {

	Method execmethod = RefInvoke.findMethodExact(
			"java.lang.Runtime", ClassLoader.getSystemClassLoader(),
			"exec", String[].class,String[].class,File.class);
	hookhelper.hookMethod(execmethod, new AbstractBahaviorHookCallBack() {			
		@Override
		public void descParam(HookParam param) {
			Logger.log_behavior("Create New Process ->");
			String[] progs = (String[]) param.args[0];
			for(int i=0 ;i <progs.length; i++){
			   Logger.log_behavior("Command" + i + " = "+progs[i]);
			}
		}
	});
	
}
 
Example #18
Source File: ProcessBuilderHook.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	// TODO Auto-generated method stub
	Method execmethod = RefInvoke.findMethodExact(
			"java.lang.ProcessBuilder", ClassLoader.getSystemClassLoader(),
			"start");
	hookhelper.hookMethod(execmethod, new AbstractBahaviorHookCallBack() {			
		@Override
		public void descParam(HookParam param) {
			// TODO Auto-generated method stub
			Logger.log_behavior("Create New Process ->");
			ProcessBuilder pb = (ProcessBuilder) param.thisObject;
			List<String> cmds = pb.command();
			StringBuilder sb = new StringBuilder();
			for(int i=0 ;i <cmds.size(); i++){
			   sb.append("CMD"+i+":"+cmds.get(i)+" ");
			}
			Logger.log_behavior("Command" + sb.toString());
		}
	});
}
 
Example #19
Source File: RuntimeHook.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {

	Method execmethod = RefInvoke.findMethodExact(
			"java.lang.Runtime", ClassLoader.getSystemClassLoader(),
			"exec", String[].class,String[].class,File.class);
	hookhelper.hookMethod(execmethod, new AbstractBahaviorHookCallBack() {			
		@Override
		public void descParam(HookParam param) {
			// TODO Auto-generated method stub
			Logger.log_behavior("Create New Process ->");
			String[] progs = (String[]) param.args[0];
			for(int i=0 ;i <progs.length; i++){
			   Logger.log_behavior("Command" + i + " = "+progs[i]);
			}
		}
	});
	
}
 
Example #20
Source File: AudioRecordHook.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	// TODO Auto-generated method stub
	Method startRecordingMethod = RefInvoke.findMethodExact(
			"android.media.AudioRecord", ClassLoader.getSystemClassLoader(),
			"startRecording");
	hookhelper.hookMethod(startRecordingMethod, new AbstractBahaviorHookCallBack() {
		
		@Override
		public void descParam(HookParam param) {
			// TODO Auto-generated method stub
			Logger.log_behavior("Audio Recording ->");
		}
	});
	
}
 
Example #21
Source File: ActivityThreadHook.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	// TODO Auto-generated method stub
	try {
		Class receiverDataClass = Class.forName("android.app.ActivityThread$ReceiverData");
		if (receiverDataClass != null) {
			Method handleReceiverMethod = RefInvoke.findMethodExact("android.app.ActivityThread", ClassLoader.getSystemClassLoader(),
					"handleReceiver", receiverDataClass);
			hookhelper.hookMethod(handleReceiverMethod, new AbstractBahaviorHookCallBack() {

				@Override
				public void descParam(HookParam param) {
					Logger.log_behavior("The Receiver Information:");
					Object data = param.args[0];
					Logger.log_behavior(data.toString());
					
				}
			});
		}
	} catch (ClassNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
Example #22
Source File: ContextImplHook.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	// TODO Auto-generated method stub
	Method registerReceivermethod = RefInvoke.findMethodExact(
			"android.app.ContextImpl", ClassLoader.getSystemClassLoader(),
			"registerReceiver", BroadcastReceiver.class,IntentFilter.class);
	hookhelper.hookMethod(registerReceivermethod, new AbstractBahaviorHookCallBack() {
		
		@Override
		public void descParam(HookParam param) {
			// TODO Auto-generated method stub				
			Logger.log_behavior("Register BroatcastReceiver");
			Logger.log_behavior("The BroatcastReceiver ClassName = "+param.args[0].getClass().toString());
			if(param.args[1] != null){
			   String intentstr = descIntentFilter((IntentFilter) param.args[1]);
			   Logger.log_behavior("Intent Action = ["+intentstr+"]");
			}
		}
	});
}
 
Example #23
Source File: ProcessBuilderHook.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	Method execmethod = RefInvoke.findMethodExact(
			"java.lang.ProcessBuilder", ClassLoader.getSystemClassLoader(),
			"start");
	hookhelper.hookMethod(execmethod, new AbstractBahaviorHookCallBack() {			
		@Override
		public void descParam(HookParam param) {
			Logger.log_behavior("Create New Process ->");
			ProcessBuilder pb = (ProcessBuilder) param.thisObject;
			List<String> cmds = pb.command();
			StringBuilder sb = new StringBuilder();
			for(int i=0 ;i <cmds.size(); i++){
			   sb.append("CMD"+i+":"+cmds.get(i)+" ");
			}
			Logger.log_behavior("Command" + sb.toString());
		}
	});
}
 
Example #24
Source File: AlarmManagerHook.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	
	Method setImplmethod = RefInvoke.findMethodExact(
			"android.app.AlarmManager", ClassLoader.getSystemClassLoader(),
			"setImpl",int.class,long.class,long.class,long.class,PendingIntent.class,WorkSource.class);
	hookhelper.hookMethod(setImplmethod, new AbstractBahaviorHookCallBack() {
		
		@Override
		public void descParam(HookParam param) {
			Logger.log_behavior("The Alarm Information:");
			PendingIntent intent = (PendingIntent) param.args[4];
			descPendingIntent(intent);
			Logger.log_behavior("TriggerAtMillis = "+param.args[1]);
			Logger.log_behavior("windowMillis = "+param.args[2]);
			Logger.log_behavior("intervalMillis = "+param.args[3]);

		}
	});
	
}
 
Example #25
Source File: ConnectivityManagerHook.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {

    if (Build.VERSION.SDK_INT <= 19) {

        Method setMobileDataEnabledmethod = RefInvoke.findMethodExact(
                "android.net.ConnectivityManager", ClassLoader.getSystemClassLoader(),
                "setMobileDataEnabled", boolean.class);
        hookhelper.hookMethod(setMobileDataEnabledmethod, new AbstractBahaviorHookCallBack() {

            @Override
            public void descParam(HookParam param) {
                boolean status = (Boolean) param.args[0];
                Logger.log("Set MobileDataEnabled = " + status);
            }
        });

    }

    
}
 
Example #26
Source File: NetWorkHook.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Override
public void startHook() {
	// HttpURLConnection
	Method openConnectionMethod = RefInvoke.findMethodExact("java.net.URL", ClassLoader.getSystemClassLoader(), "openConnection");
	hookhelper.hookMethod(openConnectionMethod, new AbstractBahaviorHookCallBack() {
		@Override
		public void descParam(HookParam param) {
			URL url = (URL) param.thisObject;
			Logger.log_behavior("Connect to URL ->");
			Logger.log_behavior("The URL = " + url.toString());
		}
	});

	if(Build.VERSION.SDK_INT < 23){
		httpHook = new ApacheHttpHook();

		httpHook.startHook();

	}



}
 
Example #27
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 #28
Source File: AudioRecordHook.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public void startHook() {
	Method startRecordingMethod = RefInvoke.findMethodExact(
			"android.media.AudioRecord", ClassLoader.getSystemClassLoader(),
			"startRecording");
	hookhelper.hookMethod(startRecordingMethod, new AbstractBahaviorHookCallBack() {
		
		@Override
		public void descParam(HookParam param) {
			Logger.log_behavior("Audio Recording ->");
		}
	});
	
}
 
Example #29
Source File: NotificationManagerHook.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public void startHook() {
	// TODO Auto-generated method stub
	Method notifyMethod = RefInvoke.findMethodExact("android.app.NotificationManager", ClassLoader.getSystemClassLoader(), "notify",int.class,Notification.class);
	hookhelper.hookMethod(notifyMethod, new AbstractBahaviorHookCallBack() {
		@Override
		public void descParam(HookParam param) {
			// TODO Auto-generated method stub
			Notification notification = (Notification) param.args[1];
			Logger.log_behavior("Send Notification ->"); 
			Logger.log_behavior(notification.toString()); 
		}
	});
}
 
Example #30
Source File: NotificationManagerHook.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public void startHook() {
	Method notifyMethod = RefInvoke.findMethodExact("android.app.NotificationManager", ClassLoader.getSystemClassLoader(), "notify",int.class,Notification.class);
	hookhelper.hookMethod(notifyMethod, new AbstractBahaviorHookCallBack() {
		@Override
		public void descParam(HookParam param) {
			Notification notification = (Notification) param.args[1];
			Logger.log_behavior("Send Notification ->"); 
			Logger.log_behavior(notification.toString()); 
		}
	});
}