Browse Source

Merge remote-tracking branch 'origin/master'

Imy 1 year ago
parent
commit
94feb06800
1 changed files with 28 additions and 10 deletions
  1. 28 10
      agent/hooklinker.js

+ 28 - 10
agent/hooklinker.js

@@ -3,22 +3,40 @@ import {HookImpl} from "./HookImpl";
 
 export let hooklinker = {
 
-    start:function (){
+
+    start: function () {
         // linker64 arm64
-        if (Process.pointerSize===8){
+        if (Process.pointerSize === 8) {
             let module = Process.findModuleByName("linker64");
-            Interceptor.attach(module.base.add(0xb5b48),{
-                onEnter:function (args){
-                    var path= args[3].readCString();
-                    console.log("path "+path);
-                    if (path.includes("libil2cpp.so")){
-                      HookImpl.start();
+            Interceptor.attach(module.base.add(0xb5b48), {
+                onEnter: function (args) {
+                    var path = args[3].readCString();
+                    console.log("path " + path);
+                    if (path.includes("libil2cpp.so")) {
+                        HookImpl.start();
                     }
                 }
             })
-        }else {
+        } else {
             //linker
         }
-
+    },
+    startByOpen: function () {
+        let open = Module.findExportByName(null, "open");
+        if (open != null) {
+            Interceptor.attach(open, {
+                onEnter: function (args) {
+                    let path = args[0].readCString();
+                    if (path.includes("libil2cpp.so")) {
+                        this.hook = true;
+                    }
+                },
+                onLeave: function (ret) {
+                    if (this.hook) {
+                        HookImpl.start();
+                    }
+                }
+            })
+        }
     }
 }