diff --git a/pwndbg/__init__.py b/pwndbg/__init__.py index e236cdca8..a504a945f 100755 --- a/pwndbg/__init__.py +++ b/pwndbg/__init__.py @@ -63,6 +63,7 @@ import pwndbg.commands.gdbinit import pwndbg.commands.defcon import pwndbg.commands.elf import pwndbg.commands.checksec +import pwndbg.commands.config __all__ = [ diff --git a/pwndbg/commands/config.py b/pwndbg/commands/config.py new file mode 100644 index 000000000..d5822e868 --- /dev/null +++ b/pwndbg/commands/config.py @@ -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)