-
Notifications
You must be signed in to change notification settings - Fork 36
/
android-stetho-loader.js
50 lines (45 loc) · 1.77 KB
/
android-stetho-loader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
Description: Android Stetho Loader
Usage: frida -U -f XXX -l android-stetho-loader.js
Credit: @mobilesecurity_
Info: How to use Stetho?
1. Download Stetho - http://facebook.github.io/stetho/
2. Rename to stetho.jar
3. Download dextojar https://sourceforge.net/projects/dex2jar/
4. Convert the jar file to dex - d2j-jar2dex.sh stetho.jar
5. Push the dex file in /data/local/tmp/
adb push stetho-jar2dex.dex /data/local/tmp/stetho.jar
6. Open chrome at this address - chrome://inspect/#devices
7. Inspect your app!
*/
Java.perform(function ()
{
const stethoJarFilePath = "/data/local/tmp/stetho.jar"
const stethoClassName = "com.facebook.stetho.Stetho";
const pathClassLoader = Java.use("dalvik.system.PathClassLoader");
const javaFile = Java.use("java.io.File");
const activityThread = Java.use("android.app.ActivityThread");
const app = activityThread.currentApplication();
const context = app.getApplicationContext();
const stethoJarFile = javaFile.$new(stethoJarFilePath);
const loader = pathClassLoader.$new(stethoJarFile.getAbsolutePath(), null, app.getClassLoader());
try
{
loader.loadClass(stethoClassName);
var classLoaders = Java.enumerateClassLoadersSync();
classLoaders=classLoaders.filter(function (cl)
{
return cl.toString().includes("stetho");
});
Java.classFactory.loader = classLoaders[0];
const stetho = Java.use(stethoClassName);
stetho.initializeWithDefaults(context);
send("Stetho successfully loaded!");
send("Open Chrome at chrome://inspect/#devices")
}
catch (err)
{
send("Stetho NOT loaded!");
send(err.toString());
}
});