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

encoders: support avoid == bytes in error message #1877

Merged
merged 3 commits into from May 7, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -70,6 +70,7 @@ The table below shows which release corresponds to each branch, and what date th
- [#1753][1753] major change: less unconditional imports in pwnlib
- [#1776][1776] mips: do not use $t0 temporary variable in dupio
- [#1846][1846] support launching GDB in more different terminals
- [#1877][1877] encoders error message handles when `avoid` is bytes in python3

[1429]: https://github.com/Gallopsled/pwntools/pull/1429
[1566]: https://github.com/Gallopsled/pwntools/pull/1566
Expand All @@ -80,6 +81,7 @@ The table below shows which release corresponds to each branch, and what date th
[1753]: https://github.com/Gallopsled/pwntools/pull/1753
[1776]: https://github.com/Gallopsled/pwntools/pull/1776
[1846]: https://github.com/Gallopsled/pwntools/pull/1846
[1877]: https://github.com/Gallopsled/pwntools/pull/1877

## 4.6.0 (`beta`)

Expand Down
2 changes: 1 addition & 1 deletion pwnlib/encoders/encoder.py
Expand Up @@ -97,7 +97,7 @@ def encode(raw_bytes, avoid=None, expr=None, force=0, pcreg=''):
elif expr:
avoid_errmsg = repr(expr)
else:
avoid_errmsg = ''.join(avoid)
avoid_errmsg = repr(bytes(avoid))

args = (context.arch, avoid_errmsg, hexdump(raw_bytes))
msg = "No encoders for %s which can avoid %s for\n%s" % args
Expand Down