-
Notifications
You must be signed in to change notification settings - Fork 100
Home
zhouat edited this page Feb 14, 2017
·
9 revisions
XposedHelpers.findAndHookMethod("org.apache.http.impl.client.AbstractHttpClient", loadPackageParam.classLoader, "execute", HttpUriRequest.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (!param.args[0].getClass().getCanonicalName().contains("HttpPost")) {
return;
}
HttpPost request = (HttpPost) param.args[0];
String url = request.getURI().toString();
}
}
final int apiLevel = Build.VERSION.SDK_INT;
/* 自 Android 4.4 后改用 okhttp 实现,在 6.0 后包名有改动 */
if (apiLevel >= 23) {
XposedHelpers.findAndHookMethod("com.android.okhttp.internal.huc.HttpURLConnectionImpl", loadPackageParam.classLoader, "getInputStream", URLGetInputStreamHook);
} else if (apiLevel >= 19) {
XposedHelpers.findAndHookMethod("com.android.okhttp.internal.http.HttpURLConnectionImpl", loadPackageParam.classLoader, "getInputStream", URLGetInputStreamHook);
} else {
XposedHelpers.findAndHookMethod("libcore.net.http.HttpURLConnectionImpl", loadPackageParam.classLoader, "getInputStream", URLGetInputStreamHook);
}
XposedHelpers.findAndHookConstructor("java.net.URL", loadPackageParam.classLoader, String.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
String url = (String) param.args[0];
log("URL construct " + url);
/* 还可以通过修改参数或结果,改变应用逻辑 */
param.args[0] = "http://www.baidu.com/";
log("Change URL to " + param.args[0]);
}
});
XposedBridge.hookAllConstructors(IOException.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log((Throwable) param.thisObject);
}
});
frameworks/base/services/java/com/android/server/wm/WindowManagerService.java#startViewServer com.android.server.wm.WindowManagerService#isSystemSecure ,false com.android.server.wm.WindowManagerService#checkCallingPermission ,true
android.webkit.WebView#loadUrl
Object thisObj = param.thisObject;
String UserAgentString = null;
if (thisObj instanceof WebView) {
UserAgentString = ((WebView) thisObj).getSettings().getUserAgentString();
}
android.app.Instrumentation#execStartActivity
##EditText android.widget.EditText#getText
org.apache.http.conn.ssl.AbstractVerifier#verify
com.android.webview.chromium.CookieManagerAdapter#getCookie
Got hook: http://gslab.qq.com/article-32-1.html
android.content.pm.PackageParser#collectCertificates
Ref: https://github.com/rovo89/XposedBridge/wiki/Development-tutorial