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


Python hexdump.hexdump方法代码示例

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


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

示例1: handle_packet

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def handle_packet(self, packet):
    try:
      message = self.message_from_packet(packet)
      sniffer = self._find_sniffer_for_packet(packet)
      sniffer.handle_message(message)
      self.handle_message(message)
    except (BadPacket, struct.error) as ex:
      if self._dump_bad_packet:
        print("got: %s" % str(ex))
        hexdump.hexdump(packet.load)
        traceback.print_exc()
        sys.stdout.flush()
    except Exception as ex:
      print("got: %s" % str(ex))
      hexdump.hexdump(packet.load)
      traceback.print_exc()
      sys.stdout.flush() 
开发者ID:twitter,项目名称:zktraffic,代码行数:19,代码来源:omni_sniffer.py

示例2: _dump

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def _dump(self, command):
        """Dumps the packet/template bytes in different formats."""
        if len(command) == 1:
            hexdump.hexdump(self._t.raw)
            print("")
            return
        # Parsing the arguments
        cp = CommandParser(TemplateInterface._dump_opts())
        args = cp.parse(command)
        if not args:
            Interface._argument_error()
            return
        if args["-hex"]:
            hexdump.hexdump(self._t.raw)
            print("")
        elif args["-b"]:
            print(str(self._t.raw), "\n")
        elif args["-hexstr"]:
            print(hexdump.dump(self._t.raw), "\n")
        elif args["-h"]:
            Interface.print_help(TemplateInterface._dump_help()) 
开发者ID:shramos,项目名称:polymorph,代码行数:23,代码来源:templateinterface.py

示例3: dump_patch

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def dump_patch(bits, arch=ARCH_32):
    ps = GreedyVArray(sdb.PATCHBITS)
    ps.vsParse(bits.value.value)

    for i, _ in ps:
        p = ps[int(i)]

        print("  opcode: %s" % str(p["opcode"]))
        print("  module name: %s" % p.module_name)
        print("  rva: 0x%08x" % p.rva)
        print("  unk: 0x%08x" % p.unknown)

        print("  payload:")
        print(hexdump.hexdump(str(p.pattern), result="return"))

        print("  disassembly:")
        for l in disassemble(str(p.pattern), p.rva, arch=arch):
            print("    " + l)
        print("") 
开发者ID:williballenthin,项目名称:python-sdb,代码行数:21,代码来源:sdb_dump_patch.py

示例4: disassemble_block

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def disassemble_block(raw, idx, *args, **kwargs):
    stream = raw[:]

    print("[+] sub_%04x {" % idx)

    if kwargs.get("show_as_hexdump", False) == True:
        hexdump.hexdump(stream)

    else:
        idx = 0
        while idx < len(stream):
            insn = WasmInstruction(stream[idx:])
            print("{:08x}  {:16s}  {}".format(idx, insn.hexdump, str(insn), ))
            idx += insn.length
    print("}")

    del stream
    return 
开发者ID:sophoslabs,项目名称:WebAssembly,代码行数:20,代码来源:wasm-disassembler.py

示例5: dumpData

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def dumpData(self, addr, size):
        data = str(self.readData(addr, size))
        try:
            hexdump.hexdump(data)
        except:
            for i in range(0, size, 4):
                if i % 16 == 0: print("")
                print(binascii.hexlify(data[i:i+4]), end=' ') 
开发者ID:5alt,项目名称:emu,代码行数:10,代码来源:emu.py

示例6: send_cmd

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def send_cmd(s, cmd, data):
  req = mk_msg(cmd, data)
  print "Command %d request:" % (cmd)
  print hexdump.hexdump(req)
    
  s.send(req)
  res = s.recv(1024)
  print "Command %d response:" % (cmd)
  print hexdump.hexdump(res) 
开发者ID:tenable,项目名称:poc,代码行数:11,代码来源:hp_imc_dbman_conf_BackHoseIp_stack_overflow_73_E0605P06.py

示例7: send_cmd

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def send_cmd(cmd, data, host, port, timeout=5):
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.settimeout(timeout)
  s.connect((host, port))

  req = mk_msg(cmd, data)
  print "Command %d request:" % (cmd)
  print hexdump.hexdump(req)
    
  s.send(req)
  res = s.recv(1024)
  s.close()
  print "Command %d response:" % (cmd)
  print hexdump.hexdump(res) 
开发者ID:tenable,项目名称:poc,代码行数:16,代码来源:hp_imc_dbman_conf_cmd_injection_73_E0605P06.py

示例8: read_message

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def read_message(self):
        """ Read an entire message from the registered socket.

        Returns None on failure, Dict of data from ubjson on success.
        """
        while True:
            try:
                # The first 4 bytes are the message's length
                #   read this first
                while len(self.buf) < 4:
                    self.buf += self.server.recv(4 - len(self.buf))
                    if len(self.buf) == 0:
                        return None
                message_len = unpack(">L", self.buf[0:4])[0]

                # Now read in message_len amount of data
                while len(self.buf) < (message_len + 4):
                    self.buf += self.server.recv((message_len + 4) - len(self.buf))

                try:
                    # Exclude the the message length in the header
                    msg = ubjson.loadb(self.buf[4:])
                    # Clear out the old buffer
                    del self.buf
                    self.buf = bytearray()
                    return msg

                except DecoderException as exception:
                    print("ERROR: Decode failure in Slippstream")
                    print(exception)
                    print(hexdump(self.buf[4:]))
                    self.buf.clear()
                    return None

            except socket.error as exception:
                if exception.args[0] == errno.EWOULDBLOCK:
                    continue
                print("ERROR with socket:", exception)
                return None 
开发者ID:altf4,项目名称:libmelee,代码行数:41,代码来源:slippstream.py

示例9: str_from_hexdump

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def str_from_hexdump(self):
        """Extract a string from a hexdump
        
        Returns:
            Chepy: The Chepy object.
        """
        # TODO make new line aware \n \r\n \0a etc
        self.state = "".join(re.findall(r"\|(.+)\|", self._convert_to_str()))
        return self 
开发者ID:securisec,项目名称:chepy,代码行数:11,代码来源:dataformat.py

示例10: to_hexdump

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def to_hexdump(self):
        """Convert the state to hexdump
        
        Returns:
            Chepy: The Chepy object. 
        """
        self.state = hexdump.hexdump(self._convert_to_bytes(), result="return")
        return self 
开发者ID:securisec,项目名称:chepy,代码行数:10,代码来源:dataformat.py

示例11: from_hexdump

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def from_hexdump(self):
        """Convert hexdump back to str
        
        Returns:
            Chepy: The Chepy object. 
        """
        self.state = hexdump.restore(self._convert_to_str())
        return self 
开发者ID:securisec,项目名称:chepy,代码行数:10,代码来源:dataformat.py

示例12: handle_packet

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def handle_packet(self, packet):
    sampling = self.config.sampling
    if sampling < 1.0 and random() > sampling:
      return

    try:
      message = self.message_from_packet(packet)
      self.handle_message(message)
    except (BadPacket, StringTooLong, DeserializationError, struct.error) as ex:
      if self.config.dump_bad_packet:
        print("got: %s" % str(ex))
        hexdump.hexdump(packet.load)
        sys.stdout.flush() 
开发者ID:twitter,项目名称:zktraffic,代码行数:15,代码来源:sniffer.py

示例13: handle_packet

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def handle_packet(self, packet):
    try:
      message = self.message_from_packet(packet)
      if message:
        self.handle_message(message)
    except (BadPacket, struct.error) as ex:
      if self._dump_bad_packet:
        print("got: %s" % str(ex))
        hexdump.hexdump(packet.load)
        sys.stdout.flush()
    except Exception as ex:
      print("got: %s" % str(ex))
      hexdump.hexdump(packet.load)
      sys.stdout.flush() 
开发者ID:twitter,项目名称:zktraffic,代码行数:16,代码来源:sniffer.py

示例14: color_dump

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def color_dump(raw, start, end=None):
        row = int(start / 16) * 77
        st = ((start % 16) * 3) + row + 10
        hd = hexdump.hexdump(raw, 'return')
        if end:
            srow = int(end / 16) * 77
            stop = ((end % 16) * 3) + srow + 10
            print(hd[:st], colored(hd[st:stop], 'cyan'),
                  hd[stop:], '\n', sep="")
        else:
            print(hd[:st], colored(hd[st:], 'cyan'), '\n', sep="") 
开发者ID:shramos,项目名称:polymorph,代码行数:13,代码来源:interface.py

示例15: hexdump

# 需要导入模块: import hexdump [as 别名]
# 或者: from hexdump import hexdump [as 别名]
def hexdump(data):
            return hexdump_hexdump(data, result='return') + '\n' 
开发者ID:takeshixx,项目名称:knxmap,代码行数:4,代码来源:misc.py


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