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


Python frida.attach方法代码示例

本文整理汇总了Python中frida.attach方法的典型用法代码示例。如果您正苦于以下问题:Python frida.attach方法的具体用法?Python frida.attach怎么用?Python frida.attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在frida的用法示例。


在下文中一共展示了frida.attach方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _shutdown_sockfd

# 需要导入模块: import frida [as 别名]
# 或者: from frida import attach [as 别名]
def _shutdown_sockfd(pid, sockfd):
  """Injects into a process a call to shutdown() a socket file descriptor.

  Injects into a process a call to shutdown()
  (http://man7.org/linux/man-pages/man2/shutdown.2.html) a socket file
  descriptor, thereby shutting down its associated TCP connection.

  Args:
    pid: The process ID (as an int) of the target process.
    sockfd: The socket file descriptor (as an int) in the context of the target
      process to be shutdown.

  Raises:
    RuntimeError: Error during execution of JavaScript injected into process.
  """

  js_error = {}  # Using dictionary since Python 2.7 doesn't support "nonlocal".
  event = threading.Event()

  def on_message(message, data):  # pylint: disable=unused-argument
    if message["type"] == "error":
      js_error["error"] = message["description"]
    event.set()

  session = frida.attach(pid)
  script = session.create_script(_FRIDA_SCRIPT % sockfd)
  script.on("message", on_message)
  closed = False

  try:
    script.load()
  except frida.TransportError as e:
    if str(e) != "the connection is closed":
      raise
    closed = True

  if not closed:
    event.wait()
    session.detach()
  if "error" in js_error:
    raise RuntimeError(js_error["error"]) 
开发者ID:google,项目名称:tcp_killer,代码行数:43,代码来源:tcp_killer.py

示例2: __init__

# 需要导入模块: import frida [as 别名]
# 或者: from frida import attach [as 别名]
def __init__(self, target_process):
        # Attach to the target process.
        self.session = frida.attach(target_process)

        # Load the script in the target process.
        self.script = self.session.create_script(script_code)
        self.script.load() 
开发者ID:agustingianni,项目名称:memrepl,代码行数:9,代码来源:memrepl.py


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