def hexdump(self, addr_or_name, length, virtual=True, file_object=None): """Returns a string with a hexdump (in the format of `xxd'). `length' is in bytes. Example (intentionally not in doctest format since it would require a specific dump to be loaded to pass as a doctest): >>> print(dump.hexdump('linux_banner', 0x80)) ffffffc000c610a8: 4c69 6e75 7820 7665 7273 696f 6e20 332e Linux version 3. ffffffc000c610b8: 3138 2e32 302d 6761 3762 3238 6539 2d31 18.20-ga7b28e9-1 ffffffc000c610c8: 3333 3830 2d67 3036 3032 6531 3020 286c 3380-g0602e10 (l ffffffc000c610d8: 6e78 6275 696c 6440 6162 6169 7431 3532 nxbuild@abait152 ffffffc000c610e8: 2d73 642d 6c6e 7829 2028 6763 6320 7665 -sd-lnx) (gcc ve ffffffc000c610f8: 7273 696f 6e20 342e 392e 782d 676f 6f67 rsion 4.9.x-goog ffffffc000c61108: 6c65 2032 3031 3430 3832 3720 2870 7265 le 20140827 (pre ffffffc000c61118: 7265 6c65 6173 6529 2028 4743 4329 2029 release) (GCC) ) """ import StringIO sio = StringIO.StringIO() address = self.resolve_virt(addr_or_name) parser_util.xxd( address, [self.read_byte(address + i, virtual=virtual) or 0 for i in xrange(length)], file_object=sio) ret = sio.getvalue() sio.close() return ret
def hexdump(self, address, length, virtual=True, file_object=None): """Does a hexdump (in the format of `xxd'). `length' is in bytes. If given, will write to `file_object', otherwise will write to stdout. """ parser_util.xxd(address, [ self.read_byte(address + i, virtual=virtual) or 0 for i in xrange(length) ], file_object=file_object)
def hexdump(self, address, length, virtual=True, file_object=None): """Does a hexdump (in the format of `xxd'). `length' is in bytes. If given, will write to `file_object', otherwise will write to stdout. """ parser_util.xxd( address, [self.read_byte(address + i, virtual=virtual) or 0 for i in xrange(length)], file_object=file_object)