當前位置: 首頁>>代碼示例>>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: 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

示例3: 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

示例4: 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

示例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;未經允許,請勿轉載。