DEV Community

Cover image for Extract code from Android APK with 3 commands

Posted on

Extract code from Android APK with 3 commands

I mean, with 3 tools


This post is for informational and educational purposes only


Terminal Time

# extract classes.dex
unzip -j <apkfile.apk> classes.dex
# transform dex file to jar file classes.dex
# read the sources
jd-gui classes-dex2jar.jar
Enter fullscreen mode Exit fullscreen mode


Do you use NativeScript/Ionic/Cordova/Phonegap/"insert some webview based mobile framework"?
This is how easy someone can read your javascript code

# find the bundled JS
unzip -l <apK file> | grep '.js'
# extract the bundle
unzip -j <apk file> assets/app.js
# find endpoint, or api keys
cat app.js | grep 'api*\|http*'
# DoS the endpoints
echo "just kidding"
Enter fullscreen mode Exit fullscreen mode


If you want to avoid commands an just use an app with UI you have

Hope you find it useful and educational.

Cover Image from

Top comments (2)

nguyenkien profile image
Nguyễn Trung Kiên • Edited

you don't have to unzip it.
Unzip only need when there is more than 1 dex file

protium profile image

You are right. I wanted to mention unzip for the bonus part.
And, as a matter of fact, you can use jadx and open directly the apk. Also you have a binary analysis tool from google