Package Elf :: Class Elf
[hide private]
[frames] | no frames]

Class Elf

source code

               object --+            
                        |            
vstruct.primitives.v_base --+        
                            |        
              vstruct.VStruct --+    
                                |    
           vstruct.defs.elf.Elf32 --+
                                    |
               object --+           |
                        |           |
vstruct.primitives.v_base --+       |
                            |       |
              vstruct.VStruct --+   |
                                |   |
           vstruct.defs.elf.Elf64 --+
                                    |
                                   Elf

Instance Methods [hide private]
 
__init__(self, fd, inmem=False)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
getRelocTypeName(self, rtype)
Because relocation type names are decided based on the arch, only the Elf knows for sure...
source code
 
_parsePheaders(self) source code
 
_parseSections(self) source code
 
_parseSymbols(self)
Parse out the symbols that this elf binary has for us.
source code
 
_parseDynamic(self) source code
 
_parseRelocs(self)
Parse all the relocation entries out of any sections with sh_type == SHT_REL
source code
 
getBaseAddress(self)
For prelinked and main-exe elf binaries, return the value for the loaded base address...
source code
 
readAtRva(self, rva, size)
Calculate the file offset for the given RVA and read from it...
source code
 
rvaToOffset(self, rva)
Convert an RVA for this ELF binary to a file offset.
source code
 
readAtOffset(self, off, size)
Read from the given file offset.
source code
 
getSection(self, secname) source code
 
getSections(self)
Return the array of sections for this Elf
source code
 
getSectionBytes(self, secname) source code
 
getStrtabString(self, offset, section='.strtab') source code
 
getDynamics(self)
Return a list of the dynamics.
source code
 
getDynSyms(self)
Return a list of dynamic symbol objects.
source code
 
getRelocs(self)
Get the list of relocations.
source code
 
isPreLinked(self)
Returns True if the Elf binary is prelinked.
source code
 
isSharedObject(self)
Returns true if the given Elf binary is a dynamically shared object.
source code
 
__repr__(self, verbose=False)
Returns a string summary of this ELF.
source code
 
verbrepr(self) source code
 
lookupSymbolName(self, name)
Lookup symbol entries in this elf binary by name.
source code
 
lookupSymbolAddr(self, address)
lookup symbols from this elf binary by address.
source code
 
getPheaders(self)
Return a list of the program headers for this elf
source code
 
addSymbol(self, symbol) source code
 
getSymbols(self) source code

Inherited from vstruct.VStruct: __getattr__, __iter__, __ixor__, __len__, __setattr__, tree, vsAddField, vsAddParseCallback, vsCalculate, vsClearFields, vsEmit, vsGetClassPath, vsGetField, vsGetFields, vsGetOffset, vsGetPrims, vsGetPrintInfo, vsGetTypeName, vsHasField, vsInsertField, vsIsPrim, vsParse, vsParseFd, vsSetField

Inherited from vstruct.primitives.v_base: vsGetMeta, vsSetMeta

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, fd, inmem=False)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__repr__(self, verbose=False)
(Representation operator)

source code 

Returns a string summary of this ELF. If (verbose) the summary will include Symbols, Relocs, Dynamics and Dynamic Symbol tables

Overrides: object.__repr__

lookupSymbolName(self, name)

source code 

Lookup symbol entries in this elf binary by name. The result is a long representing the address for the given symbol. Or None if it's not found.

lookupSymbolAddr(self, address)

source code 

lookup symbols from this elf binary by address. This returns the name for the given symbol or None for not found