frida / frida-python

Frida Python bindings
Other
781 stars 146 forks source link

how to pass a dict parameter from python to frida rpc javascript function? #156

Open 3xp10it opened 5 years ago

3xp10it commented 5 years ago

I want to call a rpc function in frida js code,below is my rpc:

    rpc.exports = {
        signrequesturlwithparameters: function (param_dict,secret,signMethod) { 
 var result=ObjC.classes.GSNetworkUtils.signRequestUrlWithParameters_secret_signMethod_(param_dict,secret,signMethod);
        return String(ObjC.classes.NSString.stringWithString_(result));
        }
    };

and I want to use below python code to call the rpc function:

script.load()
signrequesturlwithparameters= getattr(script.exports, 'signrequesturlwithparameters')
_dict={"imsi":"46001","device_model":"iPhone7,2"}
secret="93AA27467E8"; 
signMethod="md5";
a=signrequesturlwithparameters(_dict,secret,signMethod)
print(a)

but it turns out run error,can I pass a dict from python to javasript rpc function in upon way? How should I modify the python or javascript code to make it work? Can someone help me?