3

According to dart-lang/sdk:

Starting in 1.21, the Dart VM also supports application snapshots, which include all the parsed classes and compiled code generated during a training run of a program.

    $ dart --snapshot=hello.dart.snapshot --snapshot-kind=app-jit hello.dart arguments-for-training
    Hello, world!
    $ dart hello.dart.snapshot arguments-for-use
    Hello, world!

Now,how can i decompile this hello.dart.snapshot file to hello.dart?

In android Apk that written by java language we can decompile apk and get jar file from class.dex using dex2jar tools, but when application developed by flutter framework(written with dart)how can decompile this application and get application dart classes?

This image show snapshot files that generated in apk assets file.

Apk structure

1 Answer 1

11

In release mode, Flutter compiles the Dart code to machine code, currently only ARMv7 (this procedure is called AOT - Ahead-Of-Time compilation). Unlike native Android apps, in which the Java is compiled to byte-code named Smali, which can be (pretty easily) decompiled to Java back again.

Most of the machine code is compiled to the file "isolate_snapshot_instr", which is written in a special format, and the flutter engine (flutterlib.so, also found inside the app), loads it into the app memory in run time. Therefore, you have 2 reasonable options:

  1. Reading the app code at runtime (the .text segment). You can use frida dump for that, and extract the compiled Dart code that you need
  2. Pacthing/Using the Flutter engine in order to deserialize the machine code

If you have ipa (IOS app), that could be easier, because all of the code is found in App.Framework.

Sign up to request clarification or add additional context in comments.

1 Comment

I have dumped the memory of my flutter application with 'Frida dump' and now I got a ~680MB memory dump file. How can i look for the .text segment into this file? I have searched in it with an HexEditor for 'text', '.text', 'section.text', 'Text', 'TEXT', but I couldn't find anything. How can I proceed? thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.