dissect.executable.elf.elf#

Module Contents#

Classes#

ELF

Table

Abstract base class for generic types.

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.

Attributes#

T

class dissect.executable.elf.elf.ELF(fh: BinaryIO)#
property dynamic: bool#
__repr__() str#

Return repr(self).

dump() bytes#
dissect.executable.elf.elf.T#
class dissect.executable.elf.elf.Table(entries: int)#

Bases: Generic[T]

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
__iter__() Iterator[T]#
__getitem__(idx: int) T#
find(condition: Callable, **kwargs) list[T]#
class dissect.executable.elf.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.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.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.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.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.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.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