pull/10/head
Zach Riggle 11 years ago
parent 86497b14aa
commit d1743d7a87

@ -7,6 +7,9 @@ import pwndbg.commands
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
def auxv(): def auxv():
"""
Print information from the Auxiliary ELF Vector.
"""
for k,v in pwndbg.auxv.get().items(): for k,v in pwndbg.auxv.get().items():
if v is not None: if v is not None:
print(k.ljust(24), v if not isinstance(v, (long, int)) else pwndbg.chain.format(v)) print(k.ljust(24), v if not isinstance(v, (long, int)) else pwndbg.chain.format(v))

@ -16,6 +16,9 @@ import pwndbg.vmmap
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
def context(*args): def context(*args):
"""
Print out the current register, instruction, and stack context.
"""
if len(args) == 0: if len(args) == 0:
args = ['reg','code','stack','backtrace'] args = ['reg','code','stack','backtrace']

@ -8,6 +8,11 @@ import pwndbg.vmmap
@pwndbg.commands.Command @pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
def dt(typename, address=None): def dt(typename, address=None):
"""
Dump out information on a type (e.g. ucontext_t).
Optionally overlay that information at an address.
"""
if address is not None: if address is not None:
address = pwndbg.commands.fix(address) address = pwndbg.commands.fix(address)
print(pwndbg.dt.dt(typename, addr=address)) print(pwndbg.dt.dt(typename, addr=address))

@ -7,7 +7,12 @@ import pwndbg.regs
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
def hexdump(address=None, count=64): def hexdump(address=None, count=64):
"""Hexdumps some data""" """
Hexdumps data at the specified address.
Optionally provide the number of bytes to dump (default 64)
Note that repeating rows are collapsed.
"""
address = int(address or pwndbg.regs.sp) address = int(address or pwndbg.regs.sp)
count = int(count) count = int(count)

@ -8,6 +8,9 @@ import pwndbg.regs
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
@pwndbg.events.stop @pwndbg.events.stop
def j(*args): def j(*args):
"""
Synchronize IDA's cursor with GDB
"""
pc = int(gdb.selected_frame().pc()) pc = int(gdb.selected_frame().pc())
pwndbg.ida.Jump(pc) pwndbg.ida.Jump(pc)
@ -15,12 +18,17 @@ def j(*args):
if pwndbg.ida.available(): if pwndbg.ida.available():
@pwndbg.commands.Command @pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
def up(): def up(n=1):
"""
Select and print stack frame that called this one.
An argument says how many frames up to go.
"""
f = gdb.selected_frame() f = gdb.selected_frame()
o = f.older()
if o: for i in range(n):
o.select() o = f.older()
if o:
o.select()
bt = pwndbg.commands.context.context_backtrace(with_banner=False) bt = pwndbg.commands.context.context_backtrace(with_banner=False)
print('\n'.join(bt)) print('\n'.join(bt))
@ -29,12 +37,17 @@ if pwndbg.ida.available():
@pwndbg.commands.Command @pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
def down(): def down(n=1):
"""
Select and print stack frame called by this one.
An argument says how many frames down to go.
"""
f = gdb.selected_frame() f = gdb.selected_frame()
o = f.newer()
if o: for i in range(n):
o.select() o = f.older()
if o:
o.select()
bt = pwndbg.commands.context.context_backtrace(with_banner=False) bt = pwndbg.commands.context.context_backtrace(with_banner=False)
print('\n'.join(bt)) print('\n'.join(bt))

@ -10,6 +10,9 @@ import pwndbg.vmmap
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
def nearpc(pc=None, lines=None, to_string=False): def nearpc(pc=None, lines=None, to_string=False):
"""
Disassemble near a specified address.
"""
# Fix the case where we only have one argument, and # Fix the case where we only have one argument, and
# it's a small value. # it's a small value.
if lines is None and (pc is None or int(pc) < 0x100): if lines is None and (pc is None or int(pc) < 0x100):

Loading…
Cancel
Save