Skip to content

Commit

Permalink
encoders: support avoid == bytes in error message (#1877)
Browse files Browse the repository at this point in the history
* encoders: support `avoid == bytes` in error message

* update changelog

* Update pwnlib/encoders/encoder.py

Co-authored-by: Arusekk <[email protected]>

Co-authored-by: Arusekk <[email protected]>
  • Loading branch information
huntergregal and Arusekk authored May 7, 2021
1 parent c7119c7 commit 21d1cd0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 21d1cd0

Please sign in to comment.