feat: add Flutter app instrumentation with reflutter#7
Open
luca-regne wants to merge 4 commits intomainfrom
Open
feat: add Flutter app instrumentation with reflutter#7luca-regne wants to merge 4 commits intomainfrom
luca-regne wants to merge 4 commits intomainfrom
Conversation
Implement batuta flutter commands to automate Flutter app analysis with reflutter for Dart code dumping. This replicates the flutter_setup.sh bash script functionality in Python with better integration into batuta. Features: - batuta flutter patch <package|apk> - Full workflow: pull, patch, install, dump - batuta flutter dump <package> - Extract Dart code from instrumented app - Auto-merge split APKs before patching - Flutter framework validation (with --force to skip) - Auto-start app via monkey or interactive --wait mode - JSON formatting for dump output Changes: - Add FlutterPatchResult and DumpResult Pydantic models - Add FlutterError, ReflutterError, DartDumpError exceptions - Implement ReflutterPatcher class with patch_and_install workflow - Add reflutter to tool dependency hints - Add cwd parameter to run_tool() for working directory support - Update README with Flutter instrumentation section - Update AGENTS.md command reference Requirements: - reflutter installed (pip install reflutter) - Rooted Android device for code dumping - apktool, apksigner, keytool, zipalign for signing
Update check_tool() to properly detect apksigner and zipalign from Android SDK build-tools directory using existing android_sdk helpers, instead of only checking PATH. This allows flutter commands to work even when Android SDK tools are not in PATH (typical macOS/Linux setup).
Move package name extraction logic from ReflutterPatcher to utils/apk.py to make it reusable across the codebase. Changes: - Add get_package_name() function in utils/apk.py - Use multiple methods: aapt, pyaxmlparser, filename heuristic - Update ReflutterPatcher to use centralized function - Remove duplicate package extraction code This allows other modules (like APKPatcher or future commands) to easily extract package names from APK files using the same reliable logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements automated Flutter app instrumentation using reFlutter for Dart code dumping, replicating the
flutter_setup.shbash script functionality with native Python integration.Commands
batuta flutter patch <package|apk>Full instrumentation workflow:
--force)--waitfor manual start)<package>_dump.dartbatuta flutter dump <package>Extract Dart code from already-instrumented app.
Files Changed
src/batuta/models/flutter.pyFlutterPatchResult,DumpResultmodelssrc/batuta/core/reflutter.pyReflutterPatcherbusiness logicsrc/batuta/cli/flutter.pysrc/batuta/exceptions.pyFlutterError,ReflutterError,DartDumpErrorsrc/batuta/utils/deps.pysrc/batuta/utils/process.pycwdparameter torun_tool()README.mdAGENTS.mdExample Usage
Requirements
pip install reflutterKey Features
--forceoverride)--json)Testing
ruff) passesmypy) passes