Skip to content

Instantly share code, notes, and snippets.

@H4niz
Created June 17, 2019 10:15
Show Gist options
  • Save H4niz/8e6d378c699f279eb106aa60d48f1bc1 to your computer and use it in GitHub Desktop.
Save H4niz/8e6d378c699f279eb106aa60d48f1bc1 to your computer and use it in GitHub Desktop.
#python code
import frida
import time
#========= INIT ============
_PACKAGE_ = "com.product.name"
_HOOKINGSCRIPT_ = "hooking_script.js"
def on_message(message, data):
print("[%s] => %s" % (message, data))
while(True):
try:
print("==== Initialing ====")
device = frida.get_usb_device()
print("[+] Device: {}".format(device))
try:
pid = device.spawn(["com.vietinbank.softotp"])
except Exception as ex:
print ex
print("[+] PID: {}".format(pid))
device.resume(pid)
time.sleep(1) #Without it Java.perform silently fails
session = device.attach(pid)
print("[+] Attaching session")
# session = frida.get_usb_device().attach(_PACKAGE_)
print("[+] Loading hooking script")
script = session.create_script(open(_HOOKINGSCRIPT_).read())
script.on('message', on_message)
script.load()
print("[*] Initialing successful\n")
break
except Exception as e:
print("[-] Error: {}".format(e))
raw_input("Try again?")
pass
#prevent the python script from terminating
raw_input("[Frida-Hooking]\nContinue?[Enter]\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment