mirror of
https://github.com/frida/frida-python.git
synced 2026-11-11 10:01:27 -10:00
Compare commits
No files matched your search
@@ -1,4 +1,4 @@
|
||||
PYTHON ?= $(shell which python3 >/dev/null && echo python3 || echo python)
|
||||
PYTHON ?= $(shell command -v python3 >/dev/null && echo python3 || echo python)
|
||||
|
||||
all $(MAKECMDGOALS):
|
||||
@$(PYTHON) \
|
||||
@@ -8,7 +8,7 @@ all $(MAKECMDGOALS):
|
||||
$(MAKECMDGOALS)
|
||||
|
||||
git-submodules:
|
||||
@if [ ! -f releng/meson/meson.py ] || [ ! -f frida-bindgen/frida_bindgen_core/model.py ]; then \
|
||||
@if [ ! -f releng/meson/meson.py ] || git submodule status 2>/dev/null | grep -q '^-'; then \
|
||||
git submodule update --init --recursive --depth 1; \
|
||||
fi
|
||||
-include git-submodules
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -z "$PYTHON" ] && PYTHON=$(which python3 >/dev/null && echo python3 || echo python)
|
||||
[ -z "$PYTHON" ] && PYTHON=$(command -v python3 >/dev/null && echo python3 || echo python)
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
srcroot=$(pwd)
|
||||
|
||||
if [ ! -f releng/meson/meson.py ]; then
|
||||
if [ ! -f releng/meson/meson.py ] || git submodule status 2>/dev/null | grep -q '^-'; then
|
||||
git submodule update --init --recursive --depth 1 || exit $?
|
||||
fi
|
||||
|
||||
|
||||
@@ -42,8 +42,7 @@ class Application:
|
||||
print("✔ enable_child_gating()")
|
||||
session.enable_child_gating()
|
||||
print("✔ create_script()")
|
||||
script = session.create_script(
|
||||
"""\
|
||||
script = session.create_script("""\
|
||||
Interceptor.attach(Module.getGlobalExportByName('open'), {
|
||||
onEnter(args) {
|
||||
send({
|
||||
@@ -52,8 +51,7 @@ Interceptor.attach(Module.getGlobalExportByName('open'), {
|
||||
});
|
||||
}
|
||||
});
|
||||
"""
|
||||
)
|
||||
""")
|
||||
script.on("message", lambda message, data: self._reactor.schedule(lambda: self._on_message(pid, message)))
|
||||
print("✔ load()")
|
||||
script.load()
|
||||
|
||||
+2
-4
@@ -1,8 +1,7 @@
|
||||
import frida
|
||||
|
||||
session = frida.attach("Twitter")
|
||||
script = session.create_script(
|
||||
"""\
|
||||
script = session.create_script("""\
|
||||
rpc.exports = {
|
||||
hello: function () {
|
||||
return 'Hello';
|
||||
@@ -11,8 +10,7 @@ rpc.exports = {
|
||||
oops;
|
||||
}
|
||||
};
|
||||
"""
|
||||
)
|
||||
""")
|
||||
script.load()
|
||||
api = script.exports_sync
|
||||
print("api.hello() =>", api.hello())
|
||||
|
||||
@@ -22,8 +22,7 @@ class Application:
|
||||
self._session = session
|
||||
session.on("detached", lambda *args: self._reactor.schedule(lambda: self._on_detached(*args)))
|
||||
|
||||
script = session.create_script(
|
||||
"""
|
||||
script = session.create_script("""
|
||||
let _puts = null;
|
||||
|
||||
Interceptor.attach(DebugSymbol.getFunctionByName('f'), {
|
||||
@@ -48,8 +47,7 @@ function puts(s) {
|
||||
}
|
||||
_puts(Memory.allocUtf8String(s));
|
||||
}
|
||||
"""
|
||||
)
|
||||
""")
|
||||
self._script = script
|
||||
script.on("message", lambda *args: self._reactor.schedule(lambda: self._on_message(*args)))
|
||||
script.load()
|
||||
|
||||
@@ -29,8 +29,7 @@ class Application:
|
||||
session = self._device.attach(pid)
|
||||
session.on("detached", lambda reason: self._reactor.schedule(lambda: self._on_detached(pid, session, reason)))
|
||||
print("✔ create_script()")
|
||||
script = session.create_script(
|
||||
"""\
|
||||
script = session.create_script("""\
|
||||
const puts = new NativeFunction(Module.getGlobalExportByName('puts'), 'int', ['pointer']);
|
||||
puts(Memory.allocUtf8String('Hello from Frida agent'));
|
||||
Interceptor.attach(Module.getGlobalExportByName('open'), {
|
||||
@@ -41,8 +40,7 @@ Interceptor.attach(Module.getGlobalExportByName('open'), {
|
||||
});
|
||||
}
|
||||
});
|
||||
"""
|
||||
)
|
||||
""")
|
||||
script.on("message", lambda message, data: self._reactor.schedule(lambda: self._on_message(pid, message)))
|
||||
print("✔ load()")
|
||||
script.load()
|
||||
|
||||
Generated
+4
-4
@@ -9,7 +9,7 @@
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"core-js": "^3.6.5",
|
||||
"dbus-next": "frida/node-dbus-next",
|
||||
"dbus-next": "frida-forks/node-dbus-next",
|
||||
"duplexify": "^4.1.1",
|
||||
"vue": "^2.6.11",
|
||||
"vue-class-component": "^7.2.3",
|
||||
@@ -6509,7 +6509,7 @@
|
||||
},
|
||||
"node_modules/dbus-next": {
|
||||
"version": "0.9.2",
|
||||
"resolved": "git+ssh://[email protected]/frida/node-dbus-next.git#0e12559b2298c140916541f57fdf9f83cf0b7975",
|
||||
"resolved": "git+ssh://[email protected]/frida-forks/node-dbus-next.git#0e12559b2298c140916541f57fdf9f83cf0b7975",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@nornagon/put": "0.0.8",
|
||||
@@ -20437,8 +20437,8 @@
|
||||
"peer": true
|
||||
},
|
||||
"dbus-next": {
|
||||
"version": "git+ssh://[email protected]/frida/node-dbus-next.git#0e12559b2298c140916541f57fdf9f83cf0b7975",
|
||||
"from": "dbus-next@frida/node-dbus-next",
|
||||
"version": "git+ssh://[email protected]/frida-forks/node-dbus-next.git#0e12559b2298c140916541f57fdf9f83cf0b7975",
|
||||
"from": "dbus-next@frida-forks/node-dbus-next",
|
||||
"requires": {
|
||||
"@nornagon/put": "0.0.8",
|
||||
"abstract-socket": "^2.0.0",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": "^3.6.5",
|
||||
"dbus-next": "frida/node-dbus-next",
|
||||
"dbus-next": "frida-forks/node-dbus-next",
|
||||
"duplexify": "^4.1.1",
|
||||
"vue": "^2.6.11",
|
||||
"vue-class-component": "^7.2.3",
|
||||
|
||||
@@ -964,7 +964,9 @@ def generate_extension_c(model: Model) -> str:
|
||||
|
||||
code += generate_object_type_constructor(otype)
|
||||
for ctor in factory_constructors(otype):
|
||||
code += generate_factory_function(otype, ctor, build_constructor_marshals(ctor))
|
||||
marshals = build_constructor_marshals(ctor)
|
||||
assert marshals is not None
|
||||
code += generate_factory_function(otype, ctor, marshals)
|
||||
|
||||
return code
|
||||
|
||||
@@ -1303,15 +1305,13 @@ def generate_object_type_toplevel_definitions(model: Model) -> str:
|
||||
cprefix = otype.c_symbol_prefix
|
||||
|
||||
if otype.name == "Object":
|
||||
defs.append(
|
||||
f"""PYFRIDA_DEFINE_BASETYPE ("_frida.{otype.py_name}", {otype.py_name}, g_object_unref,
|
||||
defs.append(f"""PYFRIDA_DEFINE_BASETYPE ("_frida.{otype.py_name}", {otype.py_name}, g_object_unref,
|
||||
{{ Py_tp_doc, "{otype.name}" }},
|
||||
{{ Py_tp_init, {cprefix}_init }},
|
||||
{{ Py_tp_dealloc, {cprefix}_dealloc }},
|
||||
{{ Py_tp_methods, {cprefix}_methods }},
|
||||
{{ Py_tp_getset, {cprefix}_getsets }},
|
||||
);"""
|
||||
)
|
||||
);""")
|
||||
continue
|
||||
|
||||
parent = otype.parent
|
||||
@@ -1331,14 +1331,12 @@ def generate_object_type_toplevel_definitions(model: Model) -> str:
|
||||
)
|
||||
continue
|
||||
|
||||
defs.append(
|
||||
f"""PYFRIDA_DEFINE_TYPE ("_frida.{otype.py_name}", {otype.py_name}, {parent_name}, g_object_unref,
|
||||
defs.append(f"""PYFRIDA_DEFINE_TYPE ("_frida.{otype.py_name}", {otype.py_name}, {parent_name}, g_object_unref,
|
||||
{{ Py_tp_doc, "{otype.name}" }},
|
||||
{{ Py_tp_init, {cprefix}_init }},
|
||||
{{ Py_tp_methods, {cprefix}_methods }},
|
||||
{{ Py_tp_getset, {cprefix}_getsets }},
|
||||
);"""
|
||||
)
|
||||
);""")
|
||||
|
||||
return "\n\n".join(defs)
|
||||
|
||||
@@ -2768,12 +2766,10 @@ def generate_object_type_structs(model: Model) -> str:
|
||||
for otype in model.regular_object_types:
|
||||
if otype.name == "Object":
|
||||
continue
|
||||
structs.append(
|
||||
f"""struct _{otype.c_symbol_prefix}
|
||||
structs.append(f"""struct _{otype.c_symbol_prefix}
|
||||
{{
|
||||
{otype.parent_c_symbol_prefix} parent;
|
||||
}};"""
|
||||
)
|
||||
}};""")
|
||||
|
||||
return "\n\n".join(structs)
|
||||
|
||||
|
||||
+1
-1
Submodule releng updated: 4e51c61880...564352a3ea.
@@ -1,6 +1,6 @@
|
||||
[wrap-git]
|
||||
url = https://github.com/frida/frida-core.git
|
||||
revision = 17.23.3
|
||||
revision = 17.25.1
|
||||
depth = 1
|
||||
|
||||
[provide]
|
||||
|
||||
Reference in new issue
Block a user