commit
b0f3e5832a
4 changed files with 20 additions and 11 deletions
BIN
libs/apktool-2.5.0.jar
Normal file
BIN
libs/apktool-2.5.0.jar
Normal file
Binary file not shown.
Binary file not shown.
7
pom.xml
7
pom.xml
|
@ -30,7 +30,7 @@
|
||||||
<artifactId>apktool</artifactId>
|
<artifactId>apktool</artifactId>
|
||||||
<version>2.3.0</version>
|
<version>2.3.0</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${project.basedir}/libs/apktool_2.3.0.jar</systemPath>
|
<systemPath>${project.basedir}/libs/apktool-2.5.0.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.ow2.asm</groupId>
|
<groupId>org.ow2.asm</groupId>
|
||||||
|
@ -186,6 +186,11 @@
|
||||||
<artifactId>smali</artifactId>
|
<artifactId>smali</artifactId>
|
||||||
<version>2.5.2</version>
|
<version>2.5.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.smali</groupId>
|
||||||
|
<artifactId>baksmali</artifactId>
|
||||||
|
<version>2.5.2</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.yaml</groupId>
|
<groupId>org.yaml</groupId>
|
||||||
<artifactId>snakeyaml</artifactId>
|
<artifactId>snakeyaml</artifactId>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package the.bytecode.club.bytecodeviewer.util;
|
package the.bytecode.club.bytecodeviewer.util;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
|
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
|
||||||
|
@ -36,7 +37,9 @@ public class Dex2Jar {
|
||||||
*/
|
*/
|
||||||
public static synchronized void dex2Jar(File input, File output) {
|
public static synchronized void dex2Jar(File input, File output) {
|
||||||
try {
|
try {
|
||||||
com.googlecode.dex2jar.tools.Dex2jarCmd.main(input.getAbsolutePath());
|
com.googlecode.dex2jar.tools.Dex2jarCmd cmd = new com.googlecode.dex2jar.tools.Dex2jarCmd();
|
||||||
|
applyErrorFix(cmd);
|
||||||
|
cmd.doMain(input.getAbsolutePath());
|
||||||
String realOutput = input.getName().replaceAll("\\.dex", "-dex2jar.jar").replaceAll("\\.apk", "-dex2jar"
|
String realOutput = input.getName().replaceAll("\\.dex", "-dex2jar.jar").replaceAll("\\.apk", "-dex2jar"
|
||||||
+ ".jar");
|
+ ".jar");
|
||||||
File realOutputF = new File(realOutput);
|
File realOutputF = new File(realOutput);
|
||||||
|
@ -44,20 +47,21 @@ public class Dex2Jar {
|
||||||
File realOutputF2 = new File(realOutput);
|
File realOutputF2 = new File(realOutput);
|
||||||
while (realOutputF2.exists())
|
while (realOutputF2.exists())
|
||||||
realOutputF2.delete();
|
realOutputF2.delete();
|
||||||
|
|
||||||
//TODO fix this properly
|
|
||||||
// WARNING: this could probably delete important error files but until a proper dex2jar fix is added this is needed
|
|
||||||
// or else after each APK decompile the file directory will be flooded with -error.zip
|
|
||||||
for(File localFile : new File(".").listFiles())
|
|
||||||
{
|
|
||||||
if(localFile.getName().length() == 42 && localFile.getName().endsWith("-error.zip"))
|
|
||||||
localFile.delete();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO fix this properly
|
||||||
|
private static void applyErrorFix(com.googlecode.dex2jar.tools.Dex2jarCmd cmd) {
|
||||||
|
try {
|
||||||
|
Field f = com.googlecode.dex2jar.tools.Dex2jarCmd.class.getDeclaredField("notHandleException");
|
||||||
|
f.setAccessible(true);
|
||||||
|
f.set(cmd, true);
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a .jar to .dex
|
* Converts a .jar to .dex
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue