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
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>
<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>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
@ -109,18 +102,6 @@
<artifactId>commons-text</artifactId>
<version>1.9</version>
</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>
<groupId>org.jboss.windup.decompiler</groupId>
<artifactId>decompiler-fernflower</artifactId>
@ -141,11 +122,6 @@
<artifactId>imgscalr-lib</artifactId>
<version>4.2</version>
</dependency>
<dependency>
<groupId>com.github.skylot.jadx</groupId>
<artifactId>jadx-core</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
@ -220,6 +196,62 @@
<artifactId>xpp3</artifactId>
<version>1.1.4c</version>
</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>
<build>

View File

@ -11,7 +11,6 @@ import java.util.Objects;
import java.util.Random;
import me.konloch.kontainer.io.DiskReader;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import static the.bytecode.club.bytecodeviewer.Constants.*;
@ -56,14 +55,18 @@ public class JADXDecompiler extends Decompiler {
}
File fuckery = new File(fuckery(fileStart));
try {
JadxArgs args = new JadxArgs();
args.getInputFiles().add(tempClass);
args.setOutDir(fuckery);
args.setOutDirSrc(fuckery);
args.setOutDirRes(fuckery);
JadxDecompiler jadx = new JadxDecompiler(args);
jadx.load();
jadx.save();
jadx.saveSources();
//jadx.close();
} catch (StackOverflowError | Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
@ -75,6 +78,9 @@ public class JADXDecompiler extends Decompiler {
if (fuckery.exists())
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"
+ nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler."
@ -113,7 +119,7 @@ public class JADXDecompiler extends Decompiler {
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.";
}

View File

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

View File

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