Skip to content

Commit

Permalink
Fix PLT emulation with Unicorn 2.1.0 (#2466)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
peace-maker authored Sep 25, 2024
1 parent 149ebe0 commit 3e9849f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ The table below shows which release corresponds to each branch, and what date th
## 4.13.1

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

[2445]: https://github.com/Gallopsled/pwntools/pull/2445
[2466]: https://github.com/Gallopsled/pwntools/pull/2466

## 4.13.0 (`stable`)

Expand Down
4 changes: 2 additions & 2 deletions pwnlib/elf/plt.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ def hook_mem(uc, access, address, size, value, user_data):
return False

hooks = [
uc.hook_add(U.UC_HOOK_MEM_READ | U.UC_HOOK_MEM_READ_UNMAPPED,
hook_mem, stopped_addr),
uc.hook_add(U.UC_HOOK_MEM_READ, hook_mem, stopped_addr),
uc.hook_add(U.UC_HOOK_MEM_READ_UNMAPPED, hook_mem, stopped_addr),
]

# callback for tracing instructions
Expand Down
2 changes: 1 addition & 1 deletion pwnlib/tubes/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2030,7 +2030,7 @@ def user_shstk(self):
Example:
>>> s = ssh("travis", "example.pwnme")
>>> s.user_shstk
>>> s.user_shstk # doctest: +SKIP
False
"""
if self._user_shstk is None:
Expand Down
9 changes: 6 additions & 3 deletions pwnlib/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ def available_on_pypi(prerelease=current_version.is_prerelease):
False
"""
# Deferred import to save startup time
from six.moves.xmlrpc_client import ServerProxy
import requests

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

versions = map(packaging.version.Version, versions)
Expand Down

0 comments on commit 3e9849f

Please sign in to comment.