jeb4frida
jeb4frida copied to clipboard
Broken Script Output for Non Ascii/Non Printable Named Method
Small Sample Apk With Non Printable Method Name :

Exact Error -
🔥 Jeb4frida...
IJavaSourceUnit / IDexUnit detected
🔥 Here's a fresh Frida hook...
----------------------------------------------------------------------------------------------------
// Usage: frida -U -f com.example.myapplication -l hook.js --no-pause
[E] Script execution error: com.pnfsoftware.jeb.client.script.ScriptExecutionException: Traceback (most recent call last):
[E] File "E:\JEB4.12\scripts\samples\Jeb4frida.py", line 39, in run
[E] self.handle_java_dex(ctx, dexdec)
[E] File "E:\JEB4.12\scripts\samples\Jeb4frida.py", line 73, in handle_java_dex
[E] print(self.gen_java_hook(java_class, java_methods))
[E] File "E:\JEB4.12\scripts\samples\Jeb4frida.py", line 79, in gen_java_hook
[E] frida_hook = " var {} = Java.use('{}');\n".format(class_name_var, class_name)
[E] UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: ordinal not in range(128)
[E]
Possible Fix - Put method name in " " like ClassName["MethodName"].overload......
I forgot the u prefix on a bunch of strings. So now it is trying to format these ASCII strings with Unicode characters, hence it fails. Adding u fixes the issue but makes the Frida script still look funky...
https://github.com/Hamz-a/jeb4frida/commit/094830df8c129582baf80cd5af8129b7ebd6b371 Fixes the "JEB error", but would be better to encode "weird" characters for cleaner Frida scripts.
Jeb4frida.zip [+] add Auto copy frida functio to clipBoard [+] removed gen_how_to function (the frida hook was not generated because it didn't have IApkUnit and getMainProject) i working with lots of dump.dex that not have project and its function interfered
Thank you very much for the project, it helps a lot :D
about
.method static constructor
JadX output : let A = Java.use("o.A"); AMLDZHTU = A.AMLDZHTU.value;