How to Use reFlutter for Extracting Dart Code from APKs ๐Ÿ› ๏ธ

Posted on Oct 30, 2022

ReFlutter is a handy tool that allows you to reverse engineer Flutter apps and extract Dart code, monitor network trafic from APKs. Hereโ€™s a step-by-step guide on how to use reFlutter:


1. Installation ๐Ÿ–ฅ๏ธ

First, you need to install reFlutter. Open your terminal and run the following command:

pip3 install reflutter==0.7.8

This will install the reFlutter tool on your system.


2. Android Setup via Termux ๐Ÿ“ฒ

For Android users using Termux, follow these steps:

  1. Open a New Terminal:

    • In Termux, open a new terminal session.
  2. Get Your IP Address:

    • Type ifconfig and hit enter.
    • Copy the IP address of the currently active connection.
  3. Run reFlutter:

    • In a fresh terminal, type:
         reflutter <path_to_your_apk>
      
    • Press enter.
  4. Choose Option 2:

    • reFlutter will prompt you with two options. Select option 2 and hit enter.
  5. Enter IP Address:

    • Paste the IP address you copied earlier and press enter.
  6. APK Generation:

    • reFlutter will generate an APK named release.RE.apk.

3. Signing the APK ๐Ÿ“

To sign the APK:

  • Use MT Manager (an Android file manager with powerful editing features) to sign the APK.
  • Or, You can also use uber-apk-signer to sign the APK.

4. Install and Run the APK ๐Ÿš€

Once the APK is signed:

  • Install it on your Android device.
  • Run the app.

5. Finding the Dump File ๐Ÿ”

Root Users:

  • Go to /data/data/<package_name_of_app>/.
  • You’ll find the dump.dart file here.

Non-Root Users:

  • Using PC:

    • Open a terminal and run:
          adb -d shell "cat /data/data/<package_name_of_app>/dump.dart" > dump.dart
      
  • Using Android (MT Manager):

    • Use the inject document provider function in MT Manager to access the dump.dart file.

Conclusion ๐ŸŽฏ

With these steps, you can successfully use reFlutter to extract Dart code from Flutter apps. Whether youโ€™re a root user or not, this guide has got you covered!

Happy reversing! ๐Ÿ”ง๐Ÿ’ป