You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pwndbg/pwndbg/commands/ghidra.py

25 lines
563 B
Python

import argparse
import pwndbg.color.message as message
import pwndbg.commands
import pwndbg.ghidra
parser = argparse.ArgumentParser()
parser.description = """Decompile a given function using ghidra"""
parser.add_argument(
"func",
type=str,
default=None,
nargs="?",
help="Function to be decompiled. Defaults to the current function.",
)
@pwndbg.commands.OnlyWithFile
@pwndbg.commands.ArgparsedCommand(parser)
def ghidra(func):
try:
print(pwndbg.ghidra.decompile(func))
except Exception as e:
print(message.error(e))