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

[feature] Edit smali in Jadx-GUI and see live Java #1537

Open
ubergeek77 opened this issue Jun 15, 2022 · 11 comments
Open

[feature] Edit smali in Jadx-GUI and see live Java #1537

ubergeek77 opened this issue Jun 15, 2022 · 11 comments
Labels
discussion GUI Issues in jadx-gui module new feature

Comments

@ubergeek77
Copy link

I would like to be able to edit smali code in Jadx by hand, and see the new interpreted Java code as a result of my changes in real-time, provided I have not introduced any errors to the smali code.

Jadx, in both GUI and CLI mode, is already capable of converting a completely standalone smali file into human-readable Java code. It doesn't need other smali files in other classes, and it doesn't need any data from the .dex. It is completely self-sufficient when converting smali to Java, even when the smali has external imports.

However, despite Jadx having this capability internally, the smali editor in Jadx-GUI remains read-only. Currently, if I wanted to see "live" Java changes when editing a smali file, I would have to edit it in some other text editor, close the file in Jadx, then re-open it again. This is very cumbersome, especially considering Jadx is already fully capable of displaying isolated smali files as Java.

Since Jadx is already "able" to do this kind of conversion, just wthout the editing part, I am wondering if I just missed something obvious. Is this already a feature? There doesn't seem to be a way to "enable editing mode." I have searched the GitHub issues, the wiki, and every part of the GUI.

If it's not a feature, I would like to request it. This would save me a ton of time, as I would no longer need to close and reopen the file in Jadx just for it to re-compute the interpreted Java.

@skylot
Copy link
Owner

skylot commented Jun 16, 2022

Well, implementing a good smali editor is a big task, and I am not sure if I will do this. Also, there are a lot of other editors with smali support (check APKLab for VS Code).

Anyway, to help you to reduce time for close/open project, I can add reload button and hotkey. Also, it is not hard to implement live reload to watch updates of input files.

@skylot skylot added GUI Issues in jadx-gui module discussion labels Jun 16, 2022
@ubergeek77
Copy link
Author

That would be a great workaround! However, I'm a little confused about this:

Well, implementing a good smali editor is a big task,

What do you mean by a "good" editor? Personally, I don't need context suggestions, error checking, or anything. I'm doing it by hand, so I'm mainly just looking for a plaintext editor for the smali. I just don't want to have to leave Jadx to make those modifications.

@skylot
Copy link
Owner

skylot commented Jun 16, 2022

What do you mean by a "good" editor?

I mean right after I add a plaintext editor for the smali, there are will be tons of issues forcing me to add more features 🤣
Also, it requires merging "viewing decompiled code" and "edit smali files" features, it may need a lot of UI changes, so it is a big task.

@ubergeek77
Copy link
Author

Ah, gotcha. Well, one day I'd love to be able to edit the smali even if they don't necessarily exist on the filesystem (i.e. if Jadx opens an .apk file), but I realize even that is a huge ask.

But, everything in good time! For now, a reload feature would be fantastic.

Thank you for your consideration!

@skylot
Copy link
Owner

skylot commented Jun 18, 2022

@ubergeek77 I have added reload and live reload actions, please check latest unstable build.

@ubergeek77
Copy link
Author

Thank you very much for adding this so quickly!

Both manual and live reload seem to be working great. After enabling live reload, it seems like I needed to manually reload once in order for live reload to "kick in," but otherwise it works great.

@zhongqingsong
Copy link
Contributor

Aha, i know the reload file history. (¬‿¬)

@typeofi
Copy link

typeofi commented Jun 22, 2022

Ha ha, I really hope you can modify it in the SmalI editor you mentioned, and then ask whether to save the changes, because you can go from DEX to SmalI, and then SmalI to DEX. In fact, there is an app on the mobile phone that basically has this function, but I hope it will appear on the PC, especially on jadx. I think this feature requires a lot of performance and time consumption in use, but it is really interesting.

@ManojBhakarPCM
Copy link

i am currently working on this.. my initial effort is AMODStudio3 (here on github).

although i am yet not implemented the following feature but i have successfully tested it , and it can be implemented in Jadx GUI with just a little effort-

RSyntexTextArea + TokenMakerMaker = Smali Editor with code highlighting (already implemented in AModStudio3)
for Quick code Editing without decompiling whole apk ...(just dex files. without touching resources.arsc and res folder)
save smali with changes -> create dex form that single smali (using org.jf.dexlib2) -> merge to classes.dex (using dx.jar library) and its done.
i have already tested this process and found it very quick, (just takes less than 1 second)..
rest of work is to --
replace classes.dex to apk file.. (which is basically a zip file)... this process will be very quick too.
then zipAlign (super quick)
then sign (quick)
and you are done.
if anyone interested then in my project (AModStudio3) you can look at following files -
DexEditor.java => for above mentioned quick dex editing procedure and helper functions with JTreeModel
Thread_compileAndInstall.java => for zipAlign and signing
Editor.java => for Smali Syntax Highligtign and Editing...

you should also look at that project itself.. its name is AModStudio3

@solomom399
Copy link

Please, why is Jadx-gui not loading the edited code...I've been battling with it for a long time.
Help me

@EarzuChan
Copy link

就是啊,作者做一个一个Smali编辑功能吧,请!我现在的工作流甚至是使用安卓子系统打开MT管理器,然后把Jar转换为Dex进行编辑,然后再转换回来。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion GUI Issues in jadx-gui module new feature
Projects
None yet
Development

No branches or pull requests

7 participants