jadx
jadx copied to clipboard
[feature] Allow renaming into a different package
It's possible to rename classes in JADX, but you can't alter the package they're in. While you can rename already present packages, it's not possible to move individual classes into different (possibly made-up) packages.
I suggest doing it like Enigma: Renaming an imaginary test.class
to my/package/test.class
creates the following package structure:
├──my/
│ ├── package/
│ │ ├── test.class
This is useful if you want to restore heavily obfuscated apps' original structure, or just organize the classes for easier deobfuscation. The YouTube app for example contains almost 30'000 classes, and save for a few hundred they're all top-level without a package.
Sure, this issue similar to #1253 and I am already working on package renaming refactor in jadx-script
branch.
Perfect :) I don't know how you plan to implement it, but I'd suggest using Enigma's way of allowing the user to just add slashes into the rename window and resolve each slash-succeeded part as a package. Maybe also provide a GUI option, but please handle it internally by using slashes or points inside the classes' alias
name. That should make it instantly compatible with the already present mapping import/export code
Sure, this issue similar to #1253 and I am already working on package renaming refactor in
jadx-script
branch.
Have you finished it?
@dvdface this feature still not merged (now in jadx-next
branch). But it will be very helpful if you check it and report any issues.
This feature now in master, so it is possible to enter new full class name to move class into new package. Although, there is known issue with missing package tree updates, as workaround you can use project reload (toolbar button of F5).
I agree that this is needed for practical work. I too frequently observe the existence of a "catch-all" package when decompiling, which holds for multiple different apps. Most importantly the package usually includes Kotlin Intrinsics, which is often a useful source of meta data.
Since jadx
's currently does not allow restructuring:
a. it can get quite messy :: minor impact
b. the Kotlin meta data renaming feature fails to kick in BUT no way to manually enable it again :: potentially huge impact
Regarding b), if this is merged just by renaming Intrinsics classes to their respective locations accordingly a potentially lot of variables can be automatically renamed. I use potentially as we know the Kotlin meta data might be disabled or obfuscated too.
@ed9w2in6 I still not sure what exactly you need, but I made some small improvements:
- add hint to rename dialog, so now it should be clear that using full class name it is possible to move the class to another package (new or existing).
- search Kotlin Intrinsics class also by alias (i.e. renamed by user). This allows to rename class to
kotlin.jvm.internal.Intrinsics
and jadx will use it for renames.
In short: if jadx can't find Kotlin Intrinsics class, you can search it manually and rename it to kotlin.jvm.internal.Intrinsics
and jadx will use it to rename variables.
@ed9w2in6 I hope this is what you are asking for, so please check latest unstable build.
If this still not what you expect, please share your APK file and describe steps to reproduce your issue. :slightly_smiling_face:
@skylot Yes this is exactly what I have in mind.
I did not know that it doesn't propagate through alias currently.
I did not expect you to implement this immediately.
Thanks a lot @skylot.
Thank you so much for your time spend on implementing this.