import json,sys,time,frida,subprocess
A=json.load(open("/root/ants/x86addrs.json"))
pid=int(subprocess.run(["/opt/android-sdk/platform-tools/adb","shell","pidof","se.foglo.svt"],capture_output=True,text=True).stdout.split()[0])
dev=frida.get_device_manager().add_remote_device("127.0.0.1:27042")
JS="""
var A=%s;
var m=Process.findModuleByName("libil2cpp.so");var b=m.base;
for(var n in A){(function(n,r){try{Interceptor.attach(b.add(r),{onEnter:function(){send({n:n});}});}catch(e){send({n:"ERR "+n});}})(n,A[n]);}
send({n:"__ready"});
""" % json.dumps(A)
s=dev.attach(pid); sc=s.create_script(JS); t0=time.time()
def om(m,d):
    if m["type"]=="send": print("[%6.2fs] %s"%(time.time()-t0,m["payload"]["n"]),flush=True)
sc.on("message",om); sc.load()
time.sleep(int(sys.argv[1]) if len(sys.argv)>1 else 20)
