Skip to content

Commit

Permalink
Added checksec command
Browse files Browse the repository at this point in the history
(cherry picked from commit 2eeeb0d)
  • Loading branch information
gsingh93 authored and zachriggle committed Jun 6, 2016
1 parent 6e0fec8 commit 1c6466d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pwndbg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = [
Expand Down
25 changes: 25 additions & 0 deletions pwndbg/commands/checksec.py
Original file line number Diff line number Diff line change
@@ -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.'
))

0 comments on commit 1c6466d

Please sign in to comment.