我有一个js文件和一些rpc.exports
rpc.exports = {
callfunctionsecret: callSecretFun,
callfunctionsomethingelse: callSomethingElse,
}
我想在python中列出所有这些函数,但我找不到一种方法
device = frida.get_usb_device()
pid = device.spawn([package_name])
device.resume(pid)
time.sleep(1)
session = device.attach(pid)
with open(sys.argv[1]) as jsfile:
script = session.create_script(jsfile.read())
print(dir(script.exports))
# output
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_script']
# output doesn't contain "callfunctionsecret" and "callfunctionsomethingelse"
有没有办法在某种列表中获取函数名
# e.g.
['callfunctionsecret','callfunctionsomethingelse']
到目前为止,我只到了可以使用
print(script.exports.__getattrs__(callfunctionsecret))
但这要求我们首先知道函数名,这与列出所有函数名的目的背道而驰
据我所见,这没有文档记录,也没有明确的方法
ScriptExports
as类不包含任何用于此目的的有用信息或方法。但是,如果您搜索frida-gum's code,则有这样一个操作用于此目的,list
。可以触发此操作并获得所有rpc导出,如下所示:agent.js
agent.py
输出:
相关问题 更多 >
编程相关推荐