本文整理汇总了Python中frida.enumerate_devices方法的典型用法代码示例。如果您正苦于以下问题:Python frida.enumerate_devices方法的具体用法?Python frida.enumerate_devices怎么用?Python frida.enumerate_devices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类frida
的用法示例。
在下文中一共展示了frida.enumerate_devices方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import frida [as 别名]
# 或者: from frida import enumerate_devices [as 别名]
def run(self, bv, function=None):
frida_devices = frida.enumerate_devices()
try:
last_device = bv.query_metadata("frida_plugin_device_id")
except KeyError:
last_device = self.settings.get_string("frida.device_id")
devices = []
device_reorder = []
for device in frida_devices:
if device.id == last_device:
devices.insert(0, device.name)
device_reorder.insert(0, device)
else:
devices.append(device.name)
device_reorder.append(device)
choice_f = ChoiceField("Devices", devices)
get_form_input([choice_f], "Get Frida Device")
if choice_f.result != None:
self.settings.set_string("frida.device_id", device_reorder[choice_f.result].id)
bv.store_metadata("frida_plugin_device_id", str(device_reorder[choice_f.result].id))
self.frida_device = device_reorder[choice_f.result]
示例2: enumerate_connected_devices
# 需要导入模块: import frida [as 别名]
# 或者: from frida import enumerate_devices [as 别名]
def enumerate_connected_devices():
devices = frida.enumerate_devices()
if (len([x for x in devices if len(x.id) > 5]) != 0):
return create_devices_menu([x for x in devices if len(x.id) > 5])
else:
return None
示例3: instrument_script
# 需要导入模块: import frida [as 别名]
# 或者: from frida import enumerate_devices [as 别名]
def instrument_script():
return """
all_devices = frida.enumerate_devices()
if args.serial:
print('Serial: ', args.serial)
device = frida.get_usb_device(args.serial)
else:
device = frida.get_usb_device()
sessions = [device.attach(pid) for pid in pids]
"""
示例4: find_device
# 需要导入模块: import frida [as 别名]
# 或者: from frida import enumerate_devices [as 别名]
def find_device(type):
for device in frida.enumerate_devices():
if device.type == type:
return device
return None
示例5: run
# 需要导入模块: import frida [as 别名]
# 或者: from frida import enumerate_devices [as 别名]
def run(self) -> None:
self.log.debug('{} start'.format(self.__class__.__name__))
while True:
if self._terminate:
break
devices = frida.enumerate_devices()
# usb devices from frida api
usb_devices = [device for device in devices if device.type == 'usb']
usb_devices_ids = [device.id for device in usb_devices]
# devices strings from "adb devices"
adb_devices_strings = Shell().exec('adb devices', quiet=True).out.split('\n')[1:]
adb_devices_strings = [_.split('\t')[0] for _ in adb_devices_strings]
# we need to access these devices remotely
remote_devices_strings = set(adb_devices_strings) - set(usb_devices_ids)
remote_devices = []
for _ in remote_devices_strings:
new_device = FakeDevice()
new_device.id = _
remote_devices.append(new_device)
for device in usb_devices + remote_devices:
duplicated = False
for t in self.frida_threads:
if t.device.id == device.id:
if not t.is_alive():
self.frida_threads.remove(t)
break
duplicated = True
break
if duplicated:
continue
try:
frida_thread = FridaThread(device)
except RuntimeError as e:
self.log.error('error occurred when init frida thread: {}'.format(e))
else:
frida_thread.start()
self.frida_threads.append(frida_thread)
time.sleep(0.1)
self.shutdown()
self.log.debug('watch thread exit')