mirror of
https://github.com/frida/frida-python
synced 2026-06-08 14:16:17 +00:00
72899a4315
Most use-cases will need to use some JS API that we're not bridging, so it's better to keep our bindings simple. It has also become clear that our CLI tools should be split out so Frida-based tools don't have to depend on colorama, prompt_toolkit, and pygments.
28 lines
643 B
Python
28 lines
643 B
Python
#
|
|
# Compile example.dylib like this:
|
|
# $ clang -shared example.c -o example.dylib
|
|
#
|
|
# Then run:
|
|
# $ python inject_blob.py Twitter example.dylib
|
|
#
|
|
|
|
from __future__ import unicode_literals, print_function
|
|
|
|
import sys
|
|
|
|
import frida
|
|
|
|
|
|
def on_uninjected(id):
|
|
print("on_uninjected id=%u" % id)
|
|
|
|
(target, library_path) = sys.argv[1:]
|
|
|
|
device = frida.get_local_device()
|
|
device.on("uninjected", on_uninjected)
|
|
with open(library_path, "rb") as library_file:
|
|
library_blob = library_file.read()
|
|
id = device.inject_library_blob(target, library_blob, "example_main", "w00t")
|
|
print("*** Injected, id=%u -- hit Ctrl+D to exit!" % id)
|
|
sys.stdin.read()
|