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

Make pwn template always set context.binary #2279

Merged
merged 5 commits into from
Dec 30, 2023
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ The table below shows which release corresponds to each branch, and what date th
- [#2307][2307] Fix `pwn libcdb file` crashing if "/bin/sh" string was not found
- [#2309][2309] Detect challenge binary and libc in `pwn template`
- [#2308][2308] Fix WinExec shellcraft to make sure it's 16 byte aligned
- [#2279][2279] Make `pwn template` always set context.binary

[2242]: https://github.com/Gallopsled/pwntools/pull/2242
[2277]: https://github.com/Gallopsled/pwntools/pull/2277
Expand All @@ -87,6 +88,7 @@ The table below shows which release corresponds to each branch, and what date th
[2307]: https://github.com/Gallopsled/pwntools/pull/2307
[2309]: https://github.com/Gallopsled/pwntools/pull/2309
[2308]: https://github.com/Gallopsled/pwntools/pull/2308
[2279]: https://github.com/Gallopsled/pwntools/pull/2279

## 4.12.0 (`beta`)

Expand Down
6 changes: 1 addition & 5 deletions pwnlib/data/templates/pwnup.mako
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ from pwn import *
%if not quiet:
# Set up pwntools for the correct architecture
%endif
%if ctx.binary:
%if ctx.binary or not host:
exe = context.binary = ELF(args.EXE or ${binary_repr})
<% binary_repr = 'exe.path' %>
%else:
Expand Down Expand Up @@ -99,11 +99,7 @@ else:
%endif
library_path = libcdb.download_libraries(${libc_repr})
if library_path:
%if ctx.binary:
exe = context.binary = ELF.patch_custom_libraries(${binary_repr}, library_path)
%else:
exe = ELF.patch_custom_libraries(exe, library_path)
%endif
libc = exe.libc
else:
libc = ELF(${libc_repr})
Expand Down
Loading