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
@@ -0,0 +1 @@
|
||||
github: frida
|
||||
@@ -3,7 +3,5 @@ import frida
|
||||
device = frida.get_usb_device()
|
||||
|
||||
diag = device.open_service("plist:com.apple.mobile.diagnostics_relay")
|
||||
diag.request({"type": "query", "payload": {"Request": "RSDCheckin", "ProtocolVersion": "2", "Label": "Frida"}})
|
||||
diag.request({"type": "read"})
|
||||
diag.request({"type": "query", "payload": {"Request": "Sleep", "WaitForDisconnect": True}})
|
||||
diag.request({"type": "query", "payload": {"Request": "Goodbye"}})
|
||||
@@ -0,0 +1,64 @@
|
||||
import pprint
|
||||
import sys
|
||||
from threading import Thread
|
||||
|
||||
import frida
|
||||
|
||||
|
||||
def main():
|
||||
device = frida.get_usb_device()
|
||||
|
||||
stdout_uuid, stdout_stream = create_stdio_socket(device)
|
||||
stderr_uuid, stderr_stream = create_stdio_socket(device)
|
||||
|
||||
appservice = device.open_service("xpc:com.apple.coredevice.appservice")
|
||||
response = appservice.request(
|
||||
{
|
||||
"CoreDevice.featureIdentifier": "com.apple.coredevice.feature.launchapplication",
|
||||
"CoreDevice.action": {},
|
||||
"CoreDevice.input": {
|
||||
"applicationSpecifier": {
|
||||
"bundleIdentifier": {"_0": "no.oleavr.HelloIOS"},
|
||||
},
|
||||
"options": {
|
||||
"arguments": [],
|
||||
"environmentVariables": {},
|
||||
"standardIOUsesPseudoterminals": True,
|
||||
"startStopped": False,
|
||||
"terminateExisting": True,
|
||||
"user": {"active": True},
|
||||
"platformSpecificOptions": b'<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><dict/></plist>',
|
||||
},
|
||||
"standardIOIdentifiers": {
|
||||
"standardOutput": ("uuid", stdout_uuid),
|
||||
"standardError": ("uuid", stderr_uuid),
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
pprint.pp(response)
|
||||
|
||||
workers = set()
|
||||
for stream, sink in {(stdout_stream, sys.stdout), (stderr_stream, sys.stderr)}:
|
||||
t = Thread(target=process_console_output, args=(stream, sink))
|
||||
t.start()
|
||||
workers.add(t)
|
||||
for worker in workers:
|
||||
worker.join()
|
||||
|
||||
|
||||
def create_stdio_socket(device):
|
||||
stream = device.open_channel("tcp:com.apple.coredevice.openstdiosocket")
|
||||
return (stream.read_all(16), stream)
|
||||
|
||||
|
||||
def process_console_output(stream, sink):
|
||||
while True:
|
||||
chunk = stream.read(4096)
|
||||
if not chunk:
|
||||
break
|
||||
sink.write(chunk.decode("utf-8"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
File renamed without changes.
@@ -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
|
||||
|
||||
|
||||
@@ -774,4 +774,94 @@ class Compiler(Object):
|
||||
"""
|
||||
...
|
||||
|
||||
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
|
||||
+805
-211
File diff suppressed because it is too large.
Load diff
+110
-3
@@ -1557,7 +1557,7 @@ CompilerDiagnosticsCallback = Callable[[List[CompilerDiagnostic]], None]
|
||||
|
||||
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 +1567,20 @@ class Compiler:
|
||||
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,
|
||||
) -> str:
|
||||
kwargs = {"project_root": project_root, "source_maps": source_maps, "compression": compression}
|
||||
kwargs = {
|
||||
"project_root": project_root,
|
||||
"output_format": output_format,
|
||||
"bundle_format": bundle_format,
|
||||
"type_check": type_check,
|
||||
"source_maps": source_maps,
|
||||
"compression": compression,
|
||||
}
|
||||
_filter_missing_kwargs(kwargs)
|
||||
return self._impl.build(entrypoint, **kwargs)
|
||||
|
||||
@@ -1579,10 +1589,20 @@ class Compiler:
|
||||
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,
|
||||
) -> None:
|
||||
kwargs = {"project_root": project_root, "source_maps": source_maps, "compression": compression}
|
||||
kwargs = {
|
||||
"project_root": project_root,
|
||||
"output_format": output_format,
|
||||
"bundle_format": bundle_format,
|
||||
"type_check": type_check,
|
||||
"source_maps": source_maps,
|
||||
"compression": compression,
|
||||
}
|
||||
_filter_missing_kwargs(kwargs)
|
||||
return self._impl.watch(entrypoint, **kwargs)
|
||||
|
||||
@@ -1623,6 +1643,93 @@ class Compiler:
|
||||
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)
|
||||
|
||||
@overload
|
||||
def on(self, signal: Literal["install-progress"], callback: PackageManagerInstallProgressCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def on(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
self._impl.on(signal, callback)
|
||||
|
||||
@overload
|
||||
def off(self, signal: Literal["install-progress"], callback: PackageManagerInstallProgressCallback) -> None: ...
|
||||
|
||||
@overload
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
|
||||
|
||||
def off(self, signal: str, callback: Callable[..., Any]) -> None:
|
||||
self._impl.off(signal, callback)
|
||||
|
||||
|
||||
class CancellablePollFD:
|
||||
def __init__(self, cancellable: _Cancellable) -> None:
|
||||
self.handle = cancellable.get_fd()
|
||||
|
||||
+1
-1
Submodule releng updated: b0e46f7b69...c24becede0.
@@ -1,6 +1,6 @@
|
||||
[wrap-git]
|
||||
url = https://github.com/frida/frida-core.git
|
||||
revision = 16.3.0
|
||||
revision = 17.3.2
|
||||
depth = 1
|
||||
|
||||
[provide]
|
||||
|
||||
Reference in new issue
Block a user