Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken Script Output for Non Ascii/Non Printable Named Method #1

Open
apkunpacker opened this issue Mar 17, 2022 · 4 comments
Open

Comments

@apkunpacker
Copy link

Small Sample Apk With Non Printable Method Name :

newtest_1.0_flows.apk.zip

jeb4frida

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......

@Hamz-a
Copy link
Owner

Hamz-a commented Mar 17, 2022

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...

@Hamz-a
Copy link
Owner

Hamz-a commented Mar 17, 2022

094830d
Fixes the "JEB error", but would be better to encode "weird" characters for cleaner Frida scripts.

@kinetikFR
Copy link

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

@kinetikFR
Copy link

about jadX generates a simple variable reading
example

.method static constructor ()V
.registers 1
00000000 const/16 v0, 18
00000004 new-array v0, v0, [I
00000008 fill-array-data v0, :14
0000000E sput-object v0, A->AMLDZHTU:[I
00000012 return-void

JadX output :
let A = Java.use("o.A");
AMLDZHTU = A.AMLDZHTU.value;

@github-staff github-staff deleted a comment from ZekDtonik May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants