|
|
|
@ -64,6 +64,11 @@ parser = argparse.ArgumentParser(
|
|
|
|
Prints out a list of all pwndbg commands. The list can be optionally filtered if filter_pattern is passed.
|
|
|
|
Prints out a list of all pwndbg commands. The list can be optionally filtered if filter_pattern is passed.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
group = parser.add_mutually_exclusive_group()
|
|
|
|
|
|
|
|
group.add_argument("--shell", action="store_true", help="Only display shell commands")
|
|
|
|
|
|
|
|
group.add_argument("--all", dest="all_", action="store_true", help="Only display shell commands")
|
|
|
|
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
parser.add_argument(
|
|
|
|
"filter_pattern",
|
|
|
|
"filter_pattern",
|
|
|
|
type=str,
|
|
|
|
type=str,
|
|
|
|
@ -74,8 +79,18 @@ parser.add_argument(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pwndbg.commands.ArgparsedCommand(parser, command_name="pwndbg")
|
|
|
|
@pwndbg.commands.ArgparsedCommand(parser, command_name="pwndbg")
|
|
|
|
def pwndbg_(filter_pattern):
|
|
|
|
def pwndbg_(filter_pattern, shell, all_):
|
|
|
|
for name, docs in list_and_filter_commands(filter_pattern):
|
|
|
|
if all_:
|
|
|
|
|
|
|
|
shell_cmds = True
|
|
|
|
|
|
|
|
pwndbg_cmds = True
|
|
|
|
|
|
|
|
elif shell:
|
|
|
|
|
|
|
|
shell_cmds = True
|
|
|
|
|
|
|
|
pwndbg_cmds = False
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
shell_cmds = False
|
|
|
|
|
|
|
|
pwndbg_cmds = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for name, docs in list_and_filter_commands(filter_pattern, pwndbg_cmds, shell_cmds):
|
|
|
|
print("%-20s %s" % (name, docs))
|
|
|
|
print("%-20s %s" % (name, docs))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -98,7 +113,7 @@ def distance(a, b):
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def list_and_filter_commands(filter_str):
|
|
|
|
def list_and_filter_commands(filter_str, pwndbg_cmds=True, shell_cmds=False):
|
|
|
|
sorted_commands = list(pwndbg.commands.commands)
|
|
|
|
sorted_commands = list(pwndbg.commands.commands)
|
|
|
|
sorted_commands.sort(key=lambda x: x.__name__)
|
|
|
|
sorted_commands.sort(key=lambda x: x.__name__)
|
|
|
|
|
|
|
|
|
|
|
|
@ -108,6 +123,14 @@ def list_and_filter_commands(filter_str):
|
|
|
|
results = []
|
|
|
|
results = []
|
|
|
|
|
|
|
|
|
|
|
|
for c in sorted_commands:
|
|
|
|
for c in sorted_commands:
|
|
|
|
|
|
|
|
# If this is a shell command and we didn't ask for shell commands, skip it
|
|
|
|
|
|
|
|
if c.shell and not shell_cmds:
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If this is a normal command and we didn't ask for normal commands, skip it
|
|
|
|
|
|
|
|
if not c.shell and not pwndbg_cmds:
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
name = c.__name__
|
|
|
|
name = c.__name__
|
|
|
|
docs = c.__doc__
|
|
|
|
docs = c.__doc__
|
|
|
|
|
|
|
|
|
|
|
|
|