Marrs is a Python package for Android Java apps researchers, built on top of tools like frida and
adb.
Using Marrs you can write Python code that modifies fields' value, calls methods, creates instances, hooks methods and
more.
- Python >= 3.7
- Connected device with USB Debugging enabled (or an Android emulator).
- Features involving frida require rooted device (
su
is required).
Using pip:
pip install marrs
Or from source:
git clone https://github.com/oran1248/marrs.git
cd marrs
python setup.py install
For full documentation, please see here.
NOTE: This code demonstrates the use of some of the features (there are many more)
import marrs
# Get connected device
device = marrs.get_device()
# Install app
app = device.install_app("testapp.apk")
# Attach frida agent to app (ROOT is required).
# If needed, will do some magic tricks in order to run frida server on the device and then will start the app.
agent = app.attach_frida_agent()
# Get class object
cls = agent.get_class("com.example.testapp.MyClass")
# Increment static field of type int by 1
cls.set_field(cls.get_field("intField") + 1)
# Create new instance of type MyClass
instance = cls.new(['someString', 2, 3])
# Get instance field value (can be primitive type or reference type)
fieldValue = instance.get("someField")
# Call an instance method
retVal = instance.call("someInstanceMethod", params = [cls.new(), fieldValue])
# Hook a method - first create your hook implementation function
def my_hook(params, orig_retval):
return 1337
# Create the hook
agent.hooks.add("com.example.testapp.MyClass", "someIntFunc", hook_impl=my_hook)
# num's value will be 1337
num = instance.call("someIntFunc", [1, 2])
For more examples, please refer to the docs or see the tests.
Marrs wasn't tested on all the platforms and devices.
If you run into a bug, you can open an issue, or even better than that - fix it and create a PR.
Steps for running the tests:
- Install
pytest
package:
pip install pytest
- Build
test-app
app - it's a simple android app used for testing Marrs:
cd test-app
gradlew build
- Install test-app's APK on a connected rooted device
- Run the tests:
cd misc
run_tests.bat
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the terms of GNU General Public License v3.0.