diff --git a/pwndbg/commands/hexdump.py b/pwndbg/commands/hexdump.py index f2cf2bc03..f5dbda4ca 100644 --- a/pwndbg/commands/hexdump.py +++ b/pwndbg/commands/hexdump.py @@ -3,17 +3,25 @@ from __future__ import print_function import pwndbg.arch import pwndbg.commands +import pwndbg.config import pwndbg.hexdump import pwndbg.memory import pwndbg.regs +default_width = pwndbg.config.Parameter('hexdump-width', + 16, + 'line width of hexdump command') +default_bytes = pwndbg.config.Parameter('hexdump-bytes', + 16, + 'number of bytes printed by hexdump command') @pwndbg.commands.ParsedCommand @pwndbg.commands.OnlyWhenRunning -def hexdump(address=None, count=64): +def hexdump(address=None, count=default_bytes): """ Hexdumps data at the specified address. - Optionally provide the number of bytes to dump (default 64) + Optionally provide the number of bytes to dump (default is controlled + by the 'hexdump-bytes' config.) Note that repeating rows are collapsed. """ @@ -33,5 +41,5 @@ def hexdump(address=None, count=64): data = pwndbg.memory.read(address, count, partial=True) - for line in pwndbg.hexdump.hexdump(data, address=address): + for line in pwndbg.hexdump.hexdump(data, address=address, width=int(default_width)): print(line) diff --git a/pwndbg/commands/telescope.py b/pwndbg/commands/telescope.py index aebdd071a..ba19fc7c3 100644 --- a/pwndbg/commands/telescope.py +++ b/pwndbg/commands/telescope.py @@ -10,14 +10,19 @@ import collections import pwndbg.arch import pwndbg.chain import pwndbg.commands +import pwndbg.config import pwndbg.memory import pwndbg.regs import pwndbg.typeinfo +telescope_lines = pwndbg.config.Parameter('telescope-lines', + 8, + 'number of lines to printed by the telescope command') + @pwndbg.commands.ParsedCommand @pwndbg.commands.OnlyWhenRunning -def telescope(address=None, count=8, to_string=False): +def telescope(address=None, count=telescope_lines, to_string=False): """ Recursively dereferences pointers starting at the specified address ($sp by default) diff --git a/pwndbg/hexdump.py b/pwndbg/hexdump.py index a6debab6f..ff31827c3 100644 --- a/pwndbg/hexdump.py +++ b/pwndbg/hexdump.py @@ -42,6 +42,7 @@ for c in bytearray((string.ascii_letters + string.digits + string.punctuation).e printable[-1] = ' ' + def hexdump(data, address = 0, width = 16, skip = True): data = list(bytearray(data)) base = address