mirror of
https://github.com/frida/frida-python.git
synced 2026-11-11 23:54:29 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7e22441ef |
No files matched your search
@@ -1,3 +1,27 @@
|
|||||||
|
static gboolean
|
||||||
|
PyGObject_unmarshal_certificate (const gchar * str,
|
||||||
|
GTlsCertificate ** certificate)
|
||||||
|
{
|
||||||
|
GError * error = NULL;
|
||||||
|
|
||||||
|
if (strchr (str, '\n') != NULL)
|
||||||
|
*certificate = g_tls_certificate_new_from_pem (str, -1, &error);
|
||||||
|
else
|
||||||
|
*certificate = g_tls_certificate_new_from_file (str, &error);
|
||||||
|
if (error != NULL)
|
||||||
|
goto propagate_error;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
propagate_error:
|
||||||
|
{
|
||||||
|
PyFrida_raise (g_error_new_literal (FRIDA_ERROR, FRIDA_ERROR_INVALID_ARGUMENT, error->message));
|
||||||
|
g_error_free (error);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
PyEndpointParameters_init (PyEndpointParameters * self,
|
PyEndpointParameters_init (PyEndpointParameters * self,
|
||||||
PyObject * args,
|
PyObject * args,
|
||||||
@@ -7,7 +31,7 @@ PyEndpointParameters_init (PyEndpointParameters * self,
|
|||||||
static char * keywords[] = { "address", "port", "certificate", "origin", "auth_service", "asset_root", NULL };
|
static char * keywords[] = { "address", "port", "certificate", "origin", "auth_service", "asset_root", NULL };
|
||||||
char * address = NULL;
|
char * address = NULL;
|
||||||
unsigned short int port = 0;
|
unsigned short int port = 0;
|
||||||
PyObject * certificate_value = NULL;
|
char * certificate_value = NULL;
|
||||||
char * origin = NULL;
|
char * origin = NULL;
|
||||||
PyObject * auth_service_obj = NULL;
|
PyObject * auth_service_obj = NULL;
|
||||||
char * asset_root_value = NULL;
|
char * asset_root_value = NULL;
|
||||||
@@ -19,10 +43,10 @@ PyEndpointParameters_init (PyEndpointParameters * self,
|
|||||||
if (PyGObject_tp_init ((PyObject *) self, args, kw) < 0)
|
if (PyGObject_tp_init ((PyObject *) self, args, kw) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords (args, kw, "|esHOesOes", keywords,
|
if (!PyArg_ParseTupleAndKeywords (args, kw, "|esHesesOes", keywords,
|
||||||
"utf-8", &address,
|
"utf-8", &address,
|
||||||
&port,
|
&port,
|
||||||
&certificate_value,
|
"utf-8", &certificate_value,
|
||||||
"utf-8", &origin,
|
"utf-8", &origin,
|
||||||
&auth_service_obj,
|
&auth_service_obj,
|
||||||
"utf-8", &asset_root_value))
|
"utf-8", &asset_root_value))
|
||||||
@@ -50,6 +74,7 @@ beach:
|
|||||||
|
|
||||||
PyMem_Free (asset_root_value);
|
PyMem_Free (asset_root_value);
|
||||||
PyMem_Free (origin);
|
PyMem_Free (origin);
|
||||||
|
PyMem_Free (certificate_value);
|
||||||
PyMem_Free (address);
|
PyMem_Free (address);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -1041,64 +1041,6 @@ PyGObject_marshal_variant_tuple (GVariant * variant)
|
|||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
PyGObject_unmarshal_certificate (PyObject * value,
|
|
||||||
GTlsCertificate ** certificate)
|
|
||||||
{
|
|
||||||
PyObject * bytes;
|
|
||||||
const gchar * str;
|
|
||||||
GError * error = NULL;
|
|
||||||
|
|
||||||
if (value == Py_None)
|
|
||||||
{
|
|
||||||
*certificate = NULL;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bytes = PyUnicode_AsUTF8String (value);
|
|
||||||
if (bytes == NULL)
|
|
||||||
return FALSE;
|
|
||||||
str = PyBytes_AsString (bytes);
|
|
||||||
|
|
||||||
if (strchr (str, '\n') != NULL)
|
|
||||||
*certificate = g_tls_certificate_new_from_pem (str, -1, &error);
|
|
||||||
else
|
|
||||||
*certificate = g_tls_certificate_new_from_file (str, &error);
|
|
||||||
|
|
||||||
Py_DecRef (bytes);
|
|
||||||
|
|
||||||
if (error != NULL)
|
|
||||||
goto propagate_error;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
propagate_error:
|
|
||||||
{
|
|
||||||
PyFrida_raise (g_error_new_literal (FRIDA_ERROR, FRIDA_ERROR_INVALID_ARGUMENT, error->message));
|
|
||||||
g_error_free (error);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject *
|
|
||||||
PyGObject_marshal_certificate (GTlsCertificate * certificate)
|
|
||||||
{
|
|
||||||
PyObject * result;
|
|
||||||
gchar * pem;
|
|
||||||
|
|
||||||
if (certificate == NULL)
|
|
||||||
PyFrida_RETURN_NONE;
|
|
||||||
|
|
||||||
g_object_get (certificate, "certificate-pem", &pem, NULL);
|
|
||||||
|
|
||||||
result = PyGObject_marshal_string (pem);
|
|
||||||
|
|
||||||
g_free (pem);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
PyFrida_raise (GError * error)
|
PyFrida_raise (GError * error)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ static PyObject * PyGObject_marshal_variant_byte_array (GVariant * variant);
|
|||||||
static PyObject * PyGObject_marshal_variant_dict (GVariant * variant);
|
static PyObject * PyGObject_marshal_variant_dict (GVariant * variant);
|
||||||
static PyObject * PyGObject_marshal_variant_array (GVariant * variant);
|
static PyObject * PyGObject_marshal_variant_array (GVariant * variant);
|
||||||
static PyObject * PyGObject_marshal_variant_tuple (GVariant * variant);
|
static PyObject * PyGObject_marshal_variant_tuple (GVariant * variant);
|
||||||
static gboolean PyGObject_unmarshal_certificate (PyObject * value, GTlsCertificate ** certificate);
|
|
||||||
static PyObject * PyGObject_marshal_certificate (GTlsCertificate * certificate);
|
|
||||||
|
|
||||||
static PyObject * PyFrida_raise (GError * error);
|
static PyObject * PyFrida_raise (GError * error);
|
||||||
static PyObject * PyFrida_marshal_error (GError * error);
|
static PyObject * PyFrida_marshal_error (GError * error);
|
||||||
|
|||||||
@@ -77,3 +77,8 @@ def make_auth_callback(callback: Callable[[str], Any]) -> Callable[[Any], str]:
|
|||||||
return json.dumps(session_info)
|
return json.dumps(session_info)
|
||||||
|
|
||||||
return authenticate
|
return authenticate
|
||||||
|
|
||||||
|
|
||||||
|
# TEMPORARY DEBUG HACK
|
||||||
|
def print_alive_tasks() -> None:
|
||||||
|
_frida.print_alive_tasks()
|
||||||
@@ -78,3 +78,8 @@ def make_auth_callback(callback: Callable[[str], Any]) -> Callable[[Any], str]:
|
|||||||
return json.dumps(session_info)
|
return json.dumps(session_info)
|
||||||
|
|
||||||
return authenticate
|
return authenticate
|
||||||
|
|
||||||
|
|
||||||
|
# TEMPORARY DEBUG HACK
|
||||||
|
def print_alive_tasks() -> None:
|
||||||
|
_frida.print_alive_tasks()
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/* TEMPORARY DEBUG HACK: needs a GLib built with G_ENABLE_DEBUG. */
|
||||||
|
extern void g_task_print_alive_tasks (void);
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
PyFrida_print_alive_tasks (PyObject * module,
|
||||||
|
PyObject * args)
|
||||||
|
{
|
||||||
|
g_task_print_alive_tasks ();
|
||||||
|
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
@@ -426,12 +426,11 @@ def generate_custom_facade_method(
|
|||||||
method: Method, logic: Union[str, Tuple[str, str]], model: Model, awaitable: bool
|
method: Method, logic: Union[str, Tuple[str, str]], model: Model, awaitable: bool
|
||||||
) -> str:
|
) -> str:
|
||||||
signature = ", ".join(["self"] + method.custom_facade_params)
|
signature = ", ".join(["self"] + method.custom_facade_params)
|
||||||
args = facade_call_args(method, model)
|
|
||||||
if method.is_async:
|
if method.is_async:
|
||||||
invoke = f"_invoke(self._impl.{method.name}, ({args}))"
|
invoke = f"_invoke(self._impl.{method.name}, ({method.facade_call_args}))"
|
||||||
call = f"await {invoke}" if awaitable else invoke
|
call = f"await {invoke}" if awaitable else invoke
|
||||||
else:
|
else:
|
||||||
call = f"self._impl.{method.name}({args})"
|
call = f"self._impl.{method.name}({method.facade_call_args})"
|
||||||
if method.return_value is not None:
|
if method.return_value is not None:
|
||||||
call = wrap_result(call, method.return_value.type, model)
|
call = wrap_result(call, method.return_value.type, model)
|
||||||
|
|
||||||
@@ -447,20 +446,6 @@ def generate_custom_facade_method(
|
|||||||
return {call}"""
|
return {call}"""
|
||||||
|
|
||||||
|
|
||||||
def facade_call_args(method: Method, model: Model) -> str:
|
|
||||||
takes_kwargs = any(param.split(":")[0].strip() == "**kwargs" for param in method.custom_facade_params)
|
|
||||||
args = []
|
|
||||||
for param in method.input_parameters:
|
|
||||||
if param.type.name == "Gio.Cancellable":
|
|
||||||
continue
|
|
||||||
options = resolve_options_type(param.type, model)
|
|
||||||
if options is not None and takes_kwargs:
|
|
||||||
args.append(make_options_expr(options))
|
|
||||||
else:
|
|
||||||
args.append(param.name)
|
|
||||||
return "".join(arg + ", " for arg in args)
|
|
||||||
|
|
||||||
|
|
||||||
def generate_py_exception_reexports(model: Model) -> List[str]:
|
def generate_py_exception_reexports(model: Model) -> List[str]:
|
||||||
names = [f"{member.js_name}Error" for member in model.error_domain.members]
|
names = [f"{member.js_name}Error" for member in model.error_domain.members]
|
||||||
names.append("OperationCancelledError")
|
names.append("OperationCancelledError")
|
||||||
@@ -642,7 +627,9 @@ def generate_py_sync_method(method: Method, model: Model) -> Optional[str]:
|
|||||||
if any(build_sync_param(param) is None for param in method.input_parameters):
|
if any(build_sync_param(param) is None for param in method.input_parameters):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
params = [facade_param(param, model) for param in method.input_parameters]
|
signature = ["self"]
|
||||||
|
for param in method.input_parameters:
|
||||||
|
signature.append(facade_param(param, model))
|
||||||
names = ", ".join(param.name for param in method.input_parameters)
|
names = ", ".join(param.name for param in method.input_parameters)
|
||||||
|
|
||||||
call = f"self._impl.{method.name}({names})"
|
call = f"self._impl.{method.name}({names})"
|
||||||
@@ -651,14 +638,10 @@ def generate_py_sync_method(method: Method, model: Model) -> Optional[str]:
|
|||||||
|
|
||||||
ret = "None" if method.return_value is None else pyi_type(method.return_value.type, model)
|
ret = "None" if method.return_value is None else pyi_type(method.return_value.type, model)
|
||||||
|
|
||||||
return f""" def {method.name}({facade_signature(method, params)}) -> {ret}:
|
return f""" def {method.name}({", ".join(signature)}) -> {ret}:
|
||||||
return {call}"""
|
return {call}"""
|
||||||
|
|
||||||
|
|
||||||
def facade_signature(method: Method, params: List[str]) -> str:
|
|
||||||
return ", ".join(["self"] + (method.custom_facade_params or params))
|
|
||||||
|
|
||||||
|
|
||||||
def facade_param(param, model: Model) -> str:
|
def facade_param(param, model: Model) -> str:
|
||||||
annotation = pyi_type(param.type, model)
|
annotation = pyi_type(param.type, model)
|
||||||
if param.nullable:
|
if param.nullable:
|
||||||
@@ -686,7 +669,7 @@ def generate_py_async_method(method: Method, model: Model) -> Optional[str]:
|
|||||||
|
|
||||||
|
|
||||||
def build_facade_async_parts(method: Method, model: Model) -> Optional[Tuple[str, str]]:
|
def build_facade_async_parts(method: Method, model: Model) -> Optional[Tuple[str, str]]:
|
||||||
params = []
|
signature = ["self"]
|
||||||
args = []
|
args = []
|
||||||
for param in method.input_parameters:
|
for param in method.input_parameters:
|
||||||
if param.type.name == "Gio.Cancellable":
|
if param.type.name == "Gio.Cancellable":
|
||||||
@@ -695,24 +678,20 @@ def build_facade_async_parts(method: Method, model: Model) -> Optional[Tuple[str
|
|||||||
return None
|
return None
|
||||||
options = resolve_options_type(param.type, model)
|
options = resolve_options_type(param.type, model)
|
||||||
if options is not None:
|
if options is not None:
|
||||||
params.append("**kwargs")
|
signature.append("**kwargs")
|
||||||
args.append(make_options_expr(options))
|
args.append(f"_make_options(_frida.{options.py_name}, kwargs, {build_option_selectors(options)})")
|
||||||
elif resolve_input_object_type(param.type, model) is not None:
|
elif resolve_input_object_type(param.type, model) is not None:
|
||||||
params.append(f"{param.name}: Optional[{pyi_type(param.type, model)}] = None")
|
signature.append(f"{param.name}: Optional[{pyi_type(param.type, model)}] = None")
|
||||||
args.append(f"_unwrap({param.name})")
|
args.append(f"_unwrap({param.name})")
|
||||||
else:
|
else:
|
||||||
params.append(facade_param(param, model))
|
signature.append(facade_param(param, model))
|
||||||
args.append(param.name)
|
args.append(param.name)
|
||||||
|
|
||||||
if method.return_value is not None:
|
if method.return_value is not None:
|
||||||
if build_return_marshal(method.return_value.type, model) is None:
|
if build_return_marshal(method.return_value.type, model) is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return facade_signature(method, params), "".join(arg + ", " for arg in args)
|
return ", ".join(signature), "".join(arg + ", " for arg in args)
|
||||||
|
|
||||||
|
|
||||||
def make_options_expr(options: ObjectType) -> str:
|
|
||||||
return f"_make_options(_frida.{options.py_name}, kwargs, {build_option_selectors(options)})"
|
|
||||||
|
|
||||||
|
|
||||||
def build_option_selectors(options: ObjectType) -> str:
|
def build_option_selectors(options: ObjectType) -> str:
|
||||||
@@ -881,8 +860,6 @@ def pyi_type(type: Type, model: Model) -> str:
|
|||||||
return "dict"
|
return "dict"
|
||||||
if name == "GLib.Variant":
|
if name == "GLib.Variant":
|
||||||
return "Any"
|
return "Any"
|
||||||
if name == "Gio.TlsCertificate":
|
|
||||||
return "str"
|
|
||||||
if resolve_enumeration(type, model) is not None:
|
if resolve_enumeration(type, model) is not None:
|
||||||
return "str"
|
return "str"
|
||||||
obj = resolve_object_type(type, model)
|
obj = resolve_object_type(type, model)
|
||||||
@@ -2017,17 +1994,6 @@ def build_setter_body(param: Parameter, set_call) -> Optional[str]:
|
|||||||
g_hash_table_unref (dict);
|
g_hash_table_unref (dict);
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if type_name == "Gio.TlsCertificate":
|
|
||||||
return f""" GTlsCertificate * certificate;
|
|
||||||
|
|
||||||
if (!PyGObject_unmarshal_certificate (value, &certificate))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
{set_call("certificate")}
|
|
||||||
|
|
||||||
g_clear_object (&certificate);
|
|
||||||
"""
|
|
||||||
|
|
||||||
if resolve_input_object_type(param.type, param.object_type.model) is not None:
|
if resolve_input_object_type(param.type, param.object_type.model) is not None:
|
||||||
handle = f"({param.type.c}) ((value != Py_None) ? PY_GOBJECT_HANDLE (value) : NULL)"
|
handle = f"({param.type.c}) ((value != Py_None) ? PY_GOBJECT_HANDLE (value) : NULL)"
|
||||||
return f" {set_call(handle)}\n"
|
return f" {set_call(handle)}\n"
|
||||||
@@ -2107,8 +2073,6 @@ def build_return_marshal(type: Type, model: Model) -> Optional[str]:
|
|||||||
return "PyGObject_marshal_vardict ({value})"
|
return "PyGObject_marshal_vardict ({value})"
|
||||||
if name == "GLib.Variant":
|
if name == "GLib.Variant":
|
||||||
return "PyGObject_marshal_variant ({value})"
|
return "PyGObject_marshal_variant ({value})"
|
||||||
if name == "Gio.TlsCertificate":
|
|
||||||
return "PyGObject_marshal_certificate ({value})"
|
|
||||||
|
|
||||||
enum = resolve_enumeration(type, model)
|
enum = resolve_enumeration(type, model)
|
||||||
if enum is not None:
|
if enum is not None:
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ def load_customizations() -> Customizations:
|
|||||||
c_symbol="PyFrida_get_device_manager",
|
c_symbol="PyFrida_get_device_manager",
|
||||||
asset="module_get_device_manager.c",
|
asset="module_get_device_manager.c",
|
||||||
),
|
),
|
||||||
|
# TEMPORARY DEBUG HACK
|
||||||
|
ModuleFunction(
|
||||||
|
py_name="print_alive_tasks",
|
||||||
|
c_symbol="PyFrida_print_alive_tasks",
|
||||||
|
asset="module_print_alive_tasks.c",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -119,7 +125,11 @@ if aux:
|
|||||||
),
|
),
|
||||||
"attach": MethodCustomizations(
|
"attach": MethodCustomizations(
|
||||||
param_typings=["target: ProcessTarget", "**kwargs: Any"],
|
param_typings=["target: ProcessTarget", "**kwargs: Any"],
|
||||||
custom_logic=_RESOLVE_PID,
|
custom_logic=(
|
||||||
|
"pid = self._pid_of(target)\n" "options = _make_options(_frida.SessionOptions, kwargs, {})",
|
||||||
|
"pid = await self._pid_of(target)\n"
|
||||||
|
"options = _make_options(_frida.SessionOptions, kwargs, {})",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
custom_code=CustomCode(
|
custom_code=CustomCode(
|
||||||
@@ -137,7 +147,6 @@ if aux:
|
|||||||
param_typings=["message: Any", "data: Optional[bytes] = None"],
|
param_typings=["message: Any", "data: Optional[bytes] = None"],
|
||||||
custom_logic="json = _to_json(message)",
|
custom_logic="json = _to_json(message)",
|
||||||
),
|
),
|
||||||
"enable_debugger": MethodCustomizations(param_typings=["port: int = 0"]),
|
|
||||||
"is_destroyed": MethodCustomizations(as_property=True),
|
"is_destroyed": MethodCustomizations(as_property=True),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -144,6 +144,11 @@ class Method(core.Method):
|
|||||||
custom = self.customizations
|
custom = self.customizations
|
||||||
return custom.custom_logic if custom is not None else None
|
return custom.custom_logic if custom is not None else None
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def facade_call_args(self) -> str:
|
||||||
|
return "".join(f"{param.name}, " for param in self.input_parameters if param.type.name != "Gio.Cancellable")
|
||||||
|
|
||||||
|
|
||||||
class Property(core.Property):
|
class Property(core.Property):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule releng updated: c9cc18138b...abb8238970.
@@ -1,6 +1,6 @@
|
|||||||
[wrap-git]
|
[wrap-git]
|
||||||
url = https://github.com/frida/frida-core.git
|
url = https://github.com/frida/frida-core.git
|
||||||
revision = 17.17.0
|
revision = 17.16.4
|
||||||
depth = 1
|
depth = 1
|
||||||
|
|
||||||
[provide]
|
[provide]
|
||||||
|
|||||||
@@ -17,27 +17,6 @@ BINDGEN_CORE = REPO / "frida-bindgen"
|
|||||||
GIRDIR = REPO / "build" / "subprojects" / "frida-core" / "src" / "api"
|
GIRDIR = REPO / "build" / "subprojects" / "frida-core" / "src" / "api"
|
||||||
OUTDIR = REPO / "build" / "bindgen-out"
|
OUTDIR = REPO / "build" / "bindgen-out"
|
||||||
BUILT_EXTENSION = REPO / "build" / "frida" / "_frida.abi3.so"
|
BUILT_EXTENSION = REPO / "build" / "frida" / "_frida.abi3.so"
|
||||||
CERTIFICATE = """\
|
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIIDGzCCAgOgAwIBAgIUEoCZX+FRWNTzcvvrCE2chFvE0EgwDQYJKoZIhvcNAQEL
|
|
||||||
BQAwHDEaMBgGA1UEAwwRZnJpZGEtcHl0aG9uLXRlc3QwIBcNMjYwNzMwMjIyNjAy
|
|
||||||
WhgPMjEyNjA3MDYyMjI2MDJaMBwxGjAYBgNVBAMMEWZyaWRhLXB5dGhvbi10ZXN0
|
|
||||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtKTIUbHLhkqRKdKqXuMc
|
|
||||||
u7q8OZD2eKdykp4Qvv+I5JcmNW7nlW+58zTCLaqUCsSrojDb8T2qvtRJbaJYAofE
|
|
||||||
P7bhb5ROOVwsyOjhvP7rZ4zRXIDAUlB7zE15yNkWL+Rh4l3wRxMOMIB2HQlurtDk
|
|
||||||
PIqPOITwRvrADKZt/73iMASwrkkqKnl/F3rLT0JQrd907sBdGGZNbJM9L4TUBT9t
|
|
||||||
MBBl6qXtDEFyBfeoqlnrLUTN/Jwyka+/6n6eZCN8g2g5tS1Lc7LFjX4iBG9ibgaH
|
|
||||||
hrNSTM+haLImFS3dtXFr4rOCAHnDYYvkCY1nuZOXannCvZowv0xczqpGLbj5IYJK
|
|
||||||
MQIDAQABo1MwUTAdBgNVHQ4EFgQUi83cV5yMTdWaVeRpgNO3vyeitMMwHwYDVR0j
|
|
||||||
BBgwFoAUi83cV5yMTdWaVeRpgNO3vyeitMMwDwYDVR0TAQH/BAUwAwEB/zANBgkq
|
|
||||||
hkiG9w0BAQsFAAOCAQEADScSFuasB4mgOb/kktq3O09rf/uUIa6OEjdFRec/i2+E
|
|
||||||
ZAUd5onsWQTHm4yhjqQwqVBte58tTqZB7S1HMCy5sEgEVUFnTrMUqtrf/WAnsWA6
|
|
||||||
SdjNr7h/aRnLHHysLkbl0Zo4fOIWIYSJpLn39e0OzcNBjEHN5U9HE/m/2LFku1Kb
|
|
||||||
KMTYXrhBKvVPpZLxZyoLz00EM7euaNx3juAgfQdSDfKGahf5CqqMJ/VmITISDJDR
|
|
||||||
jtN3wcv0/nZA5x/b73QCj0jqIEWqguYf4GLWitxGsSdT2dBEpT88Kz3Ibwb8uRT+
|
|
||||||
Ls3eRsdoqxiOT0E7Z44O8gjbqsYOr/jdMShwEytDwQ==
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(
|
@unittest.skipUnless(
|
||||||
@@ -152,29 +131,6 @@ class TestExtension(unittest.TestCase):
|
|||||||
options.argv = None
|
options.argv = None
|
||||||
self.assertIsNone(options.argv)
|
self.assertIsNone(options.argv)
|
||||||
|
|
||||||
def test_certificate_property_accepts_pem_and_path(self):
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
options = self._frida.RemoteDeviceOptions()
|
|
||||||
self.assertIsNone(options.certificate)
|
|
||||||
|
|
||||||
options.certificate = CERTIFICATE
|
|
||||||
self.assertEqual(options.certificate, CERTIFICATE)
|
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile("w", suffix=".pem") as f:
|
|
||||||
f.write(CERTIFICATE)
|
|
||||||
f.flush()
|
|
||||||
options.certificate = f.name
|
|
||||||
self.assertEqual(options.certificate, CERTIFICATE)
|
|
||||||
|
|
||||||
options.certificate = None
|
|
||||||
self.assertIsNone(options.certificate)
|
|
||||||
|
|
||||||
def test_certificate_property_rejects_missing_file(self):
|
|
||||||
options = self._frida.RemoteDeviceOptions()
|
|
||||||
with self.assertRaises(self._frida.InvalidArgumentError):
|
|
||||||
options.certificate = "/nonexistent.pem"
|
|
||||||
|
|
||||||
def test_vardict_property_round_trips(self):
|
def test_vardict_property_round_trips(self):
|
||||||
options = self._frida.SpawnOptions()
|
options = self._frida.SpawnOptions()
|
||||||
options.aux = {"name": "value", "count": 42, "flag": True}
|
options.aux = {"name": "value", "count": 42, "flag": True}
|
||||||
@@ -690,16 +646,6 @@ class TestFacade(unittest.TestCase):
|
|||||||
finally:
|
finally:
|
||||||
session.detach()
|
session.detach()
|
||||||
|
|
||||||
def test_attach_accepts_linker_notifier_offsets(self):
|
|
||||||
session = self.frida.get_local_device().attach(0, linker_notifier_offsets=[0x100])
|
|
||||||
session.detach()
|
|
||||||
|
|
||||||
def test_enable_debugger_defaults_to_any_port(self):
|
|
||||||
import inspect
|
|
||||||
|
|
||||||
for script in [self.frida.Script, self.frida.aio.Script]:
|
|
||||||
self.assertEqual(inspect.signature(script.enable_debugger).parameters["port"].default, 0)
|
|
||||||
|
|
||||||
def test_file_monitor_reports_changes(self):
|
def test_file_monitor_reports_changes(self):
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|||||||
Reference in new issue
Block a user