diff --git a/pwndbg/__init__.py b/pwndbg/__init__.py index f5d66fc9ef6..a7773199000 100755 --- a/pwndbg/__init__.py +++ b/pwndbg/__init__.py @@ -61,8 +61,8 @@ import pwndbg.commands.peda import pwndbg.commands.gdbinit import pwndbg.commands.defcon -import pwndbg.commands.elf - +import pwndbg.commands.elfheader +import pwndbg.commands.checksec __all__ = [ diff --git a/pwndbg/commands/checksec.py b/pwndbg/commands/checksec.py new file mode 100755 index 00000000000..b40b059dc0d --- /dev/null +++ b/pwndbg/commands/checksec.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import gdb +import pwndbg.commands + +import subprocess + +@pwndbg.commands.Command +def checksec(): + ''' + Prints out the binary security settings. Attempts to call the binjitsu + checksec first, and then falls back to checksec.sh. + ''' + #local_path = pwndbg.file.get_file(pwndbg.proc.exe) + local_path = pwndbg.proc.exe + try: + subprocess.call(['checksec', local_path]) + except: + try: + subprocess.call(['checksec.sh', '--file', local_path]) + except: + print(pwndbg.color.red( + 'An error occurred when calling checksec. ' \ + 'Make sure the checksec binary is in your PATH.' + ))