python的frida库

frida对象

spawn(“PackageName”)

以挂起的方式启动进程

  • 需要传入参数,App包名
  • 返回一个进程pid

attach(target)

附加到已存在的进程

  • 传入的参数target可以是App包名,也可以是进程pid
  • 返回一个Session对象

resume(target)

恢复进程

kill(target)

杀死进程

get_usb_device()

获取device信息

  • 返回一个Device对象

get_device_manager()

获取设备管理器

  • 返回一个DeviceManager对象

DeviceManager对象

get_usb_device()

获取device信息

  • 返回一个Device对象

add_remote_device(location)

添加一个新的设备

  • 返回一个Device对象

Device对象

属性

  • id = device.id
  • name = device.name
  • icon = device.icon
  • type = device.type

spawn(“PackageName”)

以挂起的方式启动进程

  • 需要传入参数,App包名
  • 返回一个进程pid

attach(target)

附加到已存在的进程

  • 传入的参数target可以是App包名,也可以是进程pid
  • 返回一个Session对象

resume(target)

恢复进程

kill(target)

杀死进程

Session对象

create_script(script_name)

创建脚本文件

  • 返回一个Script对象

Script对象

load()

加载脚本

on(‘message’,callback)

如果第一个参数是'message',会调用callback函数。
把js中的数据发送到python来处理
与脚本中的send()配合使用

callback(message,data)

第一个参数接收send发送的数据
第二个参数未知

1
2
3
4
5
def callback(message,data):
if message["type"] == 'send':
print(u"[*] {0}".format(message['payload']))
else:
print(message)

post()

把python中的数据返回给js
与脚本中的recv配合使用
recv(func)

exports.rpcfunc(args)

通过python调用js脚本中的方法
与rpc配合使用

1
2
3
rpc.exports = {
rpcfunc: test
}