How to decompile apk file to java source code with MAC

If you are passed an apk file due to a CTF rev problem, you need to decompile to java source code.

Use dex2jar and jad.

The flow is .apk-> .dex-> .jar-> .class-> .jad.

You can see the source code of java by opening the .jad file.

reference:

https://qiita.com/le_skamba/items/04c0a0cfe420be862122

https://hacknote.jp/archives/10259/

http://inarizuuuushi.hatenablog.com/entry/2017/05/09/231600

0. Install dex2jar, jad

dex2jar

Use brew.

You need to go through the path.

brew install dex2jar

echo 'export PATH="$PATH:/usr/local/Cellar/dex2jar/2.0/bin"' >> ~/.bash_profile
source ~/.bash_profile

jad

Use brew cask.

brew tap caskroom/cask
brew install caskroom/cask/jad
  1. apk -> dex
unzip hoge.apk
  1. dex -> jar
d2j-dex2jar hoge.dex
  1. jar -> class
jar xf hoge.jar 
  1. class -> jad
jad -r path/hoge.class 

Recommended Posts

How to decompile apk file to java source code with MAC
How to uninstall Java 8 (Mac)
How to build Java development environment with VS Code
Java build with mac vs code
How to decompile java class files
How to switch Java version with direnv in terminal on Mac
How to open a script file from Ubuntu with VS code
How to check Java installed on Mac
[Java] How to use the File class
How to compile Java with VsCode & Ant
[Java] How to compare with equals method
How to switch Java versions on Mac
How to achieve file download with Feign
[Java] Flow from source code to execution
How to achieve file upload with Feign
Generate source code from JAR file with JD-GUI of Java Decompiler project
How to use Java framework with AWS Lambda! ??
How to use Java API with lambda expression
How to write test code with Basic authentication
How to use nginx-ingress-controller with Docker for Mac
[Java] Memo on how to write the source
java (split source file)
[Java] How to get the URL of the transition source
How to implement UICollectionView in Swift with code only
Build Java development environment with VS Code on Mac
How to jump from Eclipse Java to a SQL file
[Java] How to omit spring constructor injection with Lombok
How to deploy Java to AWS Lambda with Serverless Framework
How to unit test with JVM with source using RxAndroid
[Java] How to extract the file name from the path
[Java] How to encrypt with AES encryption with standard library
As of April 2018 How to get Java 8 on Mac
How to make Laravel faster with Docker for Mac
How to convert a file to a byte array in Java
How to install Gradle and Kotlin with SDKMAN (Mac)
[Java] How to start a new line with StringBuilder
How to save a file with the specified extension under the directory specified in Java to the list
How to request a CSV file as JSON with jMeter
[Java] How to use Map
How to read your own YAML file (*****. Yml) in Java
How to lower java version
[Java] How to use Map
How to write good code
How to use trained model of tensorflow2.0 with Kotlin / Java
Java to play with Function
Java --How to make JTable
How to handle exceptions coolly with Java 8 Stream or Optional
How to use java Optional
How to minimize Java images
How to write java comments
How to use java class
[Easy] How to automatically format Ruby erb file with vsCode
[Java] How to use Optional ②
[Java] How to use removeAll ()
[Java] How to display Wingdings
How to read a library from a JAR file with VS Code << How to not use Maven / Gradle >>
[Java] How to use string.format
How to number (number) with html.erb
How to use Java Map
How to update with activerecord-import
How to set Java constants