Skip to content

Instantly share code, notes, and snippets.

@tomykaira
Created September 9, 2017 17:52
Show Gist options
  • Save tomykaira/e8a001a30ad8bf9fcaaf9537a223a34f to your computer and use it in GitHub Desktop.
Save tomykaira/e8a001a30ad8bf9fcaaf9537a223a34f to your computer and use it in GitHub Desktop.
Java to smali conversion, one liner.
#!/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
@JonnyBanana
Copy link

Thanks ! But how i can use this code ?
And I have no idea about Bash language !

cd java2smali
./ java2smali.sh

;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment