:py:mod:`dissect.executable.elf.elf` ==================================== .. py:module:: dissect.executable.elf.elf Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.executable.elf.elf.ELF dissect.executable.elf.elf.Table dissect.executable.elf.elf.Section dissect.executable.elf.elf.SectionTable dissect.executable.elf.elf.Segment dissect.executable.elf.elf.SegmentTable dissect.executable.elf.elf.StringTable dissect.executable.elf.elf.Symbol dissect.executable.elf.elf.SymbolTable Attributes ~~~~~~~~~~ .. autoapisummary:: dissect.executable.elf.elf.T .. py:class:: ELF(fh: BinaryIO) .. py:property:: dynamic :type: bool .. py:method:: __repr__() -> str Return repr(self). .. py:method:: dump() -> bytes .. py:data:: T .. py:class:: Table(entries: int) Bases: :py:obj:`Generic`\ [\ :py:obj:`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 .. py:method:: __iter__() -> Iterator[T] .. py:method:: __getitem__(idx: int) -> T .. py:method:: find(condition: Callable, **kwargs) -> list[T] .. py:class:: Section(fh: BinaryIO, idx: Optional[int] = None, c_elf: dissect.cstruct.cstruct = c_elf_64) .. py:property:: name :type: Optional[str] .. py:property:: link :type: Optional[Section] .. py:method:: __repr__() -> str Return repr(self). .. py:method:: from_section_table(section_table: SectionTable, idx: int) -> Section :classmethod: .. py:method:: is_related(segment: Segment) -> bool .. py:method:: contents() -> bytes .. py:class:: SectionTable(fh: BinaryIO, offset: int, entries: int, size: int, string_index: Optional[int] = None, c_elf: dissect.cstruct.cstruct = c_elf_64) Bases: :py:obj:`Table`\ [\ :py:obj:`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 .. py:method:: __repr__() -> str Return repr(self). .. py:method:: from_elf(elf: ELF) -> SectionTable :classmethod: .. py:method:: by_type(section_types: Union[list[int], int]) -> list[Section] .. py:method:: related_sections(segment: Segment) -> list[Section] .. py:method:: by_name(name: str) -> list[Section] .. py:method:: dump_table() -> tuple[int, bytes] .. py:method:: dump_data() -> list[tuple[int, bytes]] .. py:class:: Segment(fh: BinaryIO, idx: Optional[int] = None, c_elf: dissect.cstruct.cstruct = c_elf_64) .. py:property:: end :type: int .. py:property:: contents :type: bytes .. py:method:: __repr__() -> str Return repr(self). .. py:method:: from_segment_table(table: SegmentTable, idx: Optional[int] = None) -> Segment :classmethod: .. py:method:: is_related(section: Section) -> bool .. py:method:: patch(new_data: bytes) -> None .. py:class:: SegmentTable(fh: BinaryIO, offset: int, entries: int, size: int, c_elf: dissect.cstruct.cstruct = c_elf_64) Bases: :py:obj:`Table`\ [\ :py:obj:`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 .. py:method:: __repr__() -> str Return repr(self). .. py:method:: from_elf(elf: ELF) -> SegmentTable :classmethod: .. py:method:: related_segments(section: Section) -> list[Segment] .. py:method:: by_type(segment_types: Union[list[int], int]) -> list[Segment] .. py:method:: dump_data() -> list[tuple[int, bytearray]] .. py:method:: dump_table() -> tuple[int, bytearray] .. py:class:: StringTable(fh: BinaryIO, idx: Optional[int] = None, c_elf: dissect.cstruct.cstruct = c_elf_64) Bases: :py:obj:`Section` .. py:method:: __getitem__(offset: int) -> str .. py:class:: Symbol(fh: BinaryIO, idx: Optional[int] = None, c_elf: dissect.cstruct.cstruct = c_elf_64) .. py:property:: name :type: str .. py:property:: value :type: int .. py:method:: __repr__() -> str Return repr(self). .. py:method:: from_symbol_table(table: SymbolTable, idx: int) -> Symbol :classmethod: .. py:method:: value_based_on_shndx(table: SectionTable) -> int .. py:class:: SymbolTable(fh: BinaryIO, idx: Optional[int] = None, c_elf: dissect.cstruct.cstruct = c_elf_64) Bases: :py:obj:`Section`, :py:obj:`Table`\ [\ :py:obj:`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