|
|
|
@ -49,12 +49,6 @@ parser = argparse.ArgumentParser(
|
|
|
|
($sp by default)
|
|
|
|
($sp by default)
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
|
|
|
|
"address", nargs="?", default=None, type=int, help="The address to telescope at."
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
|
|
|
"count", nargs="?", default=telescope_lines, type=int, help="The number of lines to show."
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
parser.add_argument(
|
|
|
|
"-r",
|
|
|
|
"-r",
|
|
|
|
"--reverse",
|
|
|
|
"--reverse",
|
|
|
|
@ -64,6 +58,14 @@ parser.add_argument(
|
|
|
|
help="Show <count> previous addresses instead of next ones",
|
|
|
|
help="Show <count> previous addresses instead of next ones",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
|
|
|
"address", nargs="?", default=None, type=int, help="The address to telescope at."
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
|
|
|
"count", nargs="?", default=telescope_lines, type=int, help="The number of lines to show."
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.ArgparsedCommand(parser)
|
|
|
|
@pwndbg.commands.ArgparsedCommand(parser)
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
@ -84,15 +86,15 @@ def telescope(address=None, count=telescope_lines, to_string=False, reverse=Fals
|
|
|
|
delimiter = T.delimiter(offset_delimiter)
|
|
|
|
delimiter = T.delimiter(offset_delimiter)
|
|
|
|
separator = T.separator(offset_separator)
|
|
|
|
separator = T.separator(offset_separator)
|
|
|
|
|
|
|
|
|
|
|
|
# Allow invocation of telescope -r to dump previous addresses
|
|
|
|
|
|
|
|
if reverse:
|
|
|
|
|
|
|
|
address -= (count - 1) * ptrsize
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Allow invocation of "telescope 20" to dump 20 bytes at the stack pointer
|
|
|
|
# Allow invocation of "telescope 20" to dump 20 bytes at the stack pointer
|
|
|
|
if address < pwndbg.gdblib.memory.MMAP_MIN_ADDR and not pwndbg.gdblib.memory.peek(address):
|
|
|
|
if address < pwndbg.gdblib.memory.MMAP_MIN_ADDR and not pwndbg.gdblib.memory.peek(address):
|
|
|
|
count = address
|
|
|
|
count = address
|
|
|
|
address = pwndbg.gdblib.regs.sp
|
|
|
|
address = pwndbg.gdblib.regs.sp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Allow invocation of telescope -r to dump previous addresses
|
|
|
|
|
|
|
|
if reverse:
|
|
|
|
|
|
|
|
address -= (count - 1) * ptrsize
|
|
|
|
|
|
|
|
|
|
|
|
# Allow invocation of "telescope a b" to dump all bytes from A to B
|
|
|
|
# Allow invocation of "telescope a b" to dump all bytes from A to B
|
|
|
|
if int(address) <= int(count):
|
|
|
|
if int(address) <= int(count):
|
|
|
|
# adjust count if it is an address. use ceil division as count is number of
|
|
|
|
# adjust count if it is an address. use ceil division as count is number of
|
|
|
|
@ -103,7 +105,6 @@ def telescope(address=None, count=telescope_lines, to_string=False, reverse=Fals
|
|
|
|
reg_values = collections.defaultdict(lambda: [])
|
|
|
|
reg_values = collections.defaultdict(lambda: [])
|
|
|
|
for reg in pwndbg.gdblib.regs.common:
|
|
|
|
for reg in pwndbg.gdblib.regs.common:
|
|
|
|
reg_values[pwndbg.gdblib.regs[reg]].append(reg)
|
|
|
|
reg_values[pwndbg.gdblib.regs[reg]].append(reg)
|
|
|
|
# address = pwndbg.gdblib.memory.poi(pwndbg.gdblib.typeinfo.ppvoid, address)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start = address
|
|
|
|
start = address
|
|
|
|
stop = address + (count * ptrsize)
|
|
|
|
stop = address + (count * ptrsize)
|
|
|
|
|