Skip to content

Commit 3e9849f

Browse files
authored
Fix PLT emulation with Unicorn 2.1.0 (#2466)
* Fix PLT emulation with Unicorn 2.1.0 You cannot add multiple hooks at once anymore, so add them individually - still to the same callback. https://github.com/unicorn-engine/unicorn/blob/f164769a9a973a3e981f279ed7aa90459ae68545/bindings/python/unicorn/unicorn_py3/unicorn.py#L970-L976 * Update CHANGELOG * Switch to PyPi Simple API for update checks Fault: <Fault -32500: 'RuntimeError: PyPI no longer supports the XMLRPC package_releases method. Use JSON or Simple API instead. See pypi/warehouse#16642 and https://warehouse.pypa.io/api-reference/xml-rpc.html#deprecated-methods for more information.'> * Update CHANGELOG * Disable ssh.user_shstk test Github Actions Runners have userland shadow stack enabled now apparently. Don't test for this system state.
1 parent 149ebe0 commit 3e9849f

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,11 @@ The table below shows which release corresponds to each branch, and what date th
121121
## 4.13.1
122122

123123
- [#2445][2445] Fix parsing the PLT on Windows
124+
- [#2466][2466] Fix PLT emulation with Unicorn 2.1.0
125+
- [#2466][2466] Switch to PyPi Simple API for update checks
124126

125127
[2445]: https://github.com/Gallopsled/pwntools/pull/2445
128+
[2466]: https://github.com/Gallopsled/pwntools/pull/2466
126129

127130
## 4.13.0 (`stable`)
128131

pwnlib/elf/plt.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ def hook_mem(uc, access, address, size, value, user_data):
169169
return False
170170

171171
hooks = [
172-
uc.hook_add(U.UC_HOOK_MEM_READ | U.UC_HOOK_MEM_READ_UNMAPPED,
173-
hook_mem, stopped_addr),
172+
uc.hook_add(U.UC_HOOK_MEM_READ, hook_mem, stopped_addr),
173+
uc.hook_add(U.UC_HOOK_MEM_READ_UNMAPPED, hook_mem, stopped_addr),
174174
]
175175

176176
# callback for tracing instructions

pwnlib/tubes/ssh.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2030,7 +2030,7 @@ def user_shstk(self):
20302030
Example:
20312031
20322032
>>> s = ssh("travis", "example.pwnme")
2033-
>>> s.user_shstk
2033+
>>> s.user_shstk # doctest: +SKIP
20342034
False
20352035
"""
20362036
if self._user_shstk is None:

pwnlib/update.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,15 @@ def available_on_pypi(prerelease=current_version.is_prerelease):
7474
False
7575
"""
7676
# Deferred import to save startup time
77-
from six.moves.xmlrpc_client import ServerProxy
77+
import requests
7878

7979
versions = getattr(available_on_pypi, 'cached', None)
8080
if versions is None:
81-
client = ServerProxy('https://pypi.python.org/pypi')
82-
versions = client.package_releases('pwntools', True)
81+
response = requests.get("https://pypi.org/simple/pwntools/",
82+
headers={"Accept": "application/vnd.pypi.simple.v1+json"},
83+
timeout=5)
84+
response.raise_for_status()
85+
versions = response.json()["versions"]
8386
available_on_pypi.cached = versions
8487

8588
versions = map(packaging.version.Version, versions)

0 commit comments

Comments
 (0)