Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //check OS libs loaded and print the addres of load libs
- console.log("[*] Starting script to track loaded .so files...");
- function hookDlopen(funcName) {
- const addr = Module.findExportByName(null, funcName);
- if (!addr) {
- console.log("[!] " + funcName + " not found, skipping hook");
- return;
- }
- Interceptor.attach(addr, {
- onEnter: function (args) {
- if (!args[0].isNull()) {
- this.libName = Memory.readUtf8String(args[0]);
- } else {
- this.libName = null;
- }
- },
- onLeave: function (retval) {
- // Check if it ends with ".so"
- if (this.libName && this.libName.endsWith(".so")) {
- // Attempt to find the library's base address
- let baseAddr = Module.findBaseAddress(this.libName);
- if (baseAddr !== null) {
- console.log("[*] " + funcName + " called with: " + this.libName +
- "\nBase address: " + baseAddr);
- } else {
- console.log("[*] " + funcName + " called with: " + this.libName +
- "\nBase address not found (may need to parse the path).");
- }
- }
- }
- });
- }
- // Hook both dlopen and android_dlopen_ext
- hookDlopen("dlopen");
- hookDlopen("android_dlopen_ext");
- console.log("[*] Script loaded, waiting for dlopen calls...");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement