-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Change deobf whitelist behavior #2177
base: master
Are you sure you want to change the base?
Conversation
Hi @bagipro , I proposed this whitelist because deobfuscating "v4" to "p000v4" when it is part of a package name "android.support.v4.*" is in nearly every case a false positive. Before adding this whitelist these false positives could even be found when you tried to deofuscate an non-obfuscated app. Do you have any example where this whitelist introduces new false positives? If so, I think the better way is to detect and prevent the false positives. |
Hey @nitram84, Ahh yes. I've always used jadx with
My idea was to make this feature consistent, i.e. it should consider class content, not just class and package names. I think the best way to cover all cases would be to change |
Hi @bagipro, I understand. You are right, with But I'm not sure if Also the whitelist is currently not the only feature that relies only on class and package names without considering the class content. We have already
With If it is possible I would like to keep the whitelist for |
Hey!
It should be 26 * 26 (2 characters) or 35 * 35 (2 characters when including numbers). Additionally, jadx avoids duplicated class/package names (it's applicable for obfuscated apps) and name collisions for case-insensitive file systems, so it shouldn't be a problem.
But do you think it would be a problem when the default value is 2? I mean that if someone changes it to higher numbers, let's say 4, many more classes than the default whitelist will be affected. Thanks! |
I also think that changing @bagipro I think I can slightly improve performance of your check for subpackages (match over stream). I will apply these changes with undo of default values changes. |
@skylot But a bug might happen if we keep the default whitelist, keep What do you think about this? That's why my idea was to use 2 of these workarounds. |
Well, deobfuscation isn't supposed to fix compilation errors, we have other checks for that. Ideally, jadx should output correct code even with disabled deobfuscation 🙂 |
I applied my changes: exclude list calculated in init method using internal packages tree, so implementation is very simple now. This is also forced me to fix init order of rename providers, because previously package info was not yet set. @bagipro, @nitram84 please check my changes, I still not sure about default packages for exclude, so suggestions are appreciated. |
Hi @skylot, thank you for your work. I tested the PR with a apk having obfuscated classes in a package on the whitelist: https://apkpure.com/database-modeler-lite/adrian.adbm/download/2.2 My initial idea of #2040 was a whitelist to exclude specific classes and package names (keep the package name for all classes inside the package) from deobfuscation. So I tried to keep the whitelist as restrictive as possible. This is list I am using currently:
The entry I don't think the list is complete. I think a lot of third party package are missing, but I haven't them yet because I'm replacing sources of other libs directly with the gradle dependency when I recompile apps 🙂 My intention was to use deobfuscation as an always-enabled feature (even for non-obfuscated or unknown apps) without having any drawbacks. |
I think it is not possible to create a list which will work for all apps, because app classes can be moved to any package. @nitram84 I understand that you want to pinpoint only some packages like v4, os, etc, but recursive approach suggested by @bagipro in this PR is made this task harder. Also, such strict rules depend on deobf-min length option, so it is very specific and can be not helpful if user change this option. Some possible improvements:
Anyway, deobfuscation rules/patterns is a very debatable topic and to allow customization I added scripting support to jadx, so anyone can adjust deobfuscation with scripts now 🤣 |
07d2e39
to
c4c3d42
Compare
This PR changes the behavior of the
--deobf-whitelist
arg:androidx.*
orandroid.support.*
libraries undeobfuscated. If it is a non-obfuscated application, it will not be changed anyway. However, if some crazy obfuscation is applied, it might get moved to weird packages likep000
. So I removed the defaults