import frida import time # Connect via TCP through adb forward device = frida.get_device_manager().add_remote_device("127.0.0.1:27042") print(f"Connected via TCP: {device.name}") # Get PID by enumerating processes (or hardcode) try: processes = device.enumerate_processes() wechat_pid = None for p in processes: if p.name == "com.tencent.mm": wechat_pid = p.pid print(f"Found WeChat PID: {wechat_pid}") break if not wechat_pid: print("WeChat not found, using hardcoded PID 15059") wechat_pid = 27337 except Exception as e: print(f"enumerate_processes failed: {e}") wechat_pid = 27337 print(f"Attaching to PID {wechat_pid}...") session = device.attach(wechat_pid) print("Attached!") script = session.create_script(""" console.log("Java.available = " + (typeof Java !== 'undefined' ? Java.available : 'undefined')); if (typeof Java !== 'undefined' && Java.available) { Java.perform(function() { console.log("Java.perform OK"); try { var r1 = Java.use("u01.r1"); console.log("u01.r1 loaded"); var builder = r1.a("yibooo"); var clsName = builder.getClass().getName(); console.log("BUILDER_CLASS:" + clsName); } catch(e) { console.log("Error: " + e); } }); } else { console.log("Java not available"); } """) def on_message(message, data): print(f"[MSG] {message}") script.on("message", on_message) script.load() print("Script loaded") time.sleep(5) print("Done")