COFF


Introduction

import lief

# Using a filepath as a string
coff: lief.COFF.Binary = lief.COFF.parse("hello.obj")

# Using a Path from pathlib
coff: lief.COFF.Binary = lief.COFF.parse(pathlib.Path(r"C:\Users\romain\test.obj"))

# Using a io object
with open("/tmp/test.ob", 'rb') as f:
    coff: lief.COFF.Binary = lief.COFF.parse(f)
These functions return a instance that exposes the main API to process and access COFF information:
coff: lief.COFF.Binary = ...

for section in coff.sections:
    print(section.name)

Disassembler

coff: lief.COFF.Binary = ...

for inst in coff.disassemble("?foo@@YAHHH@Z")
    print(inst)

# Using demangled representation
for inst in coff.disassemble("int __cdecl bar(int, int)")
    print(inst)