jadx icon indicating copy to clipboard operation
jadx copied to clipboard

[feature]JADX adds fernflower engine

Open MartinKayJr opened this issue 1 year ago • 12 comments

Describe your idea: When JADX is dealing with some complex codes, it is easy to have problems such as Removed duplicated region for block:. The current method is Code decompiled incorrectly, please refer to instructions dump. In some of my tests, fernflower will handle it perfectly. The fernflower engine is added to jadx, which can enhance the correct restoration of complex code

MartinKayJr avatar May 26 '23 07:05 MartinKayJr

The main problem in your idea is that Fernflower works on Java classes (-> Java byte code), but Jadx usually works on DEX byte code, which I don't think can be handled by Fernflower.

jpstotz avatar May 26 '23 07:05 jpstotz

No, I have tested it, you can use MT manager, https://mt2.cn/, in the decompilation of dex, decompile it into java source code, and switch multiple different engines in the upper right corner, among which There is fernflower, which is a feature with lessons learned from the past, but it can only operate on a single class. I believe that it can directly complete the results of fernflower and even more engines for all classes

MartinKayJr avatar May 26 '23 07:05 MartinKayJr

Decompiling MT manager app APK I wasn't able to find any fernflower classes (org.jetbrains.java.decompiler) nor any mention of "Fernflower" or "jetbrains" in the APK that would indicate that it uses Fernflower for decompilation. Also there are no clues of the other decompilers mentioned, but it is for sure they do not all support dex code.

Therefore it is not detectable if and how they use the Java decompilers. Most likely use a workaround like dex2jar or a different dex-2-class decompiler. If that is the case you could simply execute dex2jar on the APK and use jd-gui application to view the whole source code instead of Jadx-GUI.

jpstotz avatar May 26 '23 07:05 jpstotz

I will ask the author of the MT manager to ask the principle of this

MartinKayJr avatar May 26 '23 08:05 MartinKayJr

@jpstotz These are server-side features and you have to pay to use them. That's why they are not in the app.

timscriptov avatar May 26 '23 08:05 timscriptov

Screenshot_20230526-132348_MT Manager.png

timscriptov avatar May 26 '23 08:05 timscriptov

The author of mt manager told me that to use dex2jar

MartinKayJr avatar May 26 '23 14:05 MartinKayJr

Dex2jar original deprecated and not support new dex version. Dex2jar support only dex35

timscriptov avatar May 26 '23 15:05 timscriptov

@MartinKayJr do you really need this? I thought there are a lot of tools which combine several decompilers like:

  • https://github.com/Konloch/bytecode-viewer (desktop)
  • https://github.com/niranjan94/show-java (android)

Anyway, this can be done in external jadx plugin. And this shouldn't be very hard.

Dex2jar original deprecated and not support new dex version. Dex2jar support only dex35

Is there are any similar tools? I know only about enjarify which is also deprecated.

skylot avatar May 26 '23 16:05 skylot

image image

In this code, neither Jadx nor Fernflower is enough

MartinKayJr avatar May 30 '23 09:05 MartinKayJr

Is there a more powerful decompilation tool, this code I can't get GPT to handle because tokens are too big

MartinKayJr avatar May 30 '23 09:05 MartinKayJr

Dex2jar original deprecated and not support new dex version. Dex2jar support only dex35

Is there are any similar tools? I know only about enjarify which is also deprecated.

ThexXTURBOXx's Dex2Jar fork is where the development happens nowadays. It doesn't add any new features afaik, but it has plenty of bug fixes and support for new dex versions is pretty good.

NebelNidas avatar Jun 01 '23 21:06 NebelNidas