Skip to content

Instantly share code, notes, and snippets.

@alexander-hanel
Last active September 3, 2021 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexander-hanel/a3eeef8f665ddd0a80cb59a3da8848b8 to your computer and use it in GitHub Desktop.
Save alexander-hanel/a3eeef8f665ddd0a80cb59a3da8848b8 to your computer and use it in GitHub Desktop.
ctypes from buffer example
class COFFSYMBOLTABLE(ctypes.Structure):
"""
Described in [PE-COFF] 5.4. Coff Symbol Table
"""
_pack_ = 1
_fields_ = [
("zeroes", ctypes.c_uint), ("offset", ctypes.c_uint), ("value", ctypes.c_uint),
("section_number", ctypes.c_short), ("type", ctypes.c_ushort), ("storage_class", ctypes.c_ubyte),
("number_aux_symbols", ctypes.c_ubyte)
]
def __new__(cls, buffer):
return cls.from_buffer_copy(buffer)
def __init__(self, data):
# self.zeroes
pass
p_data = COFFSYMBOLTABLE(coff_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment