-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathget_app_env_info.js
More file actions
45 lines (40 loc) · 1.66 KB
/
get_app_env_info.js
File metadata and controls
45 lines (40 loc) · 1.66 KB
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
/**
* Get Env App Info for the target app
*
* @returns {void}
*/
import Java from "frida-java-bridge";
rpc.exports = {
run: function () {
Java.perform(function () {
var context = null;
var ActivityThread = Java.use("android.app.ActivityThread");
var targetApp = ActivityThread.currentApplication();
if (targetApp != null) {
context = targetApp.getApplicationContext();
var env = {
mainDirectory: context.getFilesDir().getParent(),
filesDirectory: context.getFilesDir().getAbsolutePath().toString(),
cacheDirectory: context.getCacheDir().getAbsolutePath().toString(),
externalCacheDirectory: context.getExternalCacheDir().getAbsolutePath().toString(),
codeCacheDirectory:
"getCodeCacheDir" in context ? context.getCodeCacheDir().getAbsolutePath().toString() : "N/A",
obbDir: context.getObbDir().getAbsolutePath().toString(),
packageCodePath: context.getPackageCodePath().toString(),
};
send("******************* App Environment Info *******************");
send("mainDirectory: " + env.mainDirectory);
send("filesDirectory: " + env.filesDirectory);
send("cacheDirectory: " + env.cacheDirectory);
send("externalCacheDirectory: " + env.externalCacheDirectory);
send("codeCacheDirectory: " + env.codeCacheDirectory);
send("obbDir: " + env.obbDir);
send("packageCodePath: " + env.packageCodePath);
send("************************************************************");
} else send("Error: App Environment Info - N/A");
});
},
schema: function () {
return null;
},
};