Fixed JADX Decompiler

Reverted to an older version of the JADX library and added them back to the libs folder, at a later date the non-obfuscation libraries could be added to the pom

The ViewPane also had a few issues which are now resolved
This commit is contained in:
Konloch 2021-06-21 10:01:19 -07:00
parent d787ead0da
commit 8df8c553fa

AI 샘플 코드 생성 중입니다

Loading...
12 changed files with 74 additions and 35 deletions

Binary file not shown.

Binary file not shown.

BIN
libs/jadx/dx-1.16.jar Normal file

Binary file not shown.

BIN
libs/jadx/jadx-core.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

80
pom.xml
View File

@ -20,13 +20,6 @@
</repositories> </repositories>
<dependencies> <dependencies>
<dependency>
<groupId>com.android</groupId>
<artifactId>android-lib</artifactId>
<version>5.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/android-5.1.jar</systemPath>
</dependency>
<dependency> <dependency>
<groupId>org.jetbrains</groupId> <groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId> <artifactId>annotations</artifactId>
@ -109,18 +102,6 @@
<artifactId>commons-text</artifactId> <artifactId>commons-text</artifactId>
<version>1.9</version> <version>1.9</version>
</dependency> </dependency>
<dependency>
<groupId>com.pxb1988</groupId>
<artifactId>d2jar-lib-obf</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/d2jar-lib-obf.jar</systemPath>
</dependency>
<dependency>
<groupId>com.rover12421.android</groupId>
<artifactId>dx</artifactId>
<version>1.16</version>
</dependency>
<dependency> <dependency>
<groupId>org.jboss.windup.decompiler</groupId> <groupId>org.jboss.windup.decompiler</groupId>
<artifactId>decompiler-fernflower</artifactId> <artifactId>decompiler-fernflower</artifactId>
@ -141,11 +122,6 @@
<artifactId>imgscalr-lib</artifactId> <artifactId>imgscalr-lib</artifactId>
<version>4.2</version> <version>4.2</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.skylot.jadx</groupId>
<artifactId>jadx-core</artifactId>
<version>1.2.0</version>
</dependency>
<dependency> <dependency>
<groupId>org.codehaus.janino</groupId> <groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId> <artifactId>janino</artifactId>
@ -220,6 +196,62 @@
<artifactId>xpp3</artifactId> <artifactId>xpp3</artifactId>
<version>1.1.4c</version> <version>1.1.4c</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.skylot</groupId>
<artifactId>JADX-Core</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/jadx/jadx-core.jar</systemPath>
</dependency>
<dependency>
<groupId>com.github.skylot</groupId>
<artifactId>JADX-Android</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/jadx/android-5.1.jar</systemPath>
</dependency>
<dependency>
<groupId>com.android</groupId>
<artifactId>DX</artifactId>
<version>1.16</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/jadx/dx-1.16.jar</systemPath>
</dependency>
<dependency>
<groupId>com.android</groupId>
<artifactId>D2Jar-obf</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/jadx/d2jar-lib-obf.jar</systemPath>
</dependency>
<dependency>
<groupId>org.intellij</groupId>
<artifactId>Annotations</artifactId>
<version>17.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/jadx/annotations-17.0.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.rits</groupId>
<artifactId>Cloning</artifactId>
<version>1.9.12</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/jadx/cloning-1.9.12.jar</systemPath>
</dependency>
<dependency>
<groupId>org.objenesis</groupId>
<artifactId>Objenesis</artifactId>
<version>3.0.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/jadx/objenesis-3.0.1.jar</systemPath>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j</artifactId>
<version>1.7.26</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/jadx/slf4j-api-1.7.26.jar</systemPath>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -11,7 +11,6 @@ import java.util.Objects;
import java.util.Random; import java.util.Random;
import me.konloch.kontainer.io.DiskReader; import me.konloch.kontainer.io.DiskReader;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.MiscUtils; import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import static the.bytecode.club.bytecodeviewer.Constants.*; import static the.bytecode.club.bytecodeviewer.Constants.*;
@ -56,14 +55,18 @@ public class JADXDecompiler extends Decompiler {
} }
File fuckery = new File(fuckery(fileStart)); File fuckery = new File(fuckery(fileStart));
try { try {
JadxArgs args = new JadxArgs(); JadxArgs args = new JadxArgs();
args.getInputFiles().add(tempClass); args.getInputFiles().add(tempClass);
args.setOutDir(fuckery); args.setOutDir(fuckery);
args.setOutDirSrc(fuckery);
args.setOutDirRes(fuckery);
JadxDecompiler jadx = new JadxDecompiler(args); JadxDecompiler jadx = new JadxDecompiler(args);
jadx.load(); jadx.load();
jadx.save(); jadx.saveSources();
//jadx.close();
} catch (StackOverflowError | Exception e) { } catch (StackOverflowError | Exception e) {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(new PrintWriter(sw));
@ -76,6 +79,9 @@ public class JADXDecompiler extends Decompiler {
if (fuckery.exists()) if (fuckery.exists())
return findFile(Objects.requireNonNull(fuckery.listFiles())); return findFile(Objects.requireNonNull(fuckery.listFiles()));
if(exception.isEmpty())
exception = "Decompiled source file not found!";
return "JADX error! Send the stacktrace to Konloch at https://the.bytecode.club or konloch@gmail.com" return "JADX error! Send the stacktrace to Konloch at https://the.bytecode.club or konloch@gmail.com"
+ nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler."
+ nl + nl + exception; + nl + nl + exception;
@ -113,7 +119,7 @@ public class JADXDecompiler extends Decompiler {
return s; return s;
} }
} }
return "CFR error!" + nl + nl + "Suggested Fix: Click refresh class, if it " return "JADX error!" + nl + nl + "Suggested Fix: Click refresh class, if it "
+ "fails again try another decompiler."; + "fails again try another decompiler.";
} }

View File

@ -1,7 +1,7 @@
package the.bytecode.club.bytecodeviewer.gui; package the.bytecode.club.bytecodeviewer.gui;
//TODO re-add //TODO fix for Java 9+
//import com.sun.java.swing.plaf.windows.WindowsTreeUI; import com.sun.java.swing.plaf.windows.WindowsTreeUI;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -220,8 +220,8 @@ public class FileNavigationPane extends VisibleComponent implements
} }
}); });
//TODO re-add //TODO fix for Java 9+
/*pop.add(new AbstractAction("Expand", WindowsTreeUI.ExpandedIcon.createExpandedIcon()) { pop.add(new AbstractAction("Expand", WindowsTreeUI.ExpandedIcon.createExpandedIcon()) {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
TreePath selPath = FileNavigationPane.this.tree.getPathForLocation(x, y); TreePath selPath = FileNavigationPane.this.tree.getPathForLocation(x, y);
@ -235,7 +235,7 @@ public class FileNavigationPane extends VisibleComponent implements
TreePath selPath = FileNavigationPane.this.tree.getPathForLocation(x, y); TreePath selPath = FileNavigationPane.this.tree.getPathForLocation(x, y);
expandAll(tree, Objects.requireNonNull(selPath), false); expandAll(tree, Objects.requireNonNull(selPath), false);
} }
});*/ });
pop.show(this.tree, x, y); pop.show(this.tree, x, y);
} }
@ -315,7 +315,6 @@ public class FileNavigationPane extends VisibleComponent implements
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
System.out.println((int) e.getKeyChar());
if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (e.getKeyCode() == KeyEvent.VK_ENTER) {
if (e.getSource() instanceof MyTree) { if (e.getSource() instanceof MyTree) {
MyTree tree = (MyTree) e.getSource(); MyTree tree = (MyTree) e.getSource();

View File

@ -79,13 +79,15 @@ public class ViewPane
return 7; return 7;
else if (group.isSelected(krakatau.getBytecode().getModel())) else if (group.isSelected(krakatau.getBytecode().getModel()))
return 8; return 8;
else if (group.isSelected(JD.getBytecode().getModel())) else if (group.isSelected(JD.getJava().getModel()))
return 9; return 9;
else if (group.isSelected(JADX.getBytecode().getModel())) else if (group.isSelected(JADX.getJava().getModel()))
return 10; return 10;
else if (group.isSelected(asmTextify.getModel())) else if (group.isSelected(asmTextify.getModel()))
return 11; return 11;
System.out.println("DEFAULTING TO NULL");
//default to none //default to none
return 0; return 0;
} }