import sys,time,frida,subprocess,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")
NAMES={52:'EventInfo',55:'CompleteAction',56:'SplashVisible',57:'SplashHide',58:'ShowMainPopup',71:'ShowTOU',72:'StartWaitTitles'}
JS="""
var m=Process.findModuleByName("libil2cpp.so");var b=m.base;
Interceptor.attach(b.add(16439598),{onEnter:function(a){send({e:a[1].toInt32()});}});
"""
s=dev.attach(pid);sc=s.create_script(JS);t0=time.time()
def om(m,d):
    if m["type"]=="send":
        e=m["payload"]["e"];print("[%6.2fs] OnEvent %d (%s)"%(time.time()-t0,e,NAMES.get(e,'?')),flush=True)
sc.on("message",om);sc.load();time.sleep(12)
