hacktricks/mobile-pentesting/android-app-pentesting/apk-decompilers.md

90 lines
5.3 KiB
Markdown
Raw Normal View History

2022-04-28 23:27:22 +00:00
# APK decompilers
2022-04-28 16:01:33 +00:00
2024-07-18 23:16:27 +00:00
{% hint style="success" %}
Learn & practice AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
2024-07-18 23:16:27 +00:00
<details>
2022-04-28 16:01:33 +00:00
2024-07-18 23:16:27 +00:00
<summary>Support HackTricks</summary>
2024-01-03 10:43:38 +00:00
2024-07-18 23:16:27 +00:00
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>
2024-07-18 23:16:27 +00:00
{% endhint %}
{% endhint %}
2022-04-28 16:01:33 +00:00
2024-02-08 03:06:37 +00:00
**For further details on each tool check the original post from [https://eiken.dev/blog/2021/02/how-to-break-your-jar-in-2021-decompilation-guide-for-jars-and-apks/#cfr](https://eiken.dev/blog/2021/02/how-to-break-your-jar-in-2021-decompilation-guide-for-jars-and-apks/#cfr)**
2024-02-08 03:06:37 +00:00
### [JD-Gui](https://github.com/java-decompiler/jd-gui)
2024-02-08 03:06:37 +00:00
As the pioneering GUI Java decompiler, **JD-Gui** allows you to investigate Java code within APK files. It's straightforward to use; after obtaining the APK, simply open it with JD-Gui to inspect the code.
2024-02-08 03:06:37 +00:00
### [Jadx](https://github.com/skylot/jadx)
2024-02-08 03:06:37 +00:00
**Jadx** offers a user-friendly interface for decompiling Java code from Android applications. It's recommended for its ease of use across different platforms.
2024-02-08 03:06:37 +00:00
- To launch the GUI, navigate to the bin directory and execute: `jadx-gui`
- For command-line usage, decompile an APK with: `jadx app.apk`
- To specify an output directory or adjust decompilation options: `jadx app.apk -d <path to output dir> --no-res --no-src --no-imports`
2024-02-08 03:06:37 +00:00
### [GDA-android-reversing-Tool](https://github.com/charles2gan/GDA-android-reversing-Tool)
2024-02-08 03:06:37 +00:00
**GDA**, a Windows-only tool, offers extensive features for reverse engineering Android apps. Install and run GDA on your Windows system, then load the APK file for analysis.
2024-02-08 03:06:37 +00:00
### [Bytecode-Viewer](https://github.com/Konloch/bytecode-viewer/releases)
2024-02-08 03:06:37 +00:00
With **Bytecode-Viewer**, you can analyze APK files using multiple decompilers. After downloading, run Bytecode-Viewer, load your APK, and select the decompilers you wish to use for simultaneous analysis.
2024-02-08 03:06:37 +00:00
### [Enjarify](https://github.com/Storyyeller/enjarify)
2024-02-08 03:06:37 +00:00
**Enjarify** translates Dalvik bytecode to Java bytecode, enabling Java analysis tools to analyze Android applications more effectively.
2024-02-08 03:06:37 +00:00
- To use Enjarify, run: `enjarify app.apk`
This generates the Java bytecode equivalent of the provided APK.
2024-02-08 03:06:37 +00:00
### [CFR](https://github.com/leibnitz27/cfr)
2024-02-08 03:06:37 +00:00
**CFR** is capable of decompiling modern Java features. Use it as follows:
2024-02-08 03:06:37 +00:00
- For standard decompilation: `java -jar ./cfr.jar "app.jar" --outputdir "output_directory"`
- For large JAR files, adjust the JVM memory allocation: `java -Xmx4G -jar ./cfr.jar "app.jar" --outputdir "output_directory"`
2024-02-08 03:06:37 +00:00
### [Fernflower](https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine)
2024-02-08 03:06:37 +00:00
**Fernflower**, an analytical decompiler, requires building from source. After building:
2021-03-22 09:38:34 +00:00
2024-02-08 03:06:37 +00:00
- Decompile a JAR file: `java -jar ./fernflower.jar "app.jar" "output_directory"`
Then, extract the `.java` files from the generated JAR using `unzip`.
2021-03-22 09:38:34 +00:00
2024-02-08 03:06:37 +00:00
### [Krakatau](https://github.com/Storyyeller/Krakatau)
2021-03-22 09:38:34 +00:00
2024-02-08 03:06:37 +00:00
**Krakatau** offers detailed control over decompilation, especially for handling external libraries.
2021-03-22 09:38:34 +00:00
2024-02-08 03:06:37 +00:00
- Use Krakatau by specifying the standard library path and the JAR file to decompile: `./Krakatau/decompile.py -out "output_directory" -skip -nauto -path "./jrt-extractor/rt.jar" "app.jar"`
2021-03-22 09:38:34 +00:00
2024-02-08 03:06:37 +00:00
### [procyon](https://github.com/mstrobel/procyon)
2021-03-22 09:38:34 +00:00
2024-02-08 03:06:37 +00:00
For straightforward decompilation with **procyon**:
2021-03-22 09:38:34 +00:00
2024-02-08 03:06:37 +00:00
- Decompile a JAR file to a specified directory: `procyon -jar "app.jar" -o "output_directory"`
2024-07-18 23:16:27 +00:00
{% hint style="success" %}
Learn & practice AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
<details>
2024-07-18 23:16:27 +00:00
<summary>Support HackTricks</summary>
2022-04-28 16:01:33 +00:00
2024-07-18 23:16:27 +00:00
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>
2024-07-18 23:16:27 +00:00
{% endhint %}
</details>
{% endhint %}