skylot / jadx

Dex to Java decompiler
Apache License 2.0
41.78k stars 4.89k forks source link

[feature] Add GPT engine #1884

Closed MartinKayJr closed 1 week ago

MartinKayJr commented 1 year ago

Describe your idea: During my 4-day, about 28-hour test, I manually copied the code into chatgpt, and passed this passage

I need you to be able to handle longer messages.

Let the variable names and method names of the following code change as the name implies, the original meaning of the code cannot be changed, the order cannot be changed, and the unprocessed ones remain as they are, the number of lines of the code cannot be optimized, the code cannot be omitted, the code cannot be deleted or added, and the naming conflict cannot be allowed . The original name should be written above them in the form of a comment, keep the comment. Line comments must be added to Each line of code to explain the meaning of the code, and comments between multiple lines of code also need to be marked.

Let chatgpt restore the semantic analysis of the code. There is no doubt that chatgpt is easy to handler obfuscated code, ollvm, and spend instructions.

This directly defeats all security tools that lower the barrier to analysis.

Originally, it took me 30 days to analyze thousands of classes and 100,000 lines of code. I completed it in 4 days (28 hours) with manual chatgpt.

So I want to connect the gpt engine to jadx, complete the selection of the specified class, analyze the specified class or package, introduce a new code display window to generate for the gpt engine, and use it as a major update in the new era of jadx.

Application scenarios: remove ollvm, remove instructions, automatically rename after semantic analysis, automatically generate comments, etc.

skylot commented 1 year ago

Sounds like a fun idea :slightly_smiling_face: @MartinKayJr sure, you can create an external jadx plugin. I added plugins support just recently, so it very limited right now, but it is possible to add menu item and implement all logic in additional window. You can use https://github.com/jadx-decompiler/jadx-example-plugin project as a template. If you have any question, feel free to ask.

MartinKayJr commented 1 year ago

I'll follow up on it

dvdface commented 1 year ago

Sounds like a fun idea 🙂 @MartinKayJr sure, you can create an external jadx plugin. I added plugins support just recently, so it very limited right now, but it is possible to add menu item and implement all logic in additional window. You can use https://github.com/jadx-decompiler/jadx-example-plugin project as a template. If you have any question, feel free to ask.

It's very important to add ChatGpt as plugin to auto comment decompliled java code.

It's so powerful that it can save too much times for us.

to add this feature , please support customizing openai api url

for example, this is auto-commented code by chatgpt:

` /**

`

iiasceri commented 1 year ago

Owner of project doesn't want to do it right now, he politely suggested that you should add that plugin. GPT-4 is paid, GPT-3 is not as powerful. Conclusion: There is a chance to use reverse engineered bing chat api into jadx or as android studio plugin in combination with smalidea, apktool d .apk, jdbc forward for breakpoints.

dvdface commented 5 months ago

Owner of project doesn't want to do it right now, he politely suggested that you should add that plugin. GPT-4 is paid, GPT-3 is not as powerful. Conclusion: There is a chance to use reverse engineered bing chat api into jadx or as android studio plugin in combination with smalidea, apktool d .apk, jdbc forward for breakpoints.

Okay, when I am free, I'll do it by myself. Thank you for reminding

alessandroamella commented 4 months ago

This would be very helpful, glad if someone can implement it!

mikrodotnet commented 4 months ago

Owner of project doesn't want to do it right now, he politely suggested that you should add that plugin. GPT-4 is paid, GPT-3 is not as powerful. Conclusion: There is a chance to use reverse engineered bing chat api into jadx or as android studio plugin in combination with smalidea, apktool d .apk, jdbc forward for breakpoints.

Okay, when I am free, I'll do it by myself. Thank you for reminding

A GPT plugin would be very helpful. If you, or anyone, could work on a GPT plugin, take a look at gpt4free

Devilx86 commented 1 week ago

Hello, I recently built a plugin called jadx-ai-view-plugin that provides AI analysis of a class/method in a seperate view. It may be what you are all looking for, it also supports gpt4free as suggested above. Thanks @MartinKayJr for the prompt and thanks @skylot for the help.

skylot commented 1 week ago

@Devilx86 nice, thanks :+1: Also, recently @samanL33T add jadx-xvision-plugin into jadx-plugins-list, it also support LLM integrations into jadx.

I think two plugins is enough, so I will close this issue :slightly_smiling_face:

samanL33T commented 1 week ago

@Devilx86 This is awesome.