当前位置: 首页>>代码示例>>Python>>正文


Python frida.enumerate_devices方法代码示例

本文整理汇总了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] 
开发者ID:chame1eon,项目名称:binaryninja-frida,代码行数:24,代码来源:frida_plugin_start.py

示例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 
开发者ID:Mind0xP,项目名称:Frida-Python-Binding,代码行数:8,代码来源:fridaPyBinding.py

示例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]
    """ 
开发者ID:microsoft,项目名称:SARA,代码行数:12,代码来源:transform.py

示例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 
开发者ID:bkerler,项目名称:android_universal,代码行数:7,代码来源:application.py

示例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') 
开发者ID:Margular,项目名称:frida-skeleton,代码行数:55,代码来源:watch_thread.py


注:本文中的frida.enumerate_devices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。