MakeELF
ELF reader-writer library
Public Member Functions | Public Attributes | List of all members
makeelf.elfstruct.Elf32 Class Reference

Complete ELF structure storage class. More...

Public Member Functions

def __init__ (self, Ehdr=None, Phdr_table=None, Shdr_table=None, sections=None, little=False)
 The constructor. More...
 
def __str__ (self)
 Convert to str. More...
 
def __repr__ (self)
 String representation. More...
 
def __bytes__ (self)
 Serialization to bytes. More...
 
def from_bytes (b, little=False)
 Deserialization of object. More...
 
def __len__ (self)
 Length of object. More...
 

Public Attributes

 Ehdr
 Instance of Elf32_Ehdr.
 
 Phdr_table
 List of instances of Elf32_Phdr.
 
 Shdr_table
 List of instances of Elf32_Shdr.
 
 sections
 List of section content. More...
 
 little
 

Detailed Description

Complete ELF structure storage class.

Allows to craft ELF file using low-level interfaces for manipulating data fields and accessing headers contained inside. This class is not meant to provide any abstraction on top of ELF structure

Constructor & Destructor Documentation

◆ __init__()

def makeelf.elfstruct.Elf32.__init__ (   self,
  Ehdr = None,
  Phdr_table = None,
  Shdr_table = None,
  sections = None,
  little = False 
)

The constructor.

Reconstructs new Elf32 object with all stored public members

Parameters
EhdrELF header
Phdr_tableList of program headers
Shdr_tableList of section headers
sectionsList of section contents
littleEndianness of ELF file

Member Function Documentation

◆ __bytes__()

def makeelf.elfstruct.Elf32.__bytes__ (   self)

Serialization to bytes.

Converts Python object to byte stream, ready to be saved to ELF file

Returns
Serialized object

◆ __len__()

def makeelf.elfstruct.Elf32.__len__ (   self)

Length of object.

Returns
length of object

◆ __repr__()

def makeelf.elfstruct.Elf32.__repr__ (   self)

String representation.

Provides ability to recreate object using its constructor, from Python CLI mode

Returns
String in format: "Classname(param, param2)"

◆ __str__()

def makeelf.elfstruct.Elf32.__str__ (   self)

Convert to str.

Useful for presenting contents to the user

Returns
String in format: "{key=val, key2=val2}"

◆ from_bytes()

def makeelf.elfstruct.Elf32.from_bytes (   b,
  little = False 
)

Deserialization of object.

Parameters
bbytes object with serialized data on the beginning
littleendianness of data
Returns
tuple of deserialized object and rest of bytes

Member Data Documentation

◆ sections

makeelf.elfstruct.Elf32.sections

List of section content.

Contains raw bytes objects or any type that can be converted using bytes function


The documentation for this class was generated from the following file: