import frida, time, subprocess, sys
ADB="/opt/android-sdk/platform-tools/adb"
JS=r"""
function ins(){var m=Process.findModuleByName("libil2cpp.so");if(!m)return false;var b=m.base;
 function T(f){try{f();}catch(e){send({warn:""+e});}}
 T(function(){Interceptor.attach(b.add(0x244e42),{onLeave:function(rv){rv.replace(ptr(2));}});}); // playButtonMode->2
 T(function(){Interceptor.attach(b.add(0x1c3d2f),{onLeave:function(rv){send({info:"IsGateCleared -> "+rv.toInt32()});}});});
 T(function(){Interceptor.attach(b.add(0xfc9bb9),{onEnter:function(a){send({info:"RequestChangeFeState arg="+a[1]});}});});
 [[0xea27d3,"OnSelectSniperMode"],[0xd31a4f,"Matchmaking.Initiate"],[0xd86224,"CreateMatch.MoveNext"],[0xd34da2,"CreateBotMatch"],[0x1003e66,"CreateRoom"],[0xe9ea40,"SignalUnlocksToTutorial"]].forEach(function(x){T(function(){Interceptor.attach(b.add(x[0]),{onEnter:function(){send({info:"CHAIN "+x[1]});}});});});
 T(function(){var ab=Process.findModuleByName("libc.so").findExportByName("abort");Interceptor.attach(ab,{onEnter:function(){send({info:"*** ABORT"});}});});
 send({info:"__ready"});return true;}
if(!ins()){var iv=setInterval(function(){if(ins())clearInterval(iv);},120);}
"""
dev=frida.get_usb_device(timeout=10)
pid=int(subprocess.run([ADB,"shell","pidof","se.foglo.svt"],capture_output=True,text=True).stdout.split()[0])
s=dev.attach(pid); sc=s.create_script(JS); t0=time.time()
sc.on("message",lambda m,d: print("[%5.1f] %s"%(time.time()-t0,m.get("payload",m)),flush=True))
sc.load(); time.sleep(1.5)
print("=== tap SNIPER ===",flush=True)
subprocess.run([ADB,"shell","input","tap","690","730"]); time.sleep(20)
