Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checksec: more forgiving when passed directory arguments #2530

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ The table below shows which release corresponds to each branch, and what date th

## 5.0.0 (`dev`)

- [#2530][2530] Do NOT error when passing directory arguments in `checksec`.
- [#2507][2507] Add `+LINUX` and `+WINDOWS` doctest options and start proper testing on Windows
- [#2522][2522] Support starting a kitty debugging window with the 'kitten' command
- [#2524][2524] Raise EOFError during `process.recv` when stdout closes on Windows
Expand Down
8 changes: 3 additions & 5 deletions pwnlib/commandline/checksec.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,28 @@
parser.add_argument(
'elf',
nargs='*',
type=argparse.FileType('rb'),
help='Files to check'
)
parser.add_argument(
'--file',
nargs='*',
dest='elf2',
metavar='elf',
type=argparse.FileType('rb'),
help='File to check (for compatibility with checksec.sh)'
)

def main(args):
files = args.elf or args.elf2 or []
files = args.elf or args.elf2 or []

if not files:
parser.print_usage()
return

for f in files:
try:
e = ELF(f.name)
e = ELF(f)
except Exception as e:
print("{name}: {error}".format(name=f.name, error=e))
print("{name}: {error}".format(name=f, error=e))

if __name__ == '__main__':
common.main(__file__, main)
Loading