Closed curiousfellas closed 4 years ago
@CalebFenton Which OS or Linux distro are you using?
I'm using MacOS but that doesn't matter.
The error tells you that the first three bytes of the file you're giving it are newlines. This is not a ZIP. Try giving it an apk file.
Make sure the input path exists exactly where you're saying it does (in the same directory as simplify-1.3.0.jar) and that it's a valid zip file.
Oh, and welcome to github.
The problem was that apk file was wrong The file on which i tried again the command in verbose mode is https://github.com/CalebFenton/simplify/raw/master/simplify/obfuscated-app.apk
This is the output i got
C:>java -jar simplify-1.2.1.jar -v -it 'org/cf/obfuscated' -et 'MainActivity' obfuscated-app.apk 21:13:37.641 INFO Main - Options: Input file: obfuscated-app.apk Output file: obfuscated-app_simple.apk Include filter: 'org/cf/obfuscated' Exclude filter: 'MainActivity' Max execution time: 300 Max address visits: 10000 Max call depth: 50 Max method visits: 1000000 Max optimization passes: 100 Output API level: 15 Include support library: false 21:13:42.696 INFO Main - Filtered 1097 support library classes Simplification complete: total classes = 0 total methods = 0 optimized methods = 0 failed methods = 0 run time = 8391 ms Total optimizations:
Writing output to obfuscated-app_simple.apk
also for simplify-1.3.0.jar output was
C:>java -jar simplify-1.3.0.jar -v -it 'org/cf/obfuscated' -et 'MainActivity' obfuscated-app.apk 21:37:19.730 INFO Main - Options: Input file: obfuscated-app.apk Output file: obfuscated-app_simple.apk Include filter: 'org/cf/obfuscated' Exclude filter: 'MainActivity' Max execution time: 300 Max address visits: 10000 Max call depth: 50 Max method visits: 1000000 Max optimization passes: 100 Output API level: 15 Include support library: false 21:37:25.729 INFO Main - Filtered 1097 support library classes Simplification complete: total classes = 0 total methods = 0 optimized methods = 0 failed methods = 0 run time = 7903 ms Total optimizations:
Writing output to obfuscated-app_simple.apk
This is strange. If I download the jar you link and the simplify jar from the releases page, it runs fine. This is part of the test suite for every release, too.
Try checking the file hashes (especially of obfuscated-app.apk) and copy/pasting the command exactly.
$ shasum simplify-1.3.0.jar
2a86448b71d79d4ccc981d34e80e5fecb51d7b33 simplify-1.3.0.jar
$ shasum obfuscated-app.apk
2007e1f33d05cbff73e9f1a979854e43236a8f18 obfuscated-app.apk
$ java -jar simplify-1.3.0.jar obfuscated-app.apk -it 'org/cf/obfuscated' -et 'MainActivity'
[1 / 19] Processing top level class Lorg/cf/obfuscated/Reflection;
(1 / 8) Executing top level method: Lorg/cf/obfuscated/Reflection;->secretMethod2()V
... snip ...
Verified the SHA1 checksums PS C:> certutil.exe -hashfile .\obfuscated-app.apk sha1 SHA1 hash of .\obfuscated-app.apk: 2007e1f33d05cbff73e9f1a979854e43236a8f18 CertUtil: -hashfile command completed successfully. PS C:> certutil.exe -hashfile .\simplify-1.3.0.jar sha1 SHA1 hash of .\simplify-1.3.0.jar: 2a86448b71d79d4ccc981d34e80e5fecb51d7b33 CertUtil: -hashfile command completed successfully.
This is the output C:>java -jar simplify-1.3.0.jar obfuscated-app.apk -it 'org/cf/obfuscated' -et 'MainActivity' Simplification complete: total classes = 0 total methods = 0 optimized methods = 0 failed methods = 0 run time = 6515 ms Total optimizations:
Writing output to obfuscated-app_simple.apk
hy mate @curiousfellas i had similer problem in past for windows 7 and i resolved it by using double quotes instead of single in commands .
java -jar simplify.jar obfuscated-app.apk -it "org/cf/obfuscated" -et "MainActivity"
Please try and let me know if it works on windows 10 or not
I tried with double quotes.
C:>java -jar simplify-1.3.0.jar obfuscated-app.apk -it "org/cf/obfuscated" -et "MainActivity"
[1 / 19] Processing top level class Lorg/cf/obfuscated/Reflection;
(1 / 8) Executing top level method: Lorg/cf/obfuscated/Reflection;->secretMethod2()V
Simplifying: Lorg/cf/obfuscated/Reflection;->secretMethod2()V
Optimizations:
constantized ifs = 0
constantized ops = 0
dead assignments removed = 0
dead ops removed = 0
dead results removed = 0
nops removed = 0
peephole optmizations = 0
unreflected fields = 0
unreflected methods = 0
useless gotos removed = 0
(2 / 8) Executing top level method: Lorg/cf/obfuscated/Reflection;->reflectSecretMethod2()V
Simplifying: Lorg/cf/obfuscated/Reflection;->reflectSecretMethod2()V
Optimizations:
constantized ifs = 0
constantized ops = 3
dead assignments removed = 12
dead ops removed = 0
dead results removed = 3
nops removed = 0
peephole optmizations = 1
unreflected fields = 0
unreflected methods = 1
useless gotos removed = 0
(2 / 8) Executing top level method: Lorg/cf/obfuscated/Reflection;->reflectSecretMethod2()V
Simplifying: Lorg/cf/obfuscated/Reflection;->reflectSecretMethod2()V
Optimizations:
constantized ifs = 0
constantized ops = 0
dead assignments removed = 0
dead ops removed = 0
dead results removed = 0
nops removed = 0
peephole optmizations = 0
unreflected fields = 0
unreflected methods = 0
useless gotos removed = 0
(3 / 8) Executing top level method: Lorg/cf/obfuscated/Reflection;->
But i am not sure if this is the expected output
nice . its worked. this is expected output mate , you may again try with higher value of max-address-visit or max-method visit as per as output say as some of methods left unoptimized
Lol Windows
I downloaded the 3 jar files from https://github.com/CalebFenton/simplify/releases/tag/v1.3.0
placed them in C:// path on windows 10 64-bit
This is the apk https://github.com/CalebFenton/simplify/blob/master/simplify/obfuscated-app.apk
and executed this command java -jar simplify-1.3.0.jar -it 'org/cf/obfuscated' -et 'MainActivity' obfuscated-app.apk
But this is the error i am getting
Exception in thread "main" java.lang.RuntimeException: Unknown input file type; magic: [10, 10, 10] at org.cf.simplify.SimplifyOptions.determineInputType(SimplifyOptions.java:229) at org.cf.simplify.SimplifyOptions.setInFile(SimplifyOptions.java:60) at org.cf.simplify.SimplifyOptionsParser.getSimplifyOptions(SimplifyOptionsParser.java:95) at org.cf.simplify.SimplifyOptionsParser.parse(SimplifyOptionsParser.java:26) at org.cf.simplify.Launcher.getOptions(Launcher.java:58) at org.cf.simplify.Launcher.run(Launcher.java:120) at org.cf.simplify.Main.main(Main.java:14)