Skip to content

Instantly share code, notes, and snippets.

@Jongy
Jongy / dis.py
Created July 13, 2021 17:15
dis.py - quickly disassemble short binary sequences
import subprocess
import binascii
import tempfile
def dis(s):
if not isinstance(s, bytes):
s = binascii.unhexlify(s.replace(" ", "").strip())
with tempfile.NamedTemporaryFile("wb") as f:
f.write(s)
@Jongy
Jongy / modversions.py
Created September 7, 2021 21:13
List symbols & their CRCs in a Linux kernel module file
#!/usr/bin/env python3
import sys
import subprocess
import tempfile
import struct
def get_modversions(module):
with tempfile.NamedTemporaryFile("rb") as tf:
subprocess.check_call(["objcopy", "-O", "binary", "--only-section=__versions", module, tf.name])
@Jongy
Jongy / required_glibc_version.py
Created February 23, 2022 01:15
Required glibc version of a binary
import subprocess
import sys
from packaging.version import Version
def main(argv):
if len(argv) != 2:
print(f"usage: {argv[0]} <elf>")
sys.exit(1)