import frida, sys def on_message(message, data): if message['type'] == 'send': print("[*] {0}".format(message['payload'])) else: print(message) PACKAGE_NAME = "sg.vantagepoint.uncrackable2" jscode= """ Java.perform(function() { console.log("[*] Hooking calls to System.exit"); exitClass = Java.use("java.lang.System"); exitClass.exit.implementation = function() { console.log("[*] System.exit called"); } var strncmp = undefined; func = Module.enumerateImportsSync("libfoo.so"); for(i = 0; i < func.length; i++) { if(func[i].name == "strncmp") { strncmp = func[i].address; break; } } Interceptor.attach(strncmp, { onEnter: function (args) { if(args[2].toInt32() == 23 && Memory.readUtf8String(args[0],23) == "01234567890123456789012") { console.log("[*] Secret string at " + args[1] + ": " + Memory.readUtf8String(args[1],23)); } }, }); console.log("[*] Intercepting strncmp"); }); """ try: device = frida.get_usb_device(timeout=10) pid = device.spawn([PACKAGE_NAME]) process = device.attach(pid) device.resume(pid) script = process.create_script(jscode) script.on('message',on_message) print('[*] Running Hook') script.load() sys.stdin.read() except Exception as e: print(e)