mirror of
https://github.com/frida/frida-python
synced 2026-06-08 14:16:17 +00:00
Compare commits
278 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0a9995df51 | |||
| 0f3ffd4032 | |||
| 2da64cb7ca | |||
| f81c3183a1 | |||
| d2861db65b | |||
| 06210bec40 | |||
| 4934e18a0e | |||
| fe987827e9 | |||
| 0ef38236e8 | |||
| 0fab765f91 | |||
| a6c02cb7ee | |||
| 6033dd0904 | |||
| 77e94e24a1 | |||
| c97343dc83 | |||
| e1ffe5fd50 | |||
| c7314098c6 | |||
| 41d769fa4d | |||
| 044d23eef7 | |||
| 1641af6ca3 | |||
| e513eca572 | |||
| 15260bfa4a | |||
| dec8aca9ae | |||
| 8c69b9d032 | |||
| f57b0c1cfa | |||
| fd2c1f2424 | |||
| a9caf62a0c | |||
| 8bc4415f34 | |||
| e3eca3179c | |||
| ef190d9957 | |||
| 1e06ebe9a3 | |||
| 925378439c | |||
| 7ae323a3cd | |||
| 9c5985c254 | |||
| b469134be4 | |||
| 9933d916ae | |||
| 09cac4e2a5 | |||
| 6b49e14ce1 | |||
| 7711fa12ac | |||
| d468dc038c | |||
| 58ff000596 | |||
| 3652e985d8 | |||
| 210c56e1b2 | |||
| b3d6aa8ffe | |||
| 16eb645844 | |||
| b7b1fcf0ff | |||
| 978b756134 | |||
| 7b1fc43a42 | |||
| 244cf6926b | |||
| 24b941fb8a | |||
| e2b340eda1 | |||
| 2b306c6d30 | |||
| 57cee13b43 | |||
| 23aa442826 | |||
| 65236f3b05 | |||
| e52e7a95bd | |||
| 3b57222cfa | |||
| 319ac9e699 | |||
| 2e842a4e44 | |||
| f9bf571497 | |||
| 8f50f743e1 | |||
| 6da337df6f | |||
| e29d41806c | |||
| 8faf01dc2e | |||
| 4286667bc6 | |||
| 86d4b4b4bf | |||
| b5808d7b27 | |||
| 5466050755 | |||
| 4db854a02c | |||
| cc9a78ef19 | |||
| 22ed1fac3c | |||
| 9b15bde24e | |||
| a613d87b08 | |||
| 9ef240eff4 | |||
| 43a443f582 | |||
| dcc95216fd | |||
| 69e7c6c0ce | |||
| 3278173be8 | |||
| d8fa422062 | |||
| 3943d2eed2 | |||
| 8030b5aa68 | |||
| fa5f378176 | |||
| a814a4aa9b | |||
| a48ff22b6f | |||
| eb4f8d37f3 | |||
| 60a4a032d6 | |||
| 9f46dfaa80 | |||
| e57ca181f8 | |||
| 0fccd75bc7 | |||
| dea4ffb1c9 | |||
| da17d3badb | |||
| 33922241fc | |||
| fb8fdbb231 | |||
| 0f50b58a04 | |||
| f63ea5903f | |||
| a99767e501 | |||
| 07bbd3d488 | |||
| 81403cf383 | |||
| 2ea0b944a2 | |||
| 35c412c6cf | |||
| ec4524d155 | |||
| d9d53a89cc | |||
| dfb002de49 | |||
| 0f56e44abd | |||
| d28a2a4988 | |||
| 1fc39289ef | |||
| 2c757a08f3 | |||
| fc735c048f | |||
| 4d84536160 | |||
| 9e51c78c5c | |||
| a6d51e8384 | |||
| 3e80ed726d | |||
| 985410b6ff | |||
| 21c7b9ee6a | |||
| 7fba1cdc67 | |||
| a709856e2a | |||
| c3afe6089d | |||
| 6435a78d13 | |||
| 09175036ea | |||
| e0c90c5203 | |||
| 9f463fb602 | |||
| 9fdee2270f | |||
| 6e536a56b1 | |||
| 74925d082e | |||
| bf1245ddb0 | |||
| 0f247e9439 | |||
| 17aae5fe5c | |||
| 477a90534e | |||
| c87cdca293 | |||
| 30968b3805 | |||
| 5e3f27d0cb | |||
| 904461eb01 | |||
| dc652faa90 | |||
| f5ba22ad36 | |||
| dccb6810ca | |||
| 82441c6d61 | |||
| 323dca48c2 | |||
| ef71f0fa92 | |||
| e92e829f6d | |||
| 5793fb5528 | |||
| cac6993d87 | |||
| 714b7f8626 | |||
| ab0b9e98ae | |||
| 19a7fa4f45 | |||
| 38552a368a | |||
| 38724cab58 | |||
| b60d085ad9 | |||
| 1a4afbcc62 | |||
| 9e15cab647 | |||
| 9ef1c9c1f7 | |||
| 3da6af4759 | |||
| a9075822b1 | |||
| 2e61509c04 | |||
| aa9396c6b0 | |||
| 6530b2a7d4 | |||
| 2d833af062 | |||
| 9f6ab2d384 | |||
| a005f1bf4c | |||
| 59a24aa48f | |||
| 782d626419 | |||
| 3aa122f4fd | |||
| ef315fc0ad | |||
| daf93eea54 | |||
| 5d02a36906 | |||
| ba8daa423d | |||
| afb27bfa7c | |||
| 93a201acf2 | |||
| ca1cdad96a | |||
| fbc83cc9bf | |||
| b838e1df9a | |||
| e2409be987 | |||
| b061ea43d2 | |||
| a50a62999a | |||
| 3a47d33ee8 | |||
| ea93d827bb | |||
| 8d4c05f664 | |||
| 2f78c96622 | |||
| 4b5aa28119 | |||
| 4f87afa0f1 | |||
| 82272945ac | |||
| bf496a81d9 | |||
| c2dcae3ff4 | |||
| 0cb42c47dc | |||
| 0e3a9fb551 | |||
| 4e16e5c667 | |||
| 09d6c7b044 | |||
| e11efce5c2 | |||
| e174be9998 | |||
| eae3d1dc65 | |||
| 2d26b94c7d | |||
| f396958dfe | |||
| 93fb33206f | |||
| aed3c1b7bf | |||
| 690da0652d | |||
| bec6221c02 | |||
| 53479e1814 | |||
| 68bc65ecd4 | |||
| 6492081c92 | |||
| 262b984e23 | |||
| 730ec03652 | |||
| 25f96f92d3 | |||
| dec23f9ef5 | |||
| 906d27bcb7 | |||
| b0018c9812 | |||
| 5e011e6d64 | |||
| b68dda4eb5 | |||
| 6fbe238c1a | |||
| 4d750dfe58 | |||
| fe1c61ce5d | |||
| ea91df0d77 | |||
| b78ae7555f | |||
| b456683f2d | |||
| ddfe2b1a3b | |||
| 329795dbfc | |||
| e9c62fd581 | |||
| 40e945107d | |||
| 6c27bf0da7 | |||
| d37451f3bc | |||
| 6d4e4e27ee | |||
| 33a9c51387 | |||
| 4344eb9220 | |||
| 3a94e642d7 | |||
| 7a5948a95a | |||
| bbe926c606 | |||
| b653958fa4 | |||
| bca5146b74 | |||
| 2bd254702c | |||
| 82ee16d299 | |||
| 51501ceacb | |||
| ef45347385 | |||
| 0024f6719a | |||
| 87de091250 | |||
| cf4870e13d | |||
| 2ac00cb1e2 | |||
| dd94c73d4f | |||
| 40eb2dae38 | |||
| 73004f9598 | |||
| a0e9e64346 | |||
| 2706e19615 | |||
| 6edaf679ac | |||
| c2c45ce231 | |||
| 0180450178 | |||
| e07370158d | |||
| f73fdff4ee | |||
| b565fa19dc | |||
| 58d5ea9e2f | |||
| 91826487e1 | |||
| b1abfd53fa | |||
| 1afde6cb34 | |||
| 6bee5f45f3 | |||
| efc1009ece | |||
| 3def865cf8 | |||
| 3c41862ac5 | |||
| 4bd11602d7 | |||
| d07c8a16cd | |||
| 4e6d28cba7 | |||
| e0562ed0bc | |||
| 9dc17772cd | |||
| 0f9f4a5da8 | |||
| 4a9fb75adf | |||
| c37ef15695 | |||
| f6ad8a504d | |||
| 808e4ab6b5 | |||
| 50ee91f63f | |||
| 56dc49b5fb | |||
| 4cbb5881bd | |||
| 6ff0e34ca3 | |||
| 4df903dca5 | |||
| 6ed81cbfb6 | |||
| 98cc4c44bc | |||
| 6190b3c57b | |||
| 212973bbc1 | |||
| 79f7ae1deb | |||
| 522366a55e | |||
| 8017d10e3e | |||
| e78a5fd3b3 | |||
| 5cbef2fb1f | |||
| 8694918de7 | |||
| ab16fe04c5 |
@@ -42,18 +42,16 @@ class Application:
|
||||
print("✔ enable_child_gating()")
|
||||
session.enable_child_gating()
|
||||
print("✔ create_script()")
|
||||
script = session.create_script(
|
||||
"""\
|
||||
Interceptor.attach(Module.getExportByName(null, 'open'), {
|
||||
onEnter: function (args) {
|
||||
script = session.create_script("""\
|
||||
Interceptor.attach(Module.getGlobalExportByName('open'), {
|
||||
onEnter(args) {
|
||||
send({
|
||||
type: 'open',
|
||||
path: Memory.readUtf8String(args[0])
|
||||
path: args[0].readUtf8String()
|
||||
});
|
||||
}
|
||||
});
|
||||
"""
|
||||
)
|
||||
""")
|
||||
script.on("message", lambda message, data: self._reactor.schedule(lambda: self._on_message(pid, message)))
|
||||
print("✔ load()")
|
||||
script.load()
|
||||
|
||||
@@ -15,7 +15,7 @@ def on_uninjected(id):
|
||||
print("on_uninjected id=%u" % id)
|
||||
|
||||
|
||||
(target, library_path) = sys.argv[1:]
|
||||
target, library_path = sys.argv[1:]
|
||||
|
||||
device = frida.get_local_device()
|
||||
device.on("uninjected", on_uninjected)
|
||||
|
||||
@@ -15,7 +15,7 @@ def on_uninjected(id):
|
||||
print("on_uninjected id=%u" % id)
|
||||
|
||||
|
||||
(target, library_path) = sys.argv[1:]
|
||||
target, library_path = sys.argv[1:]
|
||||
|
||||
device = frida.get_local_device()
|
||||
device.on("uninjected", on_uninjected)
|
||||
|
||||
+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()
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import threading
|
||||
|
||||
from frida_tools.application import Reactor
|
||||
|
||||
import frida
|
||||
|
||||
|
||||
class Application:
|
||||
def __init__(self):
|
||||
self._stop_requested = threading.Event()
|
||||
self._reactor = Reactor(run_until_return=lambda reactor: self._stop_requested.wait())
|
||||
|
||||
self._device = frida.get_usb_device()
|
||||
self._sessions = set()
|
||||
self._sessions_lock = threading.Lock()
|
||||
|
||||
self._device.on("spawn-added", lambda spawn: self._reactor.schedule(lambda: self._on_spawn_added(spawn)))
|
||||
self._device.on("spawn-removed", lambda spawn: self._reactor.schedule(lambda: self._on_spawn_removed(spawn)))
|
||||
|
||||
def run(self):
|
||||
self._reactor.schedule(lambda: self._start())
|
||||
self._reactor.run()
|
||||
|
||||
def _start(self):
|
||||
self._device.enable_spawn_gating()
|
||||
|
||||
def _instrument(self, pid):
|
||||
print(f"✔ attach(pid={pid})")
|
||||
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("""\
|
||||
const puts = new NativeFunction(Module.getGlobalExportByName('puts'), 'int', ['pointer']);
|
||||
puts(Memory.allocUtf8String('Hello from Frida agent'));
|
||||
Interceptor.attach(Module.getGlobalExportByName('open'), {
|
||||
onEnter(args) {
|
||||
send({
|
||||
type: 'open',
|
||||
path: args[0].readUtf8String()
|
||||
});
|
||||
}
|
||||
});
|
||||
""")
|
||||
script.on("message", lambda message, data: self._reactor.schedule(lambda: self._on_message(pid, message)))
|
||||
print("✔ load()")
|
||||
script.load()
|
||||
print(f"✔ resume(pid={pid})")
|
||||
self._device.resume(pid)
|
||||
with self._sessions_lock:
|
||||
self._sessions.add(session)
|
||||
|
||||
def _on_spawn_added(self, spawn):
|
||||
print(f"⚡ spawn_added: {spawn}")
|
||||
t = threading.Thread(target=self._handle_spawn, args=(spawn,))
|
||||
t.start()
|
||||
|
||||
def _handle_spawn(self, spawn):
|
||||
if "/bin/ls" in spawn.identifier:
|
||||
self._instrument(spawn.pid)
|
||||
else:
|
||||
pid = spawn.pid
|
||||
print(f"✔ resume(pid={pid})")
|
||||
self._device.resume(pid)
|
||||
|
||||
def _on_spawn_removed(self, spawn):
|
||||
print(f"⚡ spawn_removed: {spawn}")
|
||||
|
||||
def _on_detached(self, pid, session, reason):
|
||||
print(f"⚡ detached: pid={pid}, reason='{reason}'")
|
||||
with self._sessions_lock:
|
||||
self._sessions.remove(session)
|
||||
|
||||
def _on_message(self, pid, message):
|
||||
print(f"⚡ message: pid={pid}, payload={message['payload']}")
|
||||
|
||||
|
||||
app = Application()
|
||||
app.run()
|
||||
@@ -23,6 +23,7 @@ Relay = _frida.Relay
|
||||
PortalService = core.PortalService
|
||||
EndpointParameters = core.EndpointParameters
|
||||
Compiler = core.Compiler
|
||||
PackageManager = core.PackageManager
|
||||
FileMonitor = _frida.FileMonitor
|
||||
Cancellable = core.Cancellable
|
||||
|
||||
|
||||
@@ -754,8 +754,13 @@ class Compiler(Object):
|
||||
self,
|
||||
entrypoint: str,
|
||||
project_root: Optional[str] = None,
|
||||
output_format: Optional[str] = None,
|
||||
bundle_format: Optional[str] = None,
|
||||
type_check: Optional[str] = None,
|
||||
source_maps: Optional[str] = None,
|
||||
compression: Optional[str] = None,
|
||||
platform: Optional[str] = None,
|
||||
externals: Optional[Sequence[str]] = None,
|
||||
) -> str:
|
||||
"""
|
||||
Build an agent.
|
||||
@@ -766,12 +771,107 @@ class Compiler(Object):
|
||||
self,
|
||||
entrypoint: str,
|
||||
project_root: Optional[str] = None,
|
||||
output_format: Optional[str] = None,
|
||||
bundle_format: Optional[str] = None,
|
||||
type_check: Optional[str] = None,
|
||||
source_maps: Optional[str] = None,
|
||||
compression: Optional[str] = None,
|
||||
platform: Optional[str] = None,
|
||||
externals: Optional[Sequence[str]] = None,
|
||||
) -> None:
|
||||
"""
|
||||
Continuously build an agent.
|
||||
"""
|
||||
...
|
||||
|
||||
class PackageManager(Object):
|
||||
@property
|
||||
def registry(self) -> str:
|
||||
"""
|
||||
The registry being used.
|
||||
"""
|
||||
...
|
||||
|
||||
@registry.setter
|
||||
def registry(self, value: str) -> None:
|
||||
"""
|
||||
Change the registry to use.
|
||||
"""
|
||||
...
|
||||
|
||||
def search(
|
||||
self,
|
||||
query: str,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
) -> PackageSearchResult:
|
||||
"""
|
||||
Search for packages to install.
|
||||
"""
|
||||
...
|
||||
|
||||
def install(
|
||||
self,
|
||||
project_root: Optional[str] = None,
|
||||
role: Optional[str] = None,
|
||||
specs: Optional[Sequence[str]] = None,
|
||||
omits: Optional[Sequence[str]] = None,
|
||||
) -> PackageInstallResult:
|
||||
"""
|
||||
Install one or more packages.
|
||||
"""
|
||||
...
|
||||
|
||||
class Package(Object):
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""
|
||||
Package name.
|
||||
"""
|
||||
...
|
||||
|
||||
@property
|
||||
def version(self) -> str:
|
||||
"""
|
||||
Package version.
|
||||
"""
|
||||
...
|
||||
|
||||
@property
|
||||
def description(self) -> Optional[str]:
|
||||
"""
|
||||
Package description.
|
||||
"""
|
||||
...
|
||||
|
||||
@property
|
||||
def url(self) -> Optional[str]:
|
||||
"""
|
||||
Package URL.
|
||||
"""
|
||||
...
|
||||
|
||||
class PackageSearchResult(Object):
|
||||
@property
|
||||
def packages(self) -> List[Package]:
|
||||
"""
|
||||
Batch of matching packages.
|
||||
"""
|
||||
...
|
||||
|
||||
@property
|
||||
def total(self) -> int:
|
||||
"""
|
||||
Total matching packages.
|
||||
"""
|
||||
...
|
||||
|
||||
class PackageInstallResult(Object):
|
||||
@property
|
||||
def packages(self) -> List[Package]:
|
||||
"""
|
||||
The toplevel packages that are installed.
|
||||
"""
|
||||
...
|
||||
|
||||
__version__: str
|
||||
|
||||
+773
-33
File diff suppressed because it is too large
Load Diff
+151
-68
@@ -33,10 +33,15 @@ if sys.version_info >= (3, 8):
|
||||
else:
|
||||
from typing_extensions import Literal, TypedDict
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import NotRequired
|
||||
if sys.version_info >= (3, 10):
|
||||
from typing import ParamSpec
|
||||
else:
|
||||
from typing_extensions import NotRequired
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import NotRequired, cast
|
||||
else:
|
||||
from typing_extensions import NotRequired, cast
|
||||
|
||||
from . import _frida
|
||||
|
||||
@@ -72,15 +77,18 @@ def _filter_missing_kwargs(d: MutableMapping[Any, Any]) -> None:
|
||||
d.pop(key)
|
||||
|
||||
|
||||
R = TypeVar("R")
|
||||
P = ParamSpec("P")
|
||||
R = TypeVar("R", covariant=True)
|
||||
|
||||
|
||||
def cancellable(f: Callable[..., R]) -> Callable[..., R]:
|
||||
def cancellable(f: Callable[P, R]) -> Callable[P, R]:
|
||||
# currently there is no way to type properly the extended callable with optional cancellable parameter
|
||||
# ref: https://github.com/python/typing/discussions/1905#discussioncomment-11696995
|
||||
@functools.wraps(f)
|
||||
def wrapper(*args: Any, **kwargs: Any) -> R:
|
||||
def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
|
||||
cancellable = kwargs.pop("cancellable", None)
|
||||
if cancellable is not None:
|
||||
with cancellable:
|
||||
with cast(Cancellable, cancellable):
|
||||
return f(*args, **kwargs)
|
||||
|
||||
return f(*args, **kwargs)
|
||||
@@ -351,9 +359,6 @@ class Script:
|
||||
@overload
|
||||
def on(self, signal: Literal["message"], callback: ScriptMessageCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
"""
|
||||
Add a signal handler
|
||||
@@ -370,9 +375,6 @@ class Script:
|
||||
@overload
|
||||
def off(self, signal: Literal["message"], callback: ScriptMessageCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
"""
|
||||
Remove a signal handler
|
||||
@@ -693,34 +695,22 @@ class Session:
|
||||
_filter_missing_kwargs(kwargs)
|
||||
return PortalMembership(self._impl.join_portal(address, **kwargs))
|
||||
|
||||
@overload
|
||||
def on(
|
||||
self,
|
||||
signal: Literal["detached"],
|
||||
callback: SessionDetachedCallback,
|
||||
) -> None: ...
|
||||
|
||||
@overload
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
) -> None:
|
||||
"""
|
||||
Add a signal handler
|
||||
"""
|
||||
|
||||
self._impl.on(signal, callback)
|
||||
|
||||
@overload
|
||||
def off(
|
||||
self,
|
||||
signal: Literal["detached"],
|
||||
callback: SessionDetachedCallback,
|
||||
) -> None: ...
|
||||
|
||||
@overload
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
) -> None:
|
||||
"""
|
||||
Remove a signal handler
|
||||
"""
|
||||
@@ -763,9 +753,6 @@ class Bus:
|
||||
@overload
|
||||
def on(self, signal: Literal["message"], callback: BusMessageCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
"""
|
||||
Add a signal handler
|
||||
@@ -782,9 +769,6 @@ class Bus:
|
||||
@overload
|
||||
def off(self, signal: Literal["message"], callback: BusMessageCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
"""
|
||||
Remove a signal handler
|
||||
@@ -842,9 +826,6 @@ class Service:
|
||||
@overload
|
||||
def on(self, signal: Literal["message"], callback: ServiceMessageCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
"""
|
||||
Add a signal handler
|
||||
@@ -858,9 +839,6 @@ class Service:
|
||||
@overload
|
||||
def off(self, signal: Literal["message"], callback: ServiceMessageCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
"""
|
||||
Remove a signal handler
|
||||
@@ -905,6 +883,14 @@ class Device:
|
||||
|
||||
return self._impl.is_lost()
|
||||
|
||||
@cancellable
|
||||
def override_option(self, name: str, value: Any) -> None:
|
||||
"""
|
||||
Override a backend-specific option
|
||||
"""
|
||||
|
||||
self._impl.override_option(name, value)
|
||||
|
||||
@cancellable
|
||||
def query_system_parameters(self) -> Dict[str, Any]:
|
||||
"""
|
||||
@@ -1144,9 +1130,6 @@ class Device:
|
||||
@overload
|
||||
def on(self, signal: Literal["lost"], callback: DeviceLostCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
"""
|
||||
Add a signal handler
|
||||
@@ -1178,9 +1161,6 @@ class Device:
|
||||
@overload
|
||||
def off(self, signal: Literal["lost"], callback: DeviceLostCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
"""
|
||||
Remove a signal handler
|
||||
@@ -1298,9 +1278,6 @@ class DeviceManager:
|
||||
@overload
|
||||
def on(self, signal: Literal["changed"], callback: DeviceManagerChangedCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
"""
|
||||
Add a signal handler
|
||||
@@ -1317,9 +1294,6 @@ class DeviceManager:
|
||||
@overload
|
||||
def off(self, signal: Literal["changed"], callback: DeviceManagerChangedCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
"""
|
||||
Remove a signal handler
|
||||
@@ -1344,7 +1318,7 @@ class EndpointParameters:
|
||||
_filter_missing_kwargs(kwargs)
|
||||
|
||||
if authentication is not None:
|
||||
(auth_scheme, auth_data) = authentication
|
||||
auth_scheme, auth_data = authentication
|
||||
if auth_scheme == "token":
|
||||
kwargs["auth_token"] = auth_data
|
||||
elif auth_scheme == "callback":
|
||||
@@ -1490,9 +1464,6 @@ class PortalService:
|
||||
@overload
|
||||
def on(self, signal: Literal["message"], callback: PortalServiceMessageCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
"""
|
||||
Add a signal handler
|
||||
@@ -1554,10 +1525,17 @@ CompilerFinishedCallback = Callable[[], None]
|
||||
CompilerOutputCallback = Callable[[str], None]
|
||||
CompilerDiagnosticsCallback = Callable[[List[CompilerDiagnostic]], None]
|
||||
|
||||
CompilerOutputFormat = Literal["unescaped", "hex-bytes", "c-string"]
|
||||
CompilerBundleFormat = Literal["esm", "iife"]
|
||||
CompilerTypeCheck = Literal["full", "none"]
|
||||
CompilerSourceMaps = Literal["included", "omitted"]
|
||||
CompilerCompression = Literal["none", "terser"]
|
||||
CompilerPlatform = Literal["neutral", "gum", "browser"]
|
||||
|
||||
|
||||
class Compiler:
|
||||
def __init__(self) -> None:
|
||||
self._impl = _frida.Compiler(get_device_manager()._impl)
|
||||
self._impl = _frida.Compiler()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return repr(self._impl)
|
||||
@@ -1567,10 +1545,24 @@ class Compiler:
|
||||
self,
|
||||
entrypoint: str,
|
||||
project_root: Optional[str] = None,
|
||||
source_maps: Optional[str] = None,
|
||||
compression: Optional[str] = None,
|
||||
output_format: Optional[CompilerOutputFormat] = None,
|
||||
bundle_format: Optional[CompilerBundleFormat] = None,
|
||||
type_check: Optional[CompilerTypeCheck] = None,
|
||||
source_maps: Optional[CompilerSourceMaps] = None,
|
||||
compression: Optional[CompilerCompression] = None,
|
||||
platform: Optional[CompilerPlatform] = None,
|
||||
externals: Optional[Sequence[str]] = None,
|
||||
) -> str:
|
||||
kwargs = {"project_root": project_root, "source_maps": source_maps, "compression": compression}
|
||||
kwargs: dict[str, Any] = {
|
||||
"project_root": project_root,
|
||||
"output_format": output_format,
|
||||
"bundle_format": bundle_format,
|
||||
"type_check": type_check,
|
||||
"source_maps": source_maps,
|
||||
"compression": compression,
|
||||
"platform": platform,
|
||||
"externals": externals,
|
||||
}
|
||||
_filter_missing_kwargs(kwargs)
|
||||
return self._impl.build(entrypoint, **kwargs)
|
||||
|
||||
@@ -1579,10 +1571,24 @@ class Compiler:
|
||||
self,
|
||||
entrypoint: str,
|
||||
project_root: Optional[str] = None,
|
||||
source_maps: Optional[str] = None,
|
||||
compression: Optional[str] = None,
|
||||
output_format: Optional[CompilerOutputFormat] = None,
|
||||
bundle_format: Optional[CompilerBundleFormat] = None,
|
||||
type_check: Optional[CompilerTypeCheck] = None,
|
||||
source_maps: Optional[CompilerSourceMaps] = None,
|
||||
compression: Optional[CompilerCompression] = None,
|
||||
platform: Optional[CompilerPlatform] = None,
|
||||
externals: Optional[Sequence[str]] = None,
|
||||
) -> None:
|
||||
kwargs = {"project_root": project_root, "source_maps": source_maps, "compression": compression}
|
||||
kwargs: dict[str, Any] = {
|
||||
"project_root": project_root,
|
||||
"output_format": output_format,
|
||||
"bundle_format": bundle_format,
|
||||
"type_check": type_check,
|
||||
"source_maps": source_maps,
|
||||
"compression": compression,
|
||||
"platform": platform,
|
||||
"externals": externals,
|
||||
}
|
||||
_filter_missing_kwargs(kwargs)
|
||||
return self._impl.watch(entrypoint, **kwargs)
|
||||
|
||||
@@ -1598,10 +1604,11 @@ class Compiler:
|
||||
@overload
|
||||
def on(self, signal: Literal["diagnostics"], callback: CompilerDiagnosticsCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
"""
|
||||
Add a signal handler
|
||||
"""
|
||||
|
||||
self._impl.on(signal, callback)
|
||||
|
||||
@overload
|
||||
@@ -1616,10 +1623,86 @@ class Compiler:
|
||||
@overload
|
||||
def off(self, signal: Literal["diagnostics"], callback: CompilerDiagnosticsCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
"""
|
||||
Remove a signal handler
|
||||
"""
|
||||
|
||||
self._impl.off(signal, callback)
|
||||
|
||||
|
||||
PackageManagerInstallProgressCallback = Callable[
|
||||
[
|
||||
Literal[
|
||||
"initializing",
|
||||
"preparing-dependencies",
|
||||
"resolving-package",
|
||||
"fetching-resource",
|
||||
"package-already-installed",
|
||||
"downloading-package",
|
||||
"package-installed",
|
||||
"resolving-and-installing-all",
|
||||
"complete",
|
||||
],
|
||||
float,
|
||||
Optional[str],
|
||||
],
|
||||
None,
|
||||
]
|
||||
|
||||
PackageRole = Literal["runtime", "development", "optional", "peer"]
|
||||
|
||||
|
||||
class PackageManager:
|
||||
def __init__(self) -> None:
|
||||
self._impl = _frida.PackageManager()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return repr(self._impl)
|
||||
|
||||
@property
|
||||
def registry(self):
|
||||
return self._impl.registry
|
||||
|
||||
@registry.setter
|
||||
def registry(self, value):
|
||||
self._impl.registry = value
|
||||
|
||||
@cancellable
|
||||
def search(
|
||||
self,
|
||||
query: str,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
) -> _frida.PackageSearchResult:
|
||||
kwargs = {
|
||||
"offset": offset,
|
||||
"limit": limit,
|
||||
}
|
||||
_filter_missing_kwargs(kwargs)
|
||||
return self._impl.search(query, **kwargs)
|
||||
|
||||
@cancellable
|
||||
def install(
|
||||
self,
|
||||
project_root: Optional[str] = None,
|
||||
role: Optional[PackageRole] = None,
|
||||
specs: Optional[Sequence[str]] = None,
|
||||
omits: Optional[Sequence[PackageRole]] = None,
|
||||
) -> _frida.PackageInstallResult:
|
||||
kwargs: Dict[str, Any] = {
|
||||
"project_root": project_root,
|
||||
"role": role,
|
||||
"specs": specs,
|
||||
"omits": omits,
|
||||
}
|
||||
_filter_missing_kwargs(kwargs)
|
||||
return self._impl.install(**kwargs)
|
||||
|
||||
def on(self, signal: Literal["install-progress"], callback: PackageManagerInstallProgressCallback) -> None:
|
||||
self._impl.on(signal, callback)
|
||||
|
||||
def off(self, signal: Literal["install-progress"], callback: PackageManagerInstallProgressCallback) -> None:
|
||||
self._impl.off(signal, callback)
|
||||
|
||||
|
||||
|
||||
+1
-1
Submodule releng updated: 2eecc41cbe...a76acfc2b5
@@ -1,6 +1,6 @@
|
||||
[wrap-git]
|
||||
url = https://github.com/frida/frida-core.git
|
||||
revision = 16.7.8
|
||||
revision = 17.9.11
|
||||
depth = 1
|
||||
|
||||
[provide]
|
||||
|
||||
Reference in New Issue
Block a user