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

Fix passing bytes to context.log_file and crc.BitPolynom #2389

Merged
merged 3 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -77,13 +77,15 @@ The table below shows which release corresponds to each branch, and what date th
- [#2327][2327] Add basic support to debug processes on Windows
- [#2322][2322] Add basic RISCV64 shellcraft support
- [#2330][2330] Change `context.newline` when setting `context.os` to `"windows"`
- [#2389][2389] Fix incosistent usage of bytes/str

[2360]: https://github.com/Gallopsled/pwntools/pull/2360
[2356]: https://github.com/Gallopsled/pwntools/pull/2356
[2374]: https://github.com/Gallopsled/pwntools/pull/2374
[2327]: https://github.com/Gallopsled/pwntools/pull/2327
[2322]: https://github.com/Gallopsled/pwntools/pull/2322
[2330]: https://github.com/Gallopsled/pwntools/pull/2330
[2389]: https://github.com/Gallopsled/pwntools/pull/2389

## 4.13.0 (`beta`)

Expand Down
2 changes: 2 additions & 0 deletions pwnlib/context/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,8 @@ def log_file(self, value):
"""
if isinstance(value, (bytes, six.text_type)):
# check if mode was specified as "[value],[mode]"
from pwnlib.util.packing import _need_text
value = _need_text(value)
if ',' not in value:
value += ',a'
filename, mode = value.rsplit(',', 1)
Expand Down
2 changes: 2 additions & 0 deletions pwnlib/util/crc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class BitPolynom(object):

def __init__(self, n):
if isinstance(n, (bytes, six.text_type)):
from pwnlib.util.packing import _need_text
n = _need_text(n)
self.n = 0
x = BitPolynom(2)
try:
Expand Down