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)#
property dynamic: bool#
__repr__() str#

Return repr(self).

dump() bytes#
class dissect.executable.elf.Section(fh: BinaryIO, idx: int | None = None, c_elf: dissect.cstruct.cstruct = c_elf_64)#
property name: str | None#
__repr__() str#

Return repr(self).

classmethod from_section_table(section_table: SectionTable, idx: int) Section#
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
__repr__() str#

Return repr(self).

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)#
property end: int#
property contents: bytes#
__repr__() str#

Return repr(self).

classmethod from_segment_table(table: SegmentTable, idx: int | None = None) Segment#
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
__repr__() str#

Return repr(self).

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)#
property name: str#
property value: int#
__repr__() str#

Return repr(self).

classmethod from_symbol_table(table: SymbolTable, idx: int) Symbol#
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