Add pwndbg config command to dump configuration values

pwndbg> set emulate off
Set Unicorn emulation of code near the current instruction to False
pwndbg> config
Name                 Value (Def)     Documentation
--------------------------------------------------
emulate              False (True)    Unicorn emulation of code near the current instruction
hexdump_bytes        64              number of bytes printed by hexdump command
hexdump_width        16              line width of hexdump command
telescope_lines      8               number of lines to printed by the telescope command
pull/50/merge
Zach Riggle 10 years ago
parent dfa8ed8c5a
commit 8633967037

@ -63,6 +63,7 @@ import pwndbg.commands.gdbinit
import pwndbg.commands.defcon import pwndbg.commands.defcon
import pwndbg.commands.elf import pwndbg.commands.elf
import pwndbg.commands.checksec import pwndbg.commands.checksec
import pwndbg.commands.config
__all__ = [ __all__ = [

@ -0,0 +1,31 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Dumps all pwndbg-specific configuration points.
"""
import pwndbg.commands
import pwndbg.config
def print_row(name, value, default, docstring):
name = name.ljust(20)
if value != default:
defval = '%s (%s)' % (value, default)
else:
defval = value
defval = defval.ljust(15)
result = ' '.join((name, defval, docstring))
print(result)
return result
@pwndbg.commands.Command
def config():
"""Shows pwndbg-specific configuration points"""
header = print_row('Name','Value', 'Def', 'Documentation')
print('-' * (len(header)))
for k,v in sorted(pwndbg.config.__dict__.items()):
if not isinstance(v, pwndbg.config.Parameter):
continue
print_row(v.name, repr(v.value), repr(v.default), v.docstring)
Loading…
Cancel
Save