當前位置: 首頁>>代碼示例>>Python>>正文


Python frida.InvalidOperationError方法代碼示例

本文整理匯總了Python中frida.InvalidOperationError方法的典型用法代碼示例。如果您正苦於以下問題:Python frida.InvalidOperationError方法的具體用法?Python frida.InvalidOperationError怎麽用?Python frida.InvalidOperationError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在frida的用法示例。


在下文中一共展示了frida.InvalidOperationError方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: dump_segment

# 需要導入模塊: import frida [as 別名]
# 或者: from frida import InvalidOperationError [as 別名]
def dump_segment(self, ptr):
        print('-> trying to dump memory segment of 0x%x' % ptr)
        try:
            range_info = self.frida_script.exports.rangeinfo(ptr)
        except frida.InvalidOperationError:
            self.frida_script = None
            range_info = None
        except Exception as e:
            print('-> error while dumping memory segment from device')
            print(e)
            range_info = None

        if range_info is not None:
            data = self.frida_script.exports.dumprange(range_info['base'], range_info['size'])
            if data is not None:
                print('-> adding new segment at %s of size %u' % (range_info['base'], len(data)))
                self.add_segment(ptr, data)
                with open(session_path + '/' + ('%s' % range_info['base']), 'wb') as f:
                    f.write(data)
                s.add_segment(int(range_info['base'], 16), data)
                if self.emulator is not None:
                    self.emulator.map_segment(int(range_info['base'], 16), data)
                return 1
        return 0 
開發者ID:iGio90,項目名稱:binja-secret,代碼行數:26,代碼來源:__init__.py

示例2: kill_frida_servers

# 需要導入模塊: import frida [as 別名]
# 或者: from frida import InvalidOperationError [as 別名]
def kill_frida_servers(self):
        try:
            apps = self.device.enumerate_processes()
        except (frida.ServerNotRunningError, frida.TransportError, frida.InvalidOperationError):
            # frida server has not been started, no need to start
            return

        for app in apps:
            if app.name == self.server_name:
                self.adb.unsafe_shell('kill -9 {}'.format(app.pid), root=True, quiet=True) 
開發者ID:Margular,項目名稱:frida-skeleton,代碼行數:12,代碼來源:frida_thread.py

示例3: run_frida_server

# 需要導入模塊: import frida [as 別名]
# 或者: from frida import InvalidOperationError [as 別名]
def run_frida_server(self):
        self.adb.unsafe_shell('chmod +x /data/local/tmp/' + self.server_name)
        self.server_executor.submit(self.adb.unsafe_shell, '/data/local/tmp/{} -D'.format(self.server_name), True)

        # waiting for frida server
        while True:
            try:
                time.sleep(0.5)
                if not self._terminate:
                    self.device.enumerate_processes()
                break
            except (frida.ServerNotRunningError, frida.TransportError, frida.InvalidOperationError):
                continue 
開發者ID:Margular,項目名稱:frida-skeleton,代碼行數:15,代碼來源:frida_thread.py

示例4: connect

# 需要導入模塊: import frida [as 別名]
# 或者: from frida import InvalidOperationError [as 別名]
def connect(self):
        """Connect to Frida Server."""
        session = None
        try:
            env = Environment()
            self.clean_up()
            env.run_frida_server()
            device = frida.get_device(get_device(), settings.FRIDA_TIMEOUT)
            pid = device.spawn([self.package])
            device.resume(pid)
            logger.info('Spawning %s', self.package)
            time.sleep(2)
            session = device.attach(pid)
        except frida.ServerNotRunningError:
            logger.warning('Frida server is not running')
            self.connect()
        except frida.TimedOutError:
            logger.error('Timed out while waiting for device to appear')
        except (frida.ProcessNotFoundError,
                frida.TransportError,
                frida.InvalidOperationError):
            pass
        except Exception:
            logger.exception('Error Connecting to Frida')
        try:
            if session:
                script = session.create_script(self.get_script())
                script.on('message', self.frida_response)
                script.load()
                sys.stdin.read()
                script.unload()
                session.detach()
        except Exception:
            logger.exception('Error Connecting to Frida') 
開發者ID:MobSF,項目名稱:Mobile-Security-Framework-MobSF,代碼行數:36,代碼來源:frida_core.py

示例5: stop

# 需要導入模塊: import frida [as 別名]
# 或者: from frida import InvalidOperationError [as 別名]
def stop(self):
        try:
            self.dwarf.detach()
        except frida.InvalidOperationError:
            # device detached
            pass
        except frida.PermissionDeniedError:
            # no permissions to kill the target
            pass
        self.onStopped.emit()
        self.onClosed.emit() 
開發者ID:iGio90,項目名稱:Dwarf,代碼行數:13,代碼來源:session.py

示例6: resume_proc

# 需要導入模塊: import frida [as 別名]
# 或者: from frida import InvalidOperationError [as 別名]
def resume_proc(self):
        if self._spawned and not self._resumed:
            self._resumed = True
            try:
                self.device.resume(self._pid)
            except frida.InvalidOperationError:
                # already resumed from other loc
                pass 
開發者ID:iGio90,項目名稱:Dwarf,代碼行數:10,代碼來源:core.py


注:本文中的frida.InvalidOperationError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。