Skip to content

Commit

Permalink
[shellcraft] Avoid recursive walk of all templates for command line (#…
Browse files Browse the repository at this point in the history
…1651)

* [shellcraft] Avoid recursive walk of all templates for command line

Fixes #1650

* Avoid double-fetch

* Add changelog

* [pylint] Only warn for additions
  • Loading branch information
heapcrash committed Jul 28, 2020
1 parent b6fc0f3 commit 8080af8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/pylint.yml
Expand Up @@ -31,4 +31,6 @@ jobs:
git fetch origin
git checkout origin/"$GITHUB_BASE_REF"
pylint --exit-zero --errors-only pwnlib > base.txt
diff base.txt current.txt
if diff base.txt current.txt | grep '>'; then
false
fi
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -63,12 +63,14 @@ The table below shows which release corresponds to each branch, and what date th
- [#1632][1632] Enable usage of Pwntools in jupyter
- [#1633][1633] Open a shell if `pwn template` cannot download the remote file
- [#1644][1644] Enable and support SNI for SSL-wrapped tubes
- [#1651][1651] Make `pwn shellcraft` faster

[1602]: https://github.com/Gallopsled/pwntools/pull/1602
[1606]: https://github.com/Gallopsled/pwntools/pull/1606
[1616]: https://github.com/Gallopsled/pwntools/pull/1616
[1632]: https://github.com/Gallopsled/pwntools/pull/1632
[1633]: https://github.com/Gallopsled/pwntools/pull/1633
[1651]: https://github.com/Gallopsled/pwntools/pull/1651

## 4.3.0 (`beta`)

Expand Down
6 changes: 3 additions & 3 deletions pwnlib/commandline/shellcraft.py
Expand Up @@ -198,11 +198,11 @@ def main(args):
common.parser.print_usage()
exit()

if args.shellcode not in shellcraft.templates:
try:
func = get_template(args.shellcode)
except AttributeError:
log.error("Unknown shellcraft template %r. Use --list to see available shellcodes." % args.shellcode)

func = get_template(args.shellcode)

if args.show:
# remove doctests
doc = []
Expand Down

0 comments on commit 8080af8

Please sign in to comment.