|
|
|
|
@ -25,21 +25,37 @@ def get_type(size):
|
|
|
|
|
@pwndbg.commands.ParsedCommand
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def db(address, count=64):
|
|
|
|
|
"""
|
|
|
|
|
Starting at the specified address, dump N bytes
|
|
|
|
|
(default 64).
|
|
|
|
|
"""
|
|
|
|
|
return dX(1, int(address), int(count))
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.ParsedCommand
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def dw(address, count=32):
|
|
|
|
|
"""
|
|
|
|
|
Starting at the specified address, dump N words
|
|
|
|
|
(default 32).
|
|
|
|
|
"""
|
|
|
|
|
return dX(2, int(address), int(count))
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.ParsedCommand
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def dd(address, count=16):
|
|
|
|
|
"""
|
|
|
|
|
Starting at the specified address, dump N dwords
|
|
|
|
|
(default 16).
|
|
|
|
|
"""
|
|
|
|
|
return dX(4, int(address), int(count))
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.ParsedCommand
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def dq(address, count=8):
|
|
|
|
|
"""
|
|
|
|
|
Starting at the specified address, dump N qwords
|
|
|
|
|
(default 8).
|
|
|
|
|
"""
|
|
|
|
|
return dX(8, int(address), int(count))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -81,32 +97,49 @@ def enhex(size, value):
|
|
|
|
|
@pwndbg.commands.Command
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def eb(address, *data):
|
|
|
|
|
"""
|
|
|
|
|
Write hex bytes at the specified address.
|
|
|
|
|
"""
|
|
|
|
|
return eX(1, address, data)
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.Command
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def ew(address, *data):
|
|
|
|
|
"""
|
|
|
|
|
Write hex words at the specified address.
|
|
|
|
|
"""
|
|
|
|
|
return eX(2, address, data)
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.Command
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def ed(address, *data):
|
|
|
|
|
"""Edits DWORDs"""
|
|
|
|
|
"""
|
|
|
|
|
Write hex dwords at the specified address.
|
|
|
|
|
"""
|
|
|
|
|
return eX(4, address, data)
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.Command
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def eq(address, *data):
|
|
|
|
|
"""
|
|
|
|
|
Write hex qwords at the specified address.
|
|
|
|
|
"""
|
|
|
|
|
return eX(8, address, data)
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.Command
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def ez(address, *data):
|
|
|
|
|
"""
|
|
|
|
|
Write a string at the specified address.
|
|
|
|
|
"""
|
|
|
|
|
return eX(1, address, data[0], hex=False)
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.Command
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def eza(address, *data):
|
|
|
|
|
"""
|
|
|
|
|
Write a string at the specified address.
|
|
|
|
|
"""
|
|
|
|
|
return ez(address, data)
|
|
|
|
|
|
|
|
|
|
def eX(size, address, data, hex=True):
|
|
|
|
|
@ -126,32 +159,50 @@ def eX(size, address, data, hex=True):
|
|
|
|
|
@pwndbg.commands.ParsedCommand
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def dds(*a):
|
|
|
|
|
"""
|
|
|
|
|
Dump pointers and symbols at the specified address.
|
|
|
|
|
"""
|
|
|
|
|
return pwndbg.commands.telescope.telescope(*a)
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.ParsedCommand
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def dps(*a):
|
|
|
|
|
"""
|
|
|
|
|
Dump pointers and symbols at the specified address.
|
|
|
|
|
"""
|
|
|
|
|
return pwndbg.commands.telescope.telescope(*a)
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.ParsedCommand
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def dqs(*a):
|
|
|
|
|
"""
|
|
|
|
|
Dump pointers and symbols at the specified address.
|
|
|
|
|
"""
|
|
|
|
|
return pwndbg.commands.telescope.telescope(*a)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.ParsedCommand
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def da(address):
|
|
|
|
|
"""
|
|
|
|
|
Dump a string at the specified address.
|
|
|
|
|
"""
|
|
|
|
|
print("%x" % address, pwndbg.strings.get(address))
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.ParsedCommand
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def bl():
|
|
|
|
|
"""
|
|
|
|
|
List breakpoints
|
|
|
|
|
"""
|
|
|
|
|
gdb.execute('info breakpoints')
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.Command
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def bd(which = '*'):
|
|
|
|
|
"""
|
|
|
|
|
Disable the breapoint with the specified index.
|
|
|
|
|
"""
|
|
|
|
|
if which == '*':
|
|
|
|
|
gdb.execute('disable breakpoints')
|
|
|
|
|
else:
|
|
|
|
|
@ -160,7 +211,10 @@ def bd(which = '*'):
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.Command
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def bd(which = '*'):
|
|
|
|
|
def be(which = '*'):
|
|
|
|
|
"""
|
|
|
|
|
Enable the breapoint with the specified index.
|
|
|
|
|
"""
|
|
|
|
|
if which == '*':
|
|
|
|
|
gdb.execute('enable breakpoints')
|
|
|
|
|
else:
|
|
|
|
|
@ -169,6 +223,9 @@ def bd(which = '*'):
|
|
|
|
|
@pwndbg.commands.Command
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def bc(which = '*'):
|
|
|
|
|
"""
|
|
|
|
|
Clear the breapoint with the specified index.
|
|
|
|
|
"""
|
|
|
|
|
if which == '*':
|
|
|
|
|
gdb.execute('delete breakpoints')
|
|
|
|
|
else:
|
|
|
|
|
@ -178,16 +235,18 @@ def bc(which = '*'):
|
|
|
|
|
@pwndbg.commands.ParsedCommand
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def bp(where):
|
|
|
|
|
gdb.execute('break *%#x' % int(where))
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.ParsedCommand
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def bp(where):
|
|
|
|
|
"""
|
|
|
|
|
Set a breakpoint
|
|
|
|
|
"""
|
|
|
|
|
gdb.execute('break *%#x' % int(where))
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.ParsedCommand
|
|
|
|
|
@pwndbg.commands.OnlyWhenRunning
|
|
|
|
|
def u(where=None, n=5):
|
|
|
|
|
"""
|
|
|
|
|
Starting at the specified address, disassemble
|
|
|
|
|
N instructions (default 5).
|
|
|
|
|
"""
|
|
|
|
|
if where is None:
|
|
|
|
|
where = pwndbg.regs.pc
|
|
|
|
|
cmd = 'x/%ii %#x' % (int(n), int(where))
|
|
|
|
|
|