Skip to main content

A python API in order to install and run the frida-server on an Android device.

Project description

PyPI version

AndroidFridaManager

AndroidFridaManager is a Python API designed to simplify the installation and management of Frida on Android devices. It provides an easy-to-use interface for installing and running the latest Frida server, as well as the flexibility to install specific versions as needed.

Key features:

  • Frida Server Management: Seamlessly install and run the latest Frida server on your Android device, or choose to install a specific version as required.
  • Job Management: Execute Frida scripts as independent jobs, managed by the JobManager(). This feature allows for concurrent execution of multiple Frida scripts, with each job running in its own thread.
  • afrim Tool Integration: Utilize the afrim tool to check for existing Frida server installations on your device and ensure you are always running the latest version.

The project was inspired by Frida-Python-Binding.

Install

Just install it via pip:

python3 -m pip install AndroidFridaManager

This will install the afrim-command to your system.

Usage

In order to easily install the latest frida-server version to your Android device just run the following command:

$ afrim 

In order to check only if frida-server is running invoke it with the -r-parameter:

$ afrim -r

API Usage

In order to install and run Frida on your Android device use the FridaManager-API:

from AndroidFridaManager import FridaManager
...
afm_obj = FridaManager(is_remote=False, socket="ip:port", verbose=False, frida_install_dst="/data/local/tmp/")
afm_obj.install_frida_server()
afm_obj.run_frida_server()

For running Frida scripts as jobs use the JobManager-API:

from AndroidFridaManager import JobManager
...
app_package = "net.classwindexampleyear.bookseapiececountry"
frida_script_path = "./frida_script1.js"
job_manager = JobManager()
job_manager.setup_frida_session(app_package, myAwesomeHookingHandler)
job_manager.start_job(frida_script_path, myAwesomeHookingHandler)
print("Running jobs:", job_manager.running_jobs())
job_manager.stop_app_with_closing_frida(app_package)

The setup_frida_session() function accepts a callback function as its second parameter, typically provided by script.on('message', on_message). This initializes the first job and, by default, is the only job where you can activate child_gating and spawn_gating. To execute the job, you must invoke the start_job() function.

API

install_frida_server(dst_dir="/data/local/tmp/", version="latest")
run_frida_server()
is_frida_server_running()
stop_frida_server()
remove_frida_server()

# JobManager
JobManager(host="", enable_spawn_gating=False)
running_jobs() # list running jobs
start_android_app(package_name, main_activity = None, extras = None) # returns the PID of the start app
setup_frida_session(target_process, frida_callback_function, should_spawn=True,foreground=False)
start_job(frida_script_name, frida_callback_function)
stop_jobs() # stops all running jobs
stop_job_with_id(job_id) # stop only job with job_id
detach_from_app() # will also be invoked when running stop_app_with_closing_frida()
stop_app_with_closing_frida(app_package)
stop_app(app_package)
kill_app(pid)
setup_frida_handler(host="", enable_spawn_gating=False) # returns the device object and is used by setup_frida_session()

# setup_frida_handler,setup_frida_session will raise the FridaBasedException(Exception). Ensure to handle it

JobManager

The JobManager expect a running frida-serveron the target device.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

androidfridamanager-1.7.6.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

AndroidFridaManager-1.7.6-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file androidfridamanager-1.7.6.tar.gz.

File metadata

  • Download URL: androidfridamanager-1.7.6.tar.gz
  • Upload date:
  • Size: 25.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for androidfridamanager-1.7.6.tar.gz
Algorithm Hash digest
SHA256 57f58dae4a00eaa6e0285ad3f62576bd180c6fede4d538a8094130173a93883d
MD5 5a13934e7ccf058eee06953b69a1d4ce
BLAKE2b-256 f1ae608b6cf6b396df3d45418c698ecf1f627e00a596ae14f6a1692c9aeac5e1

See more details on using hashes here.

Provenance

File details

Details for the file AndroidFridaManager-1.7.6-py3-none-any.whl.

File metadata

File hashes

Hashes for AndroidFridaManager-1.7.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f6e05979da68683716d56a9c8197e4a081f58efe912618f27720fde6c12a9500
MD5 a105f9f0bd1bc7b4b19cb28c92d5d171
BLAKE2b-256 9688093dfe4da6b57b06f8492dfe10c8ebaa0edd76499236aacb989d4c244291

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page