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

Python 3 Byte String #8

Open
hashlash opened this issue Apr 2, 2020 · 1 comment
Open

Python 3 Byte String #8

hashlash opened this issue Apr 2, 2020 · 1 comment
Assignees

Comments

@hashlash
Copy link

hashlash commented Apr 2, 2020

I think this tutorial needs an update to conform the newest version of pwntools.

One example is on the Utility Function tutorial page, section Packing and Unpacking Integers:

...

hex(unpack('AAAA'))
# '0x41414141'

...

On python3.5 with pwntools==4.2.0dev this will cause problem:

>>> from pwn import *
>>> unpack('AAAA')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/pwnlib/context/__init__.py", line 1461, in setter
    return function(*a, **kw)
  File "/usr/local/lib/python3.5/dist-packages/pwnlib/util/packing.py", line 221, in unpack
    data = bytearray(data)
TypeError: an integer is required

Looking from the commit history, it seems this function requires a byte string instead of normal string on Python 3. Since the last commit on this repo is a948b00 from Oct 10, 2018, I think it's time to have some update.

@heapcrash
Copy link
Contributor

Giving this one to @Arusekk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants