本文整理汇总了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
示例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)
示例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
示例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')
示例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()
示例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