frida / frida-python

Frida Python bindings
Other
785 stars 147 forks source link

Exception: InvalidArgumentError: malformed package #235

Open monkeywave opened 1 year ago

monkeywave commented 1 year ago

Hi,

what is the intended way to change a value provided through Python to the JavaScript part?

Currently when I'm replacing a boolean value (provided through the terminal interface) I get the following error message:

Exception type : InvalidArgumentError 
Exception message : malformed package
Stack trace : ['File : /friTap/friTap.py , Line : 480, Func.Name : main, Message : ssl_log(parsed.exec, parsed.pcap, parsed.verbose,', 'File : /friTap/friTap.py , Line : 368, Func.Name : ssl_log, Message : instrument(process)', 'File : /friTap/friTap.py , Line : 250, Func.Name : instrument, Message : script = process.create_script(script_string, runtime=runtime)', 'File : /home/monkeywave/.local/lib/python3.10/site-packages/frida/core.py , Line : 86, Func.Name : wrapper, Message : return f(*args, **kwargs)', 'File : /home/monkeywave/.local/lib/python3.10/site-packages/frida/core.py , Line : 628, Func.Name : create_script, Message : return Script(self._impl.create_script(source, **kwargs))  # type: ignore']

The replacement is done in Python with the following code:

if anti_root:
            script_string = script_string.replace('export let anti_root = false', "export let anti_root = true")
script = process.create_script(script_string, runtime=runtime)

The JavaScript code is generated from the TypeScript code by frida-compile.

Thx for your help