Files

40 lines
768 B
Python

import argparse
import sys
from pwn import *
from pwnlib.commandline import common
parser = common.parser_commands.add_parser(
'checksec',
help = 'Check binary security settings',
description = 'Check binary security settings',
)
parser.add_argument(
'elf',
nargs='*',
help='Files to check'
)
parser.add_argument(
'--file',
nargs='*',
dest='elf2',
metavar='elf',
help='File to check (for compatibility with checksec.sh)'
)
def main(args):
files = args.elf or args.elf2 or []
if not files:
parser.print_usage()
return
for f in files:
try:
e = ELF(f)
except Exception as e:
print(f"{f}: {e}")
if __name__ == '__main__':
common.main(__file__, main)