Last active
September 3, 2021 16:27
-
-
Save alexander-hanel/a3eeef8f665ddd0a80cb59a3da8848b8 to your computer and use it in GitHub Desktop.
ctypes from buffer example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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