add libcinfo command (#2842)

This command shows libc version of currently debugged binary and link to its sources.

Currently it only supports glibc and shows link to raw/pure gnu.org glibc sources.
Meaning, it does not handle custom/patched glibc versions that may be there on Ubuntu etc.

In the future this command could support other libcs (like musl used by Alpine) or/and display the binary build_id and
maybe a link to libcdb.
pull/2829/head
Disconnect3d 8 months ago committed by GitHub
parent aeefc471dd
commit 5f22de0d71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -750,6 +750,7 @@ def load_commands() -> None:
import pwndbg.commands.knft
import pwndbg.commands.kversion
import pwndbg.commands.leakfind
import pwndbg.commands.libcinfo
import pwndbg.commands.linkmap
import pwndbg.commands.memoize
import pwndbg.commands.misc

@ -0,0 +1,21 @@
from __future__ import annotations
import pwndbg.commands
import pwndbg.glibc
from pwndbg.commands import CommandCategory
@pwndbg.commands.ArgparsedCommand(
"Show libc version and link to its sources", category=CommandCategory.LINUX
)
@pwndbg.commands.OnlyWhenRunning
def libcinfo():
glibc_version = pwndbg.glibc.get_version()
if glibc_version:
glibc_version = ".".join(map(str, glibc_version))
print(f"libc version: {glibc_version}")
print(f"libc source link: https://ftp.gnu.org/gnu/libc/glibc-{glibc_version}.tar.gz")
return
print("Could not determine libc version.")
Loading…
Cancel
Save