Skip to content

Instantly share code, notes, and snippets.

@markrwilliams
Created September 19, 2014 16:30
Show Gist options
  • Save markrwilliams/86d882b61a616c761191 to your computer and use it in GitHub Desktop.
Save markrwilliams/86d882b61a616c761191 to your computer and use it in GitHub Desktop.
import ctypes
libc = ctypes.CDLL('libc.so.6')
def libc_version():
# 2 appears to be _CS_GNU_LIBC_VERSION
length = libc.confstr(2, None, 0)
version = ctypes.create_string_buffer(length)
assert length == libc.confstr(2, ctypes.byref(version), length)
return version.value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment