dissect.executable.elf

Submodules

Package Contents

Classes

ELF

Section

SectionTable

Abstract base class for generic types.

Segment

SegmentTable

Abstract base class for generic types.

StringTable

Symbol

SymbolTable

Abstract base class for generic types.

class dissect.executable.elf.ELF(fh: BinaryIO)
fh
e_ident
c_elf
header
segments
section_table
symbol_tables: list[SymbolTable]
__repr__() str
dump() bytes
property dynamic: bool
class dissect.executable.elf.Section(fh: BinaryIO, idx: int | None = None, c_elf: dissect.cstruct.cstruct = c_elf_64)
fh
idx = None
c_elf
header
type
entry_size
alignment
offset
size
__repr__() str
classmethod from_section_table(section_table: SectionTable, idx: int) Section
property name: str | None
property contents: bytes
class dissect.executable.elf.SectionTable(fh: BinaryIO, offset: int, entries: int, size: int, string_index: int | None = None, c_elf: dissect.cstruct.cstruct = c_elf_64)

Bases: Table[Section]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
fh
offset
size
string_table = None
c_elf
__repr__() str
classmethod from_elf(elf: ELF) SectionTable
by_type(section_types: list[int] | int) list[Section]
related_sections(segment: Segment) list[Section]
by_name(name: str) list[Section]
dump_table() tuple[int, bytes]
dump_data() list[tuple[int, bytes]]
class dissect.executable.elf.Segment(fh: BinaryIO, idx: int | None = None, c_elf: dissect.cstruct.cstruct = c_elf_64)
fh
idx = None
c_elf
header
type
flags
virtual_address
physical_address
memory_size
alignment
offset
size
patched = False
__repr__() str
classmethod from_segment_table(table: SegmentTable, idx: int | None = None) Segment
property end: int
property contents: bytes
patch(new_data: bytes) None
class dissect.executable.elf.SegmentTable(fh: BinaryIO, offset: int, entries: int, size: int, c_elf: dissect.cstruct.cstruct = c_elf_64)

Bases: Table[Segment]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
fh
offset
size
c_elf
__repr__() str
classmethod from_elf(elf: ELF) SegmentTable
related_segments(section: Section) list[Segment]
by_type(segment_types: list[int] | int) list[Segment]
dump_data() list[tuple[int, bytearray]]
dump_table() tuple[int, bytearray]
class dissect.executable.elf.StringTable(fh: BinaryIO, idx: int | None = None, c_elf: dissect.cstruct.cstruct = c_elf_64)

Bases: Section

__getitem__(offset: int) str
class dissect.executable.elf.Symbol(fh: BinaryIO, idx: int | None = None, c_elf: dissect.cstruct.cstruct = c_elf_64)
symbol
idx = None
c_elf
bind
type
size
visibility
__repr__() str
classmethod from_symbol_table(table: SymbolTable, idx: int) Symbol
property name: str
property value: int
value_based_on_shndx(table: SectionTable) int
class dissect.executable.elf.SymbolTable(fh: BinaryIO, idx: int | None = None, c_elf: dissect.cstruct.cstruct = c_elf_64)

Bases: Section, Table[Symbol]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default