From 48f19520614000f72ad2226199fe316f63204b07 Mon Sep 17 00:00:00 2001 From: heapcrash Date: Mon, 27 Jul 2020 18:56:11 -0500 Subject: [PATCH 1/4] [shellcraft] Avoid recursive walk of all templates for command line Fixes #1650 --- pwnlib/commandline/shellcraft.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pwnlib/commandline/shellcraft.py b/pwnlib/commandline/shellcraft.py index 7def3de55..1e8c57543 100644 --- a/pwnlib/commandline/shellcraft.py +++ b/pwnlib/commandline/shellcraft.py @@ -198,7 +198,9 @@ def main(args): common.parser.print_usage() exit() - if args.shellcode not in shellcraft.templates: + try: + template = 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) From 0d317e52ecb5738d5c2ab79c9451f170d9c7fa62 Mon Sep 17 00:00:00 2001 From: heapcrash Date: Mon, 27 Jul 2020 18:59:17 -0500 Subject: [PATCH 2/4] Avoid double-fetch --- pwnlib/commandline/shellcraft.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pwnlib/commandline/shellcraft.py b/pwnlib/commandline/shellcraft.py index 1e8c57543..26d0376f2 100644 --- a/pwnlib/commandline/shellcraft.py +++ b/pwnlib/commandline/shellcraft.py @@ -199,12 +199,10 @@ def main(args): exit() try: - template = get_template(args.shellcode) + 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 = [] From 4180de8217c1276aaca0c51e1b3f9c8d84453bd1 Mon Sep 17 00:00:00 2001 From: heapcrash Date: Mon, 27 Jul 2020 19:01:32 -0500 Subject: [PATCH 3/4] Add changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68ea2ce6a..7864e94ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`) From a88aa5b29f300c643514fb1bf56a92d5083bb045 Mon Sep 17 00:00:00 2001 From: heapcrash Date: Mon, 27 Jul 2020 19:06:48 -0500 Subject: [PATCH 4/4] [pylint] Only warn for additions --- .github/workflows/pylint.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 0c3612d1e..9d62fbf3e 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -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 \ No newline at end of file + if diff base.txt current.txt | grep '>'; then + false + fi