Created
September 9, 2017 17:52
-
-
Save tomykaira/e8a001a30ad8bf9fcaaf9537a223a34f to your computer and use it in GitHub Desktop.
Java to smali conversion, one liner.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
JAVA_HOME='/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home' | |
cd /tmp | |
cat > input_tmp.java <<EOF | |
public class input_tmp { | |
public static void main(String[] args) { | |
$1 | |
} | |
} | |
EOF | |
javac -source 7 -target 7 input_tmp.java | |
/Users/me/Library/Android/sdk//build-tools/25.0.0/dx --dex --output=classes.dex input_tmp.class | |
java -jar /Users/me/Downloads/baksmali-2.2.1.jar dis classes.dex | |
cat out/input_tmp.smali | |
rm -rf input_tmp.class input_tmp.java classes.dex out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cd java2smali
./ java2smali.sh
;)