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

libcdb-cli: add --offline-only, refactor unstrip and add fetch parser for download libc-database #2478

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from

Conversation

the-soloist
Copy link
Contributor

  1. make unstrip as default behavior, except file parser
  2. add return_raw for search_by_symbol_offsets
  3. add fetch arg parser to download and update libc-database

path = libcdb.search_by_build_id(libc['buildid'], args.unstrip)
if path:
if args.unstrip:
libcdb.unstrip_libc(path)
Copy link
Member

Choose a reason for hiding this comment

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

Removing this causes cached libcs to not be unstripped even when unstrip was set.

Copy link
Contributor Author

@the-soloist the-soloist Oct 2, 2024

Choose a reason for hiding this comment

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

It will unstrip in search_by_hash (called by search_by_build_id)

pwntools/pwnlib/libcdb.py

Lines 283 to 285 in b08f4b7

# Try to find debug info for this libc.
if unstrip:
unstrip_libc(cache)

Copy link
Member

Choose a reason for hiding this comment

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

It won't if the file was downloaded before and is cached without debug symbols.

pwntools/pwnlib/libcdb.py

Lines 255 to 257 in b08f4b7

cache, cache_valid = _check_elf_cache('libcdb', search_target, search_type)
if cache_valid:
return cache

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I overlooked that. But why not unstrip before return cache?

Copy link
Member

Choose a reason for hiding this comment

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

True, that's the better place to put this!

CHANGELOG.md Outdated Show resolved Hide resolved
@the-soloist the-soloist changed the title libcdb-cli: changes for previous updates libcdb-cli: add --offline-only, refactor unstrip and add fetch parser for download libc-database Oct 2, 2024
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

Successfully merging this pull request may close these issues.

3 participants