Merge pull request #343 from ThexXTURBOXx/smali
Properly fix Smali and Dex2Jar
This commit is contained in:
		
						commit
						4d87d2ee99
					
				
					 37 changed files with 38 additions and 74 deletions
				
			
		| 
						 | 
				
			
			@ -21,4 +21,5 @@ Some dependencies may have been modified or could be released by their author in
 | 
			
		|||
 | 
			
		||||
 - `JD-GUI`: Removed ASM and RSyntaxTextArea
 | 
			
		||||
 - `APKTool`: Recompiled with the newest dependency versions, removed prebuilt folder
 | 
			
		||||
 - `DarkLAF`: Merged core & windows libraries for 2.6.2-20210719.010320-83
 | 
			
		||||
 - `DX`: Just taken from build-tools without modifications
 | 
			
		||||
 - `D2Jar`: Compiled from scratch
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
f917a330ef6379f8976ce3761e30e0fc
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
f5fbd039a4c3161b2a3db817786b39366e2cd796
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
08b71893e812afc9c2670a92acdded46
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
d0eb90a0d8eb49d0a9573224000c859358610783
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
0591d48d90ee4e7bcf92f9995686d3cb
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
24a479a29c3fe9293a6ccf69d975e0f3a3b09546
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
cab2e66e5444aaab6a440f7afa4f7829
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
9aee7f4031c7717c9dd18a61410d81cdbc4c7fb9
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
5d95e64f137ec77ddf401d25771b671c
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
926db5c7f9b2abf84fa1b17063e6676af73b9fcf
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
00c4e169d820da2b52ecff592c462a5c
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
3aa3ae5b23afd0e8e497860be45d2babcbdd03de
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										1
									
								
								libs/com/android/dx/30.0.3/dx-30.0.3.jar.md5
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								libs/com/android/dx/30.0.3/dx-30.0.3.jar.md5
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
27ccd6872887a6fa467c9f773f9fd218
 | 
			
		||||
							
								
								
									
										1
									
								
								libs/com/android/dx/30.0.3/dx-30.0.3.jar.sha1
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								libs/com/android/dx/30.0.3/dx-30.0.3.jar.sha1
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
ee70c208b9469e07dff48294d37ca4dfd009216c
 | 
			
		||||
| 
						 | 
				
			
			@ -3,6 +3,6 @@
 | 
			
		|||
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 | 
			
		||||
  <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
  <groupId>com.android</groupId>
 | 
			
		||||
  <artifactId>DX</artifactId>
 | 
			
		||||
  <version>1.16bcv</version>
 | 
			
		||||
  <artifactId>dx</artifactId>
 | 
			
		||||
  <version>30.0.3</version>
 | 
			
		||||
</project>
 | 
			
		||||
							
								
								
									
										1
									
								
								libs/com/android/dx/30.0.3/dx-30.0.3.pom.md5
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								libs/com/android/dx/30.0.3/dx-30.0.3.pom.md5
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
1c8d965abdb64d5e7869fe7abd0f8f16
 | 
			
		||||
							
								
								
									
										1
									
								
								libs/com/android/dx/30.0.3/dx-30.0.3.pom.sha1
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								libs/com/android/dx/30.0.3/dx-30.0.3.pom.sha1
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
e0c4f44b6eff749939e1cd6f2d2aa5ba2d9281d7
 | 
			
		||||
| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<metadata>
 | 
			
		||||
  <groupId>com.android</groupId>
 | 
			
		||||
  <artifactId>DX</artifactId>
 | 
			
		||||
  <artifactId>dx</artifactId>
 | 
			
		||||
  <versioning>
 | 
			
		||||
    <release>1.16bcv</release>
 | 
			
		||||
    <release>30.0.3</release>
 | 
			
		||||
    <versions>
 | 
			
		||||
      <version>1.16bcv</version>
 | 
			
		||||
      <version>30.0.3</version>
 | 
			
		||||
    </versions>
 | 
			
		||||
    <lastUpdated>20210622185015</lastUpdated>
 | 
			
		||||
    <lastUpdated>20210809171340</lastUpdated>
 | 
			
		||||
  </versioning>
 | 
			
		||||
</metadata>
 | 
			
		||||
							
								
								
									
										1
									
								
								libs/com/android/dx/maven-metadata.xml.md5
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								libs/com/android/dx/maven-metadata.xml.md5
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
9fc6457b2aaaca1869f9e0f1aab372d4
 | 
			
		||||
							
								
								
									
										1
									
								
								libs/com/android/dx/maven-metadata.xml.sha1
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								libs/com/android/dx/maven-metadata.xml.sha1
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
5e542c95e397f2b4c3f2b150360e39aa519f0863
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								libs/com/googlecode/D2Jar-obf/1.0bcv/D2Jar-obf-1.0bcv.jar
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/com/googlecode/D2Jar-obf/1.0bcv/D2Jar-obf-1.0bcv.jar
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
81084e179c8ac7f9638de6fb749f1a0e
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
a517e7a01c6d60dab4ea1645504c9ed9887a9190
 | 
			
		||||
| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
 | 
			
		||||
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 | 
			
		||||
  <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
  <groupId>com.android</groupId>
 | 
			
		||||
  <groupId>com.googlecode</groupId>
 | 
			
		||||
  <artifactId>D2Jar-obf</artifactId>
 | 
			
		||||
  <version>1.0bcv</version>
 | 
			
		||||
</project>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
c2145a55e8a96475489adebd58ea4968
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
e45f03179f6fc5a3becb4eda787c34fae28f93e5
 | 
			
		||||
| 
						 | 
				
			
			@ -1,12 +1,12 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<metadata>
 | 
			
		||||
  <groupId>com.android</groupId>
 | 
			
		||||
  <groupId>com.googlecode</groupId>
 | 
			
		||||
  <artifactId>D2Jar-obf</artifactId>
 | 
			
		||||
  <versioning>
 | 
			
		||||
    <release>1.0bcv</release>
 | 
			
		||||
    <versions>
 | 
			
		||||
      <version>1.0bcv</version>
 | 
			
		||||
    </versions>
 | 
			
		||||
    <lastUpdated>20210622185021</lastUpdated>
 | 
			
		||||
    <lastUpdated>20210809231039</lastUpdated>
 | 
			
		||||
  </versioning>
 | 
			
		||||
</metadata>
 | 
			
		||||
							
								
								
									
										1
									
								
								libs/com/googlecode/D2Jar-obf/maven-metadata.xml.md5
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								libs/com/googlecode/D2Jar-obf/maven-metadata.xml.md5
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
d54ac62e2043b2db34f2fcaad089de7c
 | 
			
		||||
							
								
								
									
										1
									
								
								libs/com/googlecode/D2Jar-obf/maven-metadata.xml.sha1
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								libs/com/googlecode/D2Jar-obf/maven-metadata.xml.sha1
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
51083035146a191d5a37266136f5a19a3b2d78c9
 | 
			
		||||
							
								
								
									
										8
									
								
								pom.xml
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								pom.xml
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -211,11 +211,11 @@
 | 
			
		|||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>com.android</groupId>
 | 
			
		||||
            <artifactId>DX</artifactId>
 | 
			
		||||
            <version>1.16bcv</version>
 | 
			
		||||
            <artifactId>dx</artifactId>
 | 
			
		||||
            <version>30.0.3</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>com.android</groupId>
 | 
			
		||||
            <groupId>com.googlecode</groupId>
 | 
			
		||||
            <artifactId>D2Jar-obf</artifactId>
 | 
			
		||||
            <version>1.0bcv</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
| 
						 | 
				
			
			@ -232,7 +232,7 @@
 | 
			
		|||
        <dependency>
 | 
			
		||||
            <groupId>com.github.gotson</groupId>
 | 
			
		||||
            <artifactId>webp-imageio</artifactId>
 | 
			
		||||
            <version>0.2.1</version>
 | 
			
		||||
            <version>0.2.2</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>de.skuzzle</groupId>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,10 +61,8 @@ public class SmaliAssembler extends InternalCompiler
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            com.googlecode.d2j.smali.SmaliCmd.main(new String[]{
 | 
			
		||||
                    tempSmaliFolder.getAbsolutePath(),
 | 
			
		||||
                    //"-o", tempDex.getAbsolutePath()
 | 
			
		||||
            });
 | 
			
		||||
            com.googlecode.d2j.smali.SmaliCmd.main(tempSmaliFolder.getAbsolutePath(),
 | 
			
		||||
                    "-o", tempDex.getAbsolutePath());
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
            //BytecodeViewer.handleException(e);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,7 @@ import me.konloch.kontainer.io.DiskReader;
 | 
			
		|||
import org.apache.commons.io.FileUtils;
 | 
			
		||||
import org.objectweb.asm.tree.ClassNode;
 | 
			
		||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
 | 
			
		||||
import the.bytecode.club.bytecodeviewer.Constants;
 | 
			
		||||
import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
 | 
			
		||||
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
 | 
			
		||||
import the.bytecode.club.bytecodeviewer.translation.TranslatedStrings;
 | 
			
		||||
| 
						 | 
				
			
			@ -55,6 +56,7 @@ public class SmaliDisassembler extends InternalDecompiler
 | 
			
		|||
 | 
			
		||||
        final File tempClass = new File(start + ".class");
 | 
			
		||||
        final File tempDex = new File(start + ".dex");
 | 
			
		||||
        final File tempDexOut = new File(start + "-out");
 | 
			
		||||
        final File tempSmali = new File(start + "-smali"); //output directory
 | 
			
		||||
 | 
			
		||||
        try (FileOutputStream fos = new FileOutputStream(tempClass)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -68,7 +70,8 @@ public class SmaliDisassembler extends InternalDecompiler
 | 
			
		|||
        Dex2Jar.saveAsDex(tempClass, tempDex, true);
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            com.googlecode.d2j.smali.BaksmaliCmd.main(new String[]{tempDex.getAbsolutePath()});
 | 
			
		||||
            com.googlecode.d2j.smali.BaksmaliCmd.main(tempDex.getAbsolutePath(),
 | 
			
		||||
                    "-o", tempDexOut.getAbsolutePath());
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            StringWriter sw = new StringWriter();
 | 
			
		||||
            e.printStackTrace(new PrintWriter(sw));
 | 
			
		||||
| 
						 | 
				
			
			@ -77,10 +80,8 @@ public class SmaliDisassembler extends InternalDecompiler
 | 
			
		|||
            exception += ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        File rename = new File(tempDex.getName().replaceFirst("\\.dex", "-out"));
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            FileUtils.moveDirectory(rename, tempSmali);
 | 
			
		||||
            FileUtils.moveDirectory(tempDexOut, tempSmali);
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            StringWriter sw = new StringWriter();
 | 
			
		||||
            e.printStackTrace(new PrintWriter(sw));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,8 +4,6 @@ import com.googlecode.d2j.dex.Dex2jar;
 | 
			
		|||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.lang.reflect.Field;
 | 
			
		||||
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
 * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite        *
 | 
			
		||||
| 
						 | 
				
			
			@ -50,16 +48,6 @@ public class Dex2Jar {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 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
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			@ -72,28 +60,7 @@ public class Dex2Jar {
 | 
			
		|||
 | 
			
		||||
    public static synchronized void saveAsDex(File input, File output, boolean delete) {
 | 
			
		||||
        try {
 | 
			
		||||
            com.googlecode.dex2jar.tools.Jar2Dex.main(input.getAbsolutePath());
 | 
			
		||||
            File currentDexLocation = new File("./" + input.getName());
 | 
			
		||||
 | 
			
		||||
            if (currentDexLocation.getAbsolutePath().toLowerCase().endsWith(".jar")) {
 | 
			
		||||
                currentDexLocation = new File(currentDexLocation.getAbsolutePath().replaceFirst("\\.jar", "-jar2dex"
 | 
			
		||||
                        + ".dex"));
 | 
			
		||||
            } else if (currentDexLocation.getAbsolutePath().toLowerCase().endsWith(".apk")) {
 | 
			
		||||
                currentDexLocation = new File(currentDexLocation.getAbsolutePath().replaceFirst("\\.apk", "-jar2dex"
 | 
			
		||||
                        + ".dex"));
 | 
			
		||||
            } else if (currentDexLocation.getAbsolutePath().toLowerCase().endsWith(".dex")) {
 | 
			
		||||
                currentDexLocation = new File(currentDexLocation.getAbsolutePath().replaceFirst("\\.dex", "-jar2dex"
 | 
			
		||||
                        + ".dex"));
 | 
			
		||||
            } else if (currentDexLocation.getAbsolutePath().toLowerCase().endsWith(".zip")) {
 | 
			
		||||
                currentDexLocation = new File(currentDexLocation.getAbsolutePath().replaceFirst("\\.zip", "-jar2dex"
 | 
			
		||||
                        + ".dex"));
 | 
			
		||||
            } else if (currentDexLocation.getAbsolutePath().toLowerCase().endsWith(".class")) {
 | 
			
		||||
                currentDexLocation = new File(currentDexLocation.getAbsolutePath().replaceFirst("\\.class", "-jar2dex"
 | 
			
		||||
                        + ".dex"));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            currentDexLocation.renameTo(output);
 | 
			
		||||
 | 
			
		||||
            com.googlecode.dex2jar.tools.Jar2Dex.main(input.getAbsolutePath(), "-o", output.getAbsolutePath());
 | 
			
		||||
            if (delete)
 | 
			
		||||
                input.delete();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -256,8 +256,7 @@ public class SecurityMan extends SecurityManager
 | 
			
		|||
    @SuppressWarnings("deprecation")
 | 
			
		||||
    public void checkMulticast(InetAddress maddr, byte ttl) {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @SuppressWarnings("deprecation")
 | 
			
		||||
 | 
			
		||||
    public void checkPackageAccess(String pkg) {
 | 
			
		||||
        if(printingPackage)
 | 
			
		||||
            System.out.println("Accessing: " + pkg);
 | 
			
		||||
| 
						 | 
				
			
			@ -335,9 +334,7 @@ public class SecurityMan extends SecurityManager
 | 
			
		|||
        {
 | 
			
		||||
            throw new SecurityException(e);
 | 
			
		||||
        }
 | 
			
		||||
    
 | 
			
		||||
        //TODO temporarily removed to fix #339
 | 
			
		||||
        // a proper fix is to edit the smali disassembler
 | 
			
		||||
        //throw new SecurityException("BCV is awesome, blocking write(" + file + ");");
 | 
			
		||||
 | 
			
		||||
        throw new SecurityException("BCV is awesome, blocking write(" + file + ");");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue