Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ The table below shows which release corresponds to each branch, and what date th
- [#2504][2504] doc: add example case for `tuple` (host, port pair) in `gdb.attach`
- [#2546][2546] ssh: Allow passing disabled_algorithms keyword argument from ssh to paramiko
- [#2538][2538] Add `ssh -L` / `ssh.connect_remote()` workaround when `AllowTcpForwarding` is disabled
- [#2572][2572] Add new debian database in libcd

[2551]: https://github.com/Gallopsled/pwntools/pull/2551
[2519]: https://github.com/Gallopsled/pwntools/pull/2519
Expand Down
15 changes: 12 additions & 3 deletions pwnlib/libcdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,15 @@ def _extract_pkgfile(cache_dir, package_filename, package):
def _find_libc_package_lib_url(libc):
# Check https://libc.rip for the libc package
libc_match = query_libc_rip({'buildid': enhex(libc.buildid)})
maybe_deb_version = None
if libc_match is not None:
for match in libc_match:
# Allow to override url with a caching proxy in CI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need this in our testing pipeline to get a speedup.

ubuntu_archive_url = os.environ.get('PWN_UBUNTU_ARCHIVE_URL', 'http://archive.ubuntu.com').rstrip('/')
yield match['libs_url'].replace('http://archive.ubuntu.com', ubuntu_archive_url)

url = match['libs_url']
if "deb.debian.org/debian" in url:
maybe_deb_version = url
yield url

# Check launchpad.net if it's an Ubuntu libc
# GNU C Library (Ubuntu GLIBC 2.36-0ubuntu4)
import re
Expand All @@ -515,6 +518,12 @@ def _find_libc_package_lib_url(libc):
libc_version = version.group(1).decode()
yield 'https://launchpad.net/ubuntu/+archive/primary/+files/libc6_{}_{}.deb'.format(libc_version, libc.arch)

# check debian.sipwise.com if it's a debian libc
if maybe_deb_version is not None:
maybe_deb_version = maybe_deb_version.split('/')[-1]
if maybe_deb_version is not None:
yield 'https://debian.sipwise.com/debian-security/pool/main/g/glibc/{}'.format(maybe_deb_version)

def download_libraries(libc_path, unstrip=True):
"""download_libraries(str, bool) -> str
Download the matching libraries for the given libc binary and cache
Expand Down