Skip to content

Commit d7817a7

Browse files
authored
Nicely handle non ELF files in checksec (#2457)
1 parent df620d7 commit d7817a7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ The table below shows which release corresponds to each branch, and what date th
7373
## 4.15.0 (`dev`)
7474

7575
- [#2358][2358] Cache output of `asm()`
76+
- [#2457][2457] Catch exception of non-ELF files in checksec.
7677

7778
[2358]: https://github.com/Gallopsled/pwntools/pull/2358
79+
[2457]: https://github.com/Gallopsled/pwntools/pull/2457
7880

7981
## 4.14.0 (`beta`)
8082

pwnlib/commandline/checksec.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ def main(args):
3535
return
3636

3737
for f in files:
38-
e = ELF(f.name)
38+
try:
39+
e = ELF(f.name)
40+
except Exception as e:
41+
print("{name}: {error}".format(name=f.name, error=e))
3942

4043
if __name__ == '__main__':
4144
common.main(__file__)

0 commit comments

Comments
 (0)