Skip to content

Commit 0499631

Browse files
peace-makerArusekk
authored andcommitted
Fix failing libcdb.unstrip_libc tests (Gallopsled#2196)
* Fix libcdb.unstrip_libc tests The old debugsymbols seem to have been pruned. Update hashes to recent Ubuntu 22.04 libcs. * Switch wget test to httpbingo.org httpbin.org is very slow to respond. Cherry-picked from 1998ff0
1 parent c45e92d commit 0499631

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

pwnlib/libcdb.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
log = getLogger(__name__)
2626

2727
HASHES = ['build_id', 'sha1', 'sha256', 'md5']
28-
DEBUGINFOD_SERVERS = ['https://debuginfod.systemtap.org/']
28+
DEBUGINFOD_SERVERS = [
29+
'https://debuginfod.systemtap.org',
30+
'https://debuginfod.ubuntu.com',
31+
] + os.environ.get('DEBUGINFOD_SERVERS', '').split()
2932

3033
# https://gitlab.com/libcdb/libcdb wasn't updated after 2019,
3134
# but still is a massive database of older libc binaries.
@@ -202,20 +205,18 @@ def unstrip_libc(filename):
202205
:const:`True` if binary was unstripped, :const:`False` otherwise.
203206
204207
Examples:
205-
>>> filename = search_by_build_id('2d1c5e0b85cb06ff47fa6fa088ec22cb6e06074e', unstrip=False)
208+
>>> filename = search_by_build_id('69389d485a9793dbe873f0ea2c93e02efaa9aa3d', unstrip=False)
206209
>>> libc = ELF(filename)
207-
>>> hex(libc.symbols.read)
208-
'0xe56c0'
209210
>>> 'main_arena' in libc.symbols
210211
False
211212
>>> unstrip_libc(filename)
212213
True
213214
>>> libc = ELF(filename)
214215
>>> hex(libc.symbols.main_arena)
215-
'0x1d57a0'
216+
'0x219c80'
216217
>>> unstrip_libc(which('python'))
217218
False
218-
>>> filename = search_by_build_id('06a8004be6e10c4aeabbe0db74423ace392a2d6b', unstrip=True)
219+
>>> filename = search_by_build_id('d1704d25fbbb72fa95d517b883131828c0883fe9', unstrip=True)
219220
>>> 'main_arena' in ELF(filename).symbols
220221
True
221222
"""

pwnlib/util/web.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def wget(url, save=None, timeout=5, **kwargs):
2525
2626
Example:
2727
28-
>>> url = 'https://httpbin.org/robots.txt'
28+
>>> url = 'https://httpbingo.org/robots.txt'
2929
>>> result = wget(url, timeout=60)
3030
>>> result
3131
b'User-agent: *\nDisallow: /deny\n'

0 commit comments

Comments
 (0)