signature
stringlengths
8
3.44k
body
stringlengths
0
1.41M
docstring
stringlengths
1
122k
id
stringlengths
5
17
def readStringAtRva(self, rva):
d = self.getDataAtRva(rva, <NUM_LIT:1>)<EOL>resultStr = datatypes.String("<STR_LIT>")<EOL>while d != "<STR_LIT:\x00>":<EOL><INDENT>resultStr.value += d<EOL>rva += <NUM_LIT:1><EOL>d = self.getDataAtRva(rva, <NUM_LIT:1>)<EOL><DEDENT>return resultStr<EOL>
Returns a L{String} object from a given RVA. @type rva: int @param rva: The RVA to get the string from. @rtype: L{String} @return: A new L{String} object from the given RVA.
f11791:c0:m35
def isExe(self):
if not self.isDll() and not self.isDriver() and ( consts.IMAGE_FILE_EXECUTABLE_IMAGE & self.ntHeaders.fileHeader.characteristics.value) == consts.IMAGE_FILE_EXECUTABLE_IMAGE:<EOL><INDENT>return True<EOL><DEDENT>return False<EOL>
Determines if the current L{PE} instance is an Executable file. @rtype: bool @return: C{True} if the current L{PE} instance is an Executable file. Otherwise, returns C{False}.
f11791:c0:m36
def isDll(self):
if (consts.IMAGE_FILE_DLL & self.ntHeaders.fileHeader.characteristics.value) == consts.IMAGE_FILE_DLL:<EOL><INDENT>return True<EOL><DEDENT>return False<EOL>
Determines if the current L{PE} instance is a Dynamic Link Library file. @rtype: bool @return: C{True} if the current L{PE} instance is a DLL. Otherwise, returns C{False}.
f11791:c0:m37
def isDriver(self):
modules = []<EOL>imports = self.ntHeaders.optionalHeader.dataDirectory[consts.IMPORT_DIRECTORY].info<EOL>for module in imports:<EOL><INDENT>modules.append(module.metaData.moduleName.value.lower())<EOL><DEDENT>if set(["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]).intersection(modules):<EOL><INDENT>re...
Determines if the current L{PE} instance is a driver (.sys) file. @rtype: bool @return: C{True} if the current L{PE} instance is a driver. Otherwise, returns C{False}.
f11791:c0:m38
def isPe32(self):
if self.ntHeaders.optionalHeader.magic.value == consts.PE32:<EOL><INDENT>return True<EOL><DEDENT>return False<EOL>
Determines if the current L{PE} instance is a PE32 file. @rtype: bool @return: C{True} if the current L{PE} instance is a PE32 file. Otherwise, returns C{False}.
f11791:c0:m39
def isPe64(self):
if self.ntHeaders.optionalHeader.magic.value == consts.PE64:<EOL><INDENT>return True<EOL><DEDENT>return False<EOL>
Determines if the current L{PE} instance is a PE64 file. @rtype: bool @return: C{True} if the current L{PE} instance is a PE64 file. Otherwise, returns C{False}.
f11791:c0:m40
def isPeBounded(self):
boundImportsDir = self.ntHeaders.optionalHeader.dataDirectory[consts.BOUND_IMPORT_DIRECTORY]<EOL>if boundImportsDir.rva.value and boundImportsDir.size.value:<EOL><INDENT>return True<EOL><DEDENT>return False<EOL>
Determines if the current L{PE} instance is bounded, i.e. has a C{BOUND_IMPORT_DIRECTORY}. @rtype: bool @return: Returns C{True} if the current L{PE} instance is bounded. Otherwise, returns C{False}.
f11791:c0:m41
def isNXEnabled(self):
return self.ntHeaders.optionalHeader.dllCharacteristics.value & consts.IMAGE_DLL_CHARACTERISTICS_NX_COMPAT == consts.IMAGE_DLL_CHARACTERISTICS_NX_COMPAT<EOL>
Determines if the current L{PE} instance has the NXCOMPAT (Compatible with Data Execution Prevention) flag enabled. @see: U{http://msdn.microsoft.com/en-us/library/ms235442.aspx} @rtype: bool @return: Returns C{True} if the current L{PE} instance has the NXCOMPAT flag enabled. Otherwise, returns C{False}.
f11791:c0:m42
def isCFGEnabled(self):
return self.ntHeaders.optionalHeader.dllCharacteristics.value & consts.IMAGE_DLL_CHARACTERISTICS_GUARD_CF == consts.IMAGE_DLL_CHARACTERISTICS_GUARD_CF<EOL>
Determines if the current L{PE} instance has CFG (Control Flow Guard) flag enabled. @see: U{http://blogs.msdn.com/b/vcblog/archive/2014/12/08/visual-studio-2015-preview-work-in-progress-security-feature.aspx} @see: U{https://msdn.microsoft.com/en-us/library/dn919635%%28v=vs.140%%29.aspx} @rtype: bool @return: Returns ...
f11791:c0:m43
def isASLREnabled(self):
return self.ntHeaders.optionalHeader.dllCharacteristics.value & consts.IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE == consts.IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE<EOL>
Determines if the current L{PE} instance has the DYNAMICBASE (Use address space layout randomization) flag enabled. @see: U{http://msdn.microsoft.com/en-us/library/bb384887.aspx} @rtype: bool @return: Returns C{True} if the current L{PE} instance has the DYNAMICBASE flag enabled. Otherwise, returns C{False}.
f11791:c0:m44
def isSAFESEHEnabled(self):
NOSEH = -<NUM_LIT:1><EOL>SAFESEH_OFF = <NUM_LIT:0><EOL>SAFESEH_ON = <NUM_LIT:1><EOL>if self.ntHeaders.optionalHeader.dllCharacteristics.value & consts.IMAGE_DLL_CHARACTERISTICS_NO_SEH:<EOL><INDENT>return NOSEH<EOL><DEDENT>loadConfigDir = self.ntHeaders.optionalHeader.dataDirectory[consts.CONFIGURATION_DIRECTORY]<EOL>if...
Determines if the current L{PE} instance has the SAFESEH (Image has Safe Exception Handlers) flag enabled. @see: U{http://msdn.microsoft.com/en-us/library/9a89h429.aspx} @rtype: bool @return: Returns C{True} if the current L{PE} instance has the SAFESEH flag enabled. Returns C{False} if SAFESEH is off or -1 if SAFESEH...
f11791:c0:m45
def _parseDirectories(self, dataDirectoryInstance, magic = consts.PE32):
directories = [(consts.EXPORT_DIRECTORY, self._parseExportDirectory),(consts.IMPORT_DIRECTORY, self._parseImportDirectory),(consts.RESOURCE_DIRECTORY, self._parseResourceDirectory),(consts.EXCEPTION_DIRECTORY, self._parseExceptionDirectory),(consts.RELOCATION_DIRECTORY, self._parseRelocsDirectory),(consts.TLS_DIRECTORY...
Parses all the directories in the L{PE} instance. @type dataDirectoryInstance: L{DataDirectory} @param dataDirectoryInstance: A L{DataDirectory} object with the directories data. @type magic: int @param magic: (Optional) The type of PE. This value could be L{consts.PE32} or L{consts.PE64}.
f11791:c0:m46
def _parseResourceDirectory(self, rva, size, magic = consts.PE32):
return self.getDataAtRva(rva, size)<EOL>
Parses the C{IMAGE_RESOURCE_DIRECTORY} directory. @type rva: int @param rva: The RVA where the C{IMAGE_RESOURCE_DIRECTORY} starts. @type size: int @param size: The size of the C{IMAGE_RESOURCE_DIRECTORY} directory. @type magic: int @param magic: (Optional) The type of PE. This value could be L{consts.PE32} or L{con...
f11791:c0:m47
def _parseExceptionDirectory(self, rva, size, magic = consts.PE32):
return self.getDataAtRva(rva, size)<EOL>
Parses the C{IMAGE_EXCEPTION_DIRECTORY} directory. @type rva: int @param rva: The RVA where the C{IMAGE_EXCEPTION_DIRECTORY} starts. @type size: int @param size: The size of the C{IMAGE_EXCEPTION_DIRECTORY} directory. @type magic: int @param magic: (Optional) The type of PE. This value could be L{consts.PE32} or L{...
f11791:c0:m48
def _parseDelayImportDirectory(self, rva, size, magic = consts.PE32):
return self.getDataAtRva(rva, size)<EOL>
Parses the delay imports directory. @type rva: int @param rva: The RVA where the delay imports directory starts. @type size: int @param size: The size of the delay imports directory. @type magic: int @param magic: (Optional) The type of PE. This value could be L{consts.PE32} or L{consts.PE64}. @rtype: str @return:...
f11791:c0:m49
def _parseBoundImportDirectory(self, rva, size, magic = consts.PE32):
data = self.getDataAtRva(rva, size)<EOL>rd = utils.ReadData(data)<EOL>boundImportDirectory = directories.ImageBoundImportDescriptor.parse(rd)<EOL>for i in range(len(boundImportDirectory) - <NUM_LIT:1>):<EOL><INDENT>if hasattr(boundImportDirectory[i], "<STR_LIT>"):<EOL><INDENT>if boundImportDirectory[i].forwarderRefsLi...
Parses the bound import directory. @type rva: int @param rva: The RVA where the bound import directory starts. @type size: int @param size: The size of the bound import directory. @type magic: int @param magic: (Optional) The type of PE. This value could be L{consts.PE32} or L{consts.PE64}. @rtype: L{ImageBoundImp...
f11791:c0:m50
def _parseLoadConfigDirectory(self, rva, size, magic = consts.PE32):
<EOL>data = self.getDataAtRva(rva, directories.ImageLoadConfigDirectory().sizeof())<EOL>rd = utils.ReadData(data)<EOL>if magic == consts.PE32:<EOL><INDENT>return directories.ImageLoadConfigDirectory.parse(rd)<EOL><DEDENT>elif magic == consts.PE64:<EOL><INDENT>return directories.ImageLoadConfigDirectory64.parse(rd)<EOL>...
Parses IMAGE_LOAD_CONFIG_DIRECTORY. @type rva: int @param rva: The RVA where the IMAGE_LOAD_CONFIG_DIRECTORY starts. @type size: int @param size: The size of the IMAGE_LOAD_CONFIG_DIRECTORY. @type magic: int @param magic: (Optional) The type of PE. This value could be L{consts.PE32} or L{consts.PE64}. @rtype: L{Im...
f11791:c0:m51
def _parseTlsDirectory(self, rva, size, magic = consts.PE32):
data = self.getDataAtRva(rva, size)<EOL>rd = utils.ReadData(data)<EOL>if magic == consts.PE32:<EOL><INDENT>return directories.TLSDirectory.parse(rd)<EOL><DEDENT>elif magic == consts.PE64:<EOL><INDENT>return directories.TLSDirectory64.parse(rd)<EOL><DEDENT>else:<EOL><INDENT>raise excep.InvalidParameterException("<STR_LI...
Parses the TLS directory. @type rva: int @param rva: The RVA where the TLS directory starts. @type size: int @param size: The size of the TLS directory. @type magic: int @param magic: (Optional) The type of PE. This value could be L{consts.PE32} or L{consts.PE64}. @rtype: L{TLSDirectory} @return: A new L{TLSDirect...
f11791:c0:m52
def _parseRelocsDirectory(self, rva, size, magic = consts.PE32):
data = self.getDataAtRva(rva, size)<EOL>rd = utils.ReadData(data)<EOL>relocsArray = directories.ImageBaseRelocation()<EOL>while rd.offset < size:<EOL><INDENT>relocEntry = directories.ImageBaseRelocationEntry.parse(rd)<EOL>relocsArray.append(relocEntry)<EOL><DEDENT>return relocsArray<EOL>
Parses the relocation directory. @type rva: int @param rva: The RVA where the relocation directory starts. @type size: int @param size: The size of the relocation directory. @type magic: int @param magic: (Optional) The type of PE. This value could be L{consts.PE32} or L{consts.PE64}. @rtype: L{ImageBaseRelocation...
f11791:c0:m53
def _parseExportDirectory(self, rva, size, magic = consts.PE32):
data = self.getDataAtRva(rva, size)<EOL>rd = utils.ReadData(data)<EOL>iet = directories.ImageExportTable.parse(rd)<EOL>auxFunctionRvaArray = list()<EOL>numberOfNames = iet.numberOfNames.value<EOL>addressOfNames = iet.addressOfNames.value<EOL>addressOfNameOrdinals = iet.addressOfNameOrdinals.value<EOL>addressOfFunction...
Parses the C{IMAGE_EXPORT_DIRECTORY} directory. @type rva: int @param rva: The RVA where the C{IMAGE_EXPORT_DIRECTORY} directory starts. @type size: int @param size: The size of the C{IMAGE_EXPORT_DIRECTORY} directory. @type magic: int @param magic: (Optional) The type of PE. This value could be L{consts.PE32} or L...
f11791:c0:m54
def _parseDebugDirectory(self, rva, size, magic = consts.PE32):
debugDirData = self.getDataAtRva(rva, size)<EOL>numberOfEntries = size / consts.SIZEOF_IMAGE_DEBUG_ENTRY32<EOL>rd = utils.ReadData(debugDirData)<EOL>return directories.ImageDebugDirectories.parse(rd, numberOfEntries)<EOL>
Parses the C{IMAGE_DEBUG_DIRECTORY} directory. @see: U{http://msdn.microsoft.com/es-es/library/windows/desktop/ms680307(v=vs.85).aspx} @type rva: int @param rva: The RVA where the C{IMAGE_DEBUG_DIRECTORY} directory starts. @type size: int @param size: The size of the C{IMAGE_DEBUG_DIRECTORY} directory. @type magic:...
f11791:c0:m55
def _parseImportDirectory(self, rva, size, magic = consts.PE32):
<EOL>importsDirData = self.getDataAtRva(rva, size)<EOL>numberOfEntries = size / consts.SIZEOF_IMAGE_IMPORT_ENTRY32<EOL>rd = utils.ReadData(importsDirData)<EOL>rdAux = utils.ReadData(importsDirData)<EOL>count = <NUM_LIT:0><EOL>entry = rdAux.read(consts.SIZEOF_IMAGE_IMPORT_ENTRY32)<EOL>while rdAux.offset < len(rdAux.dat...
Parses the C{IMAGE_IMPORT_DIRECTORY} directory. @type rva: int @param rva: The RVA where the C{IMAGE_IMPORT_DIRECTORY} directory starts. @type size: int @param size: The size of the C{IMAGE_IMPORT_DIRECTORY} directory. @type magic: int @param magic: (Optional) The type of PE. This value could be L{consts.PE32} or L...
f11791:c0:m56
def _parseNetDirectory(self, rva, size, magic = consts.PE32):
if not rva or not size:<EOL><INDENT>return None<EOL><DEDENT>netDirectoryClass = directories.NETDirectory()<EOL>netDir = directories.NetDirectory.parse(utils.ReadData(self.getDataAtRva(rva, size)))<EOL>netDirectoryClass.directory = netDir<EOL>mdhRva = netDir.metaData.rva.value<EOL>mdhSize = netDir.metaData.size.value<E...
Parses the NET directory. @see: U{http://www.ntcore.com/files/dotnetformat.htm} @type rva: int @param rva: The RVA where the NET directory starts. @type size: int @param size: The size of the NET directory. @type magic: int @param magic: (Optional) The type of PE. This value could be L{consts.PE32} or L{consts.PE64...
f11791:c0:m57
def getMd5(self):
return hashlib.md5(str(self)).hexdigest()<EOL>
Get MD5 hash from PE file. @rtype: str @return: The MD5 hash from the L{PE} instance.
f11791:c0:m58
def getSha1(self):
return hashlib.sha1(str(self)).hexdigest()<EOL>
Get SHA1 hash from PE file. @rtype: str @return: The SHA1 hash from the L{PE} instance.
f11791:c0:m59
def getSha256(self):
return hashlib.sha256(str(self)).hexdigest()<EOL>
Get SHA256 hash from PE file. @rtype: str @return: The SHA256 hash from the L{PE} instance.
f11791:c0:m60
def getSha512(self):
return hashlib.sha512(str(self)).hexdigest()<EOL>
Get SHA512 hash from PE file. @rtype: str @return: The SHA512 hash from the L{PE} instance.
f11791:c0:m61
def getCRC32(self):
return binascii.crc32(str(self)) & <NUM_LIT><EOL>
Get CRC32 checksum from PE file. @rtype: int @return: The CRD32 checksum from the L{PE} instance.
f11791:c0:m62
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack)<EOL>self.e_magic = datatypes.WORD(consts.MZ_SIGNATURE) <EOL>self.e_cblp = datatypes.WORD(<NUM_LIT:0>) <EOL>self.e_cp = datatypes.WORD(<NUM_LIT:0>) <EOL>self.e_crlc = datatypes.WORD(<NUM_LIT:0>) <EOL>self.e_cparhdr = datatypes.WORD(<NUM_LIT:0>) <EOL>self.e_minalloc...
Class representation of the C{IMAGE_DOS_HEADER} structure. @see: U{http://msdn.microsoft.com/en-us/magazine/cc301805.aspx} @type shouldPack: bool @param shouldPack: (Optional) If set to C{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11791:c1:m0
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
dosHdr = DosHeader()<EOL>dosHdr.e_magic.value = readDataInstance.readWord()<EOL>dosHdr.e_cblp.value = readDataInstance.readWord()<EOL>dosHdr.e_cp.value = readDataInstance.readWord()<EOL>dosHdr.e_crlc.value = readDataInstance.readWord()<EOL>dosHdr.e_cparhdr.value = readDataInstance.readWord()<EOL>dosHdr.e_minalloc....
Returns a new L{DosHeader} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with data to be parsed as a L{DosHeader} object. @rtype: L{DosHeader} @return: A new L{DosHeader} object.
f11791:c1:m1
def getType(self):
return consts.IMAGE_DOS_HEADER<EOL>
Returns L{consts.IMAGE_DOS_HEADER}.
f11791:c1:m2
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack)<EOL>self.signature = datatypes.DWORD(consts.PE_SIGNATURE) <EOL>self.fileHeader = FileHeader() <EOL>self.optionalHeader = OptionalHeader()<EOL>
Class representation of the C{IMAGE_NT_HEADERS} structure. @see: U{http://msdn.microsoft.com/es-es/library/windows/desktop/ms680336%28v=vs.85%29.aspx} @type shouldPack: bool @param shouldPack: (Optional) If set to C{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11791:c2:m0
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
nt = NtHeaders()<EOL>nt.signature.value = readDataInstance.readDword()<EOL>nt.fileHeader = FileHeader.parse(readDataInstance)<EOL>nt.optionalHeader = OptionalHeader.parse(readDataInstance)<EOL>return nt<EOL>
Returns a new L{NtHeaders} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with data to be parsed as a L{NtHeaders} object. @rtype: L{NtHeaders} @return: A new L{NtHeaders} object.
f11791:c2:m2
def getType(self):
return consts.IMAGE_NT_HEADERS<EOL>
Returns L{consts.IMAGE_NT_HEADERS}.
f11791:c2:m3
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack = True)<EOL>self.machine = datatypes.WORD(consts.INTEL386) <EOL>self.numberOfSections = datatypes.WORD(<NUM_LIT:1>) <EOL>self.timeDateStamp = datatypes.DWORD(<NUM_LIT:0>) <EOL>self.pointerToSymbolTable = datatypes.DWORD(<NUM_LIT:0>) <EOL>self.numberOfSymbols = data...
Class representation of the C{IMAGE_FILE_HEADER} structure. @see: U{http://msdn.microsoft.com/es-es/library/windows/desktop/ms680313%28v=vs.85%29.aspx} @type shouldPack: bool @param shouldPack: (Optional) If set to C{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11791:c3:m0
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
fh = FileHeader()<EOL>fh.machine.value = readDataInstance.readWord()<EOL>fh.numberOfSections.value = readDataInstance.readWord()<EOL>fh.timeDateStamp.value = readDataInstance.readDword()<EOL>fh.pointerToSymbolTable.value = readDataInstance.readDword()<EOL>fh.numberOfSymbols.value = readDataInstance.readDword()<EOL...
Returns a new L{FileHeader} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with data to be parsed as a L{FileHeader} object. @rtype: L{FileHeader} @return: A new L{ReadData} object.
f11791:c3:m1
def getType(self):
return consts.IMAGE_FILE_HEADER<EOL>
Returns L{consts.IMAGE_FILE_HEADER}.
f11791:c3:m2
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack)<EOL>self.magic = datatypes.WORD(consts.PE32) <EOL>self.majorLinkerVersion = datatypes.BYTE(<NUM_LIT:2>) <EOL>self.minorLinkerVersion = datatypes.BYTE(<NUM_LIT>) <EOL>self.sizeOfCode = datatypes.DWORD(<NUM_LIT>) <EOL>self.sizeOfInitializedData = datatypes.DWORD(<NUM...
Class representation of the C{IMAGE_OPTIONAL_HEADER} structure. @see: U{http://msdn.microsoft.com/es-es/library/windows/desktop/ms680339%28v=vs.85%29.aspx} @type shouldPack: bool @param shouldPack: (Optional) If set to C{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11791:c4:m0
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
oh = OptionalHeader()<EOL>oh.magic.value = readDataInstance.readWord()<EOL>oh.majorLinkerVersion.value = readDataInstance.readByte()<EOL>oh.minorLinkerVersion.value = readDataInstance.readByte()<EOL>oh.sizeOfCode.value = readDataInstance.readDword()<EOL>oh.sizeOfInitializedData.value = readDataInstance.readDword()...
Returns a new L{OptionalHeader} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with data to be parsed as a L{OptionalHeader} object. @rtype: L{OptionalHeader} @return: A new L{OptionalHeader} object.
f11791:c4:m1
def getType(self):
return consts.IMAGE_OPTIONAL_HEADER<EOL>
Returns L{consts.IMAGE_OPTIONAL_HEADER}.
f11791:c4:m2
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack)<EOL>self.magic = datatypes.WORD(consts.PE32) <EOL>self.majorLinkerVersion = datatypes.BYTE(<NUM_LIT:2>) <EOL>self.minorLinkerVersion = datatypes.BYTE(<NUM_LIT>) <EOL>self.sizeOfCode = datatypes.DWORD(<NUM_LIT>) <EOL>self.sizeOfInitializedData = datatypes.DWORD(<NUM...
Class representation of the C{IMAGE_OPTIONAL_HEADER64} structure. @see: Remarks in U{http://msdn.microsoft.com/en-us/library/windows/desktop/ms680339%28v=vs.85%29.aspx} @type shouldPack: bool @param shouldPack: (Optional) If set to C{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11791:c5:m0
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
oh = OptionalHeader64()<EOL>oh.magic.value = readDataInstance.readWord()<EOL>oh.majorLinkerVersion.value = readDataInstance.readByte()<EOL>oh.minorLinkerVersion.value = readDataInstance.readByte()<EOL>oh.sizeOfCode.value = readDataInstance.readDword()<EOL>oh.sizeOfInitializedData.value = readDataInstance.readDword...
Returns a new L{OptionalHeader64} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with data to be parsed as a L{OptionalHeader64} object. @rtype: L{OptionalHeader64} @return: A new L{OptionalHeader64} object.
f11791:c5:m1
def getType(self):
return consts.IMAGE_OPTIONAL_HEADER64<EOL>
Returns L{consts.IMAGE_OPTIONAL_HEADER64}.
f11791:c5:m2
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack)<EOL>self.name = datatypes.String('<STR_LIT>') <EOL>self.misc = datatypes.DWORD(<NUM_LIT>) <EOL>self.virtualAddress = datatypes.DWORD(<NUM_LIT>) <EOL>self.sizeOfRawData = datatypes.DWORD(<NUM_LIT>) <EOL>self.pointerToRawData = datatypes.DWORD(<NUM_LIT>) <EOL>self.p...
Class representation of the C{IMAGE_SECTION_HEADER} structure. @see: U{http://msdn.microsoft.com/en-us/library/windows/desktop/ms680341%28v=vs.85%29.aspx} @type shouldPack: bool @param shouldPack: (Optional) If set to C{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11791:c6:m0
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
sh = SectionHeader()<EOL>sh.name.value = readDataInstance.read(<NUM_LIT:8>)<EOL>sh.misc.value = readDataInstance.readDword()<EOL>sh.virtualAddress.value = readDataInstance.readDword()<EOL>sh.sizeOfRawData.value = readDataInstance.readDword()<EOL>sh.pointerToRawData.value = readDataInstance.readDword()<EOL>sh.pointe...
Returns a new L{SectionHeader} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with data to be parsed as a L{SectionHeader} object. @rtype: L{SectionHeader} @return: A new L{SectionHeader} object.
f11791:c6:m1
def getType(self):
return consts.IMAGE_SECTION_HEADER<EOL>
Returns L{consts.IMAGE_SECTION_HEADER}.
f11791:c6:m2
def __init__(self, numberOfSectionHeaders = <NUM_LIT:1>, shouldPack = True):
list.__init__(self)<EOL>self.shouldPack = shouldPack<EOL>if numberOfSectionHeaders:<EOL><INDENT>for i in range(numberOfSectionHeaders):<EOL><INDENT>sh = SectionHeader()<EOL>self.append(sh)<EOL><DEDENT><DEDENT>
Array of L{SectionHeader} objects. @type shouldPack: bool @param shouldPack: (Optional) If set to C{True}, the object will be packed. If set to C{False}, the object won't be packed. @type numberOfSectionHeaders: int @param numberOfSectionHeaders: (Optional) The number of desired section headers. By default, this para...
f11791:c7:m0
@staticmethod<EOL><INDENT>def parse(readDataInstance, numberOfSectionHeaders):<DEDENT>
sHdrs = SectionHeaders(numberOfSectionHeaders = <NUM_LIT:0>)<EOL>for i in range(numberOfSectionHeaders):<EOL><INDENT>sh = SectionHeader()<EOL>sh.name.value = readDataInstance.read(<NUM_LIT:8>)<EOL>sh.misc.value = readDataInstance.readDword()<EOL>sh.virtualAddress.value = readDataInstance.readDword()<EOL>sh.sizeOfRawDat...
Returns a new L{SectionHeaders} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with data to be parsed as a L{SectionHeaders} object. @type numberOfSectionHeaders: int @param numberOfSectionHeaders: The number of L{SectionHeader} objects in the L{SectionHeaders} instance.
f11791:c7:m2
def __init__(self, sectionHeadersInstance = None):
list.__init__(self)<EOL>if sectionHeadersInstance:<EOL><INDENT>for sh in sectionHeadersInstance:<EOL><INDENT>self.append("<STR_LIT>" * sh.sizeOfRawData.value)<EOL><DEDENT><DEDENT>
Array with the data of each section present in the file. @type sectionHeadersInstance: instance @param sectionHeadersInstance: (Optional) A L{SectionHeaders} instance to be parsed.
f11791:c8:m0
@staticmethod<EOL><INDENT>def parse(readDataInstance, sectionHeadersInstance):<DEDENT>
sData = Sections()<EOL>for sectionHdr in sectionHeadersInstance:<EOL><INDENT>if sectionHdr.sizeOfRawData.value > len(readDataInstance.data):<EOL><INDENT>print("<STR_LIT>")<EOL><DEDENT>if sectionHdr.pointerToRawData.value > len(readDataInstance.data):<EOL><INDENT>print("<STR_LIT>")<EOL><DEDENT>if sectionHdr.misc.value >...
Returns a new L{Sections} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with data to be parsed as a L{Sections} object. @type sectionHeadersInstance: instance @param sectionHeadersInstance: The L{SectionHeaders} instance with the necessary to parse every section data. @rty...
f11791:c8:m2
def powerOfTwo(value):
return value != <NUM_LIT:0> and (value & (value - <NUM_LIT:1>)) == <NUM_LIT:0><EOL>
Tries to determine if a given value is a power of two. @type value: int @param value: Value to test if it is power of two. @rtype: bool @return: C{True} if the value is power of two, C{False} if it doesn't.
f11792:m0
def allZero(buffer):
allZero = True<EOL>for byte in buffer:<EOL><INDENT>if byte != "<STR_LIT:\x00>":<EOL><INDENT>allZero = False<EOL>break<EOL><DEDENT><DEDENT>return allZero<EOL>
Tries to determine if a buffer is empty. @type buffer: str @param buffer: Buffer to test if it is empty. @rtype: bool @return: C{True} if the given buffer is empty, i.e. full of zeros, C{False} if it doesn't.
f11792:m1
def __init__(self, data, endianness = "<STR_LIT:<>", signed = False):
self.data = StringIO(data)<EOL>self.endianness = endianness<EOL>self.signed = signed<EOL>
@type data: str @param data: Data to create the L{WriteData} object. @type endianness: str @param endianness: (Optional) Indicates the endianness used to write the data. The C{<} indicates little-endian while C{>} indicates big-endian. @type signed: bool @param signed: (Optional) If set to C{True} the data will be tr...
f11792:c0:m0
def writeByte(self, byte):
self.data.write(pack("<STR_LIT:B>" if not self.signed else "<STR_LIT:b>", byte))<EOL>
Writes a byte into the L{WriteData} stream object. @type byte: int @param byte: Byte value to write into the stream.
f11792:c0:m3
def writeWord(self, word):
self.data.write(pack(self.endianness + ("<STR_LIT:H>" if not self.signed else "<STR_LIT:h>"), word))<EOL>
Writes a word value into the L{WriteData} stream object. @type word: int @param word: Word value to write into the stream.
f11792:c0:m4
def writeDword(self, dword):
self.data.write(pack(self.endianness + ("<STR_LIT:L>" if not self.signed else "<STR_LIT:l>"), dword))<EOL>
Writes a dword value into the L{WriteData} stream object. @type dword: int @param dword: Dword value to write into the stream.
f11792:c0:m5
def writeQword(self, qword):
self.data.write(pack(self.endianness + ("<STR_LIT>" if not self.signed else "<STR_LIT:q>"), qword))<EOL>
Writes a qword value into the L{WriteData} stream object. @type qword: int @param qword: Qword value to write into the stream.
f11792:c0:m6
def write(self, dataToWrite):
self.data.write(dataToWrite)<EOL>
Writes data into the L{WriteData} stream object. @type dataToWrite: str @param dataToWrite: Data to write into the stream.
f11792:c0:m7
def setOffset(self, value):
if value >= len(self.data.getvalue()):<EOL><INDENT>raise excep.WrongOffsetValueException("<STR_LIT>" % len(self.data))<EOL><DEDENT>self.data.seek(value)<EOL>
Sets the offset of the L{WriteData} stream object in wich the data is written. @type value: int @param value: Integer value that represent the offset we want to start writing in the L{WriteData} stream. @raise WrongOffsetValueException: The value is beyond the total length of the data.
f11792:c0:m8
def skipBytes(self, nroBytes):
self.data.seek(nroBytes + self.data.tell())<EOL>
Skips the specified number as parameter to the current value of the L{WriteData} stream. @type nroBytes: int @param nroBytes: The number of bytes to skip.
f11792:c0:m9
def tell(self):
return self.data.tell()<EOL>
Returns the current position of the offset in the L{WriteData} sream object. @rtype: int @return: The value of the current offset in the stream.
f11792:c0:m10
def __init__(self, data, endianness = "<STR_LIT:<>", signed = False):
self.data = data<EOL>self.offset = <NUM_LIT:0><EOL>self.endianness = endianness<EOL>self.signed = signed<EOL>self.log = False<EOL>self.length = len(data)<EOL>
@type data: str @param data: The data from which we want to read. @type endianness: str @param endianness: (Optional) Indicates the endianness used to read the data. The C{<} indicates little-endian while C{>} indicates big-endian. @type signed: bool @param signed: (Optional) If set to C{True} the data will be treate...
f11792:c1:m0
def readDword(self):
dword = unpack(self.endianness + ('<STR_LIT:L>' if not self.signed else '<STR_LIT:l>'), self.readAt(self.offset, <NUM_LIT:4>))[<NUM_LIT:0>]<EOL>self.offset += <NUM_LIT:4><EOL>return dword<EOL>
Reads a dword value from the L{ReadData} stream object. @rtype: int @return: The dword value read from the L{ReadData} stream.
f11792:c1:m2
def readWord(self):
word = unpack(self.endianness + ('<STR_LIT:H>' if not self.signed else '<STR_LIT:h>'), self.readAt(self.offset, <NUM_LIT:2>))[<NUM_LIT:0>]<EOL>self.offset += <NUM_LIT:2><EOL>return word<EOL>
Reads a word value from the L{ReadData} stream object. @rtype: int @return: The word value read from the L{ReadData} stream.
f11792:c1:m3
def readByte(self):
byte = unpack('<STR_LIT:B>' if not self.signed else '<STR_LIT:b>', self.readAt(self.offset, <NUM_LIT:1>))[<NUM_LIT:0>]<EOL>self.offset += <NUM_LIT:1><EOL>return byte<EOL>
Reads a byte value from the L{ReadData} stream object. @rtype: int @return: The byte value read from the L{ReadData} stream.
f11792:c1:m4
def readQword(self):
qword = unpack(self.endianness + ('<STR_LIT>' if not self.signed else '<STR_LIT:b>'), self.readAt(self.offset, <NUM_LIT:8>))[<NUM_LIT:0>]<EOL>self.offset += <NUM_LIT:8><EOL>return qword<EOL>
Reads a qword value from the L{ReadData} stream object. @rtype: int @return: The qword value read from the L{ReadData} stream.
f11792:c1:m5
def readString(self):
resultStr = "<STR_LIT>"<EOL>while self.data[self.offset] != "<STR_LIT:\x00>":<EOL><INDENT>resultStr += self.data[self.offset]<EOL>self.offset += <NUM_LIT:1><EOL><DEDENT>return resultStr<EOL>
Reads an ASCII string from the L{ReadData} stream object. @rtype: str @return: An ASCII string read form the stream.
f11792:c1:m6
def readAlignedString(self, align = <NUM_LIT:4>):
s = self.readString()<EOL>r = align - len(s) % align<EOL>while r:<EOL><INDENT>s += self.data[self.offset]<EOL>self.offset += <NUM_LIT:1><EOL>r -= <NUM_LIT:1><EOL><DEDENT>return s.rstrip("<STR_LIT:\x00>")<EOL>
Reads an ASCII string aligned to the next align-bytes boundary. @type align: int @param align: (Optional) The value we want the ASCII string to be aligned. @rtype: str @return: A 4-bytes aligned (default) ASCII string.
f11792:c1:m7
def read(self, nroBytes):
if nroBytes > self.length - self.offset:<EOL><INDENT>if self.log:<EOL><INDENT>print("<STR_LIT>" % (nroBytes, self.length - self.offset))<EOL><DEDENT>nroBytes = self.length - self.offset<EOL><DEDENT>resultStr = self.data[self.offset:self.offset + nroBytes]<EOL>self.offset += nroBytes<EOL>return resultStr<EOL>
Reads data from the L{ReadData} stream object. @type nroBytes: int @param nroBytes: The number of bytes to read. @rtype: str @return: A string containing the read data from the L{ReadData} stream object. @raise DataLengthException: The number of bytes tried to be read are more than the remaining in the L{ReadData} s...
f11792:c1:m8
def skipBytes(self, nroBytes):
self.offset += nroBytes<EOL>
Skips the specified number as parameter to the current value of the L{ReadData} stream. @type nroBytes: int @param nroBytes: The number of bytes to skip.
f11792:c1:m9
def setOffset(self, value):
<EOL>self.offset = value<EOL>
Sets the offset of the L{ReadData} stream object in wich the data is read. @type value: int @param value: Integer value that represent the offset we want to start reading in the L{ReadData} stream. @raise WrongOffsetValueException: The value is beyond the total length of the data.
f11792:c1:m10
def readAt(self, offset, size):
if offset > self.length:<EOL><INDENT>if self.log:<EOL><INDENT>print("<STR_LIT>" % (nroBytes, self.length - self.offset))<EOL><DEDENT>offset = self.length - self.offset<EOL><DEDENT>tmpOff = self.tell()<EOL>self.setOffset(offset)<EOL>r = self.read(size)<EOL>self.setOffset(tmpOff)<EOL>return r<EOL>
Reads as many bytes indicated in the size parameter at the specific offset. @type offset: int @param offset: Offset of the value to be read. @type size: int @param size: This parameter indicates how many bytes are going to be read from a given offset. @rtype: str @return: A packed string containing the read data.
f11792:c1:m11
def tell(self):
return self.offset<EOL>
Returns the current position of the offset in the L{ReadData} sream object. @rtype: int @return: The value of the current offset in the stream.
f11792:c1:m12
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack)<EOL>self.timeDateStamp = datatypes.DWORD(<NUM_LIT:0>) <EOL>self.offsetModuleName = datatypes.WORD(<NUM_LIT:0>) <EOL>self.reserved = datatypes.WORD(<NUM_LIT:0>) <EOL>self.moduleName = datatypes.String(shouldPack = False) <EOL>self._attrsList = ["<STR_LIT>", "<STR_...
This class represents an element of type C{IMAGE_BOUND_FORWARDER_REF}. @see: U{http://msdn.microsoft.com/en-us/magazine/cc301808.aspx} @type shouldPack: bool @param shouldPack: (Optional) If set to c{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11794:c0:m0
def getType(self):
return consts.IMAGE_BOUND_FORWARDER_REF_ENTRY<EOL>
Returns L{consts.IMAGE_BOUND_FORWARDER_REF_ENTRY}.
f11794:c0:m1
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
boundForwarderEntry = ImageBoundForwarderRefEntry()<EOL>boundForwarderEntry.timeDateStamp.value = readDataInstance.readDword()<EOL>boundForwarderEntry.offsetModuleName.value = readDataInstance.readWord()<EOL>boundForwarderEntry.reserved.value = readDataInstance.readWord()<EOL>return boundForwarderEntry<EOL>
Returns a new L{ImageBoundForwarderRefEntry} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with the corresponding data to generate a new L{ImageBoundForwarderRefEntry} object. @rtype: L{ImageBoundForwarderRefEntry} @return: A new L{ImageBoundForwarderRefEntry} object.
f11794:c0:m2
def __init__(self, shouldPack = True):
list.__init__(self)<EOL>self.shouldPack = shouldPack<EOL>
This class is a wrapper over an array of C{IMAGE_BOUND_FORWARDER_REF}. @type shouldPack: bool @param shouldPack: (Optional) If set to c{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11794:c1:m0
@staticmethod<EOL><INDENT>def parse(readDataInstance, numberOfEntries):<DEDENT>
imageBoundForwarderRefsList = ImageBoundForwarderRef()<EOL>dLength = len(readDataInstance)<EOL>entryLength = ImageBoundForwarderRefEntry().sizeof()<EOL>toRead = numberOfEntries * entryLength<EOL>if dLength >= toRead:<EOL><INDENT>for i in range(numberOfEntries):<EOL><INDENT>entryData = readDataInstance.read(entryLength)...
Returns a L{ImageBoundForwarderRef} array where every element is a L{ImageBoundForwarderRefEntry} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with the corresponding data to generate a new L{ImageBoundForwarderRef} object. @type numberOfEntries: int @param numberOfEntries:...
f11794:c1:m2
def __init__(self, shouldPack = True):
list.__init__(self)<EOL>self.shouldPack = shouldPack<EOL>
Array of L{ImageBoundImportDescriptorEntry} objects. @type shouldPack: bool @param shouldPack: (Optional) If set to c{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11794:c2:m0
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
ibd = ImageBoundImportDescriptor()<EOL>entryData = readDataInstance.read(consts.SIZEOF_IMAGE_BOUND_IMPORT_ENTRY32)<EOL>readDataInstance.offset = <NUM_LIT:0><EOL>while not utils.allZero(entryData):<EOL><INDENT>prevOffset = readDataInstance.offset<EOL>boundEntry = ImageBoundImportDescriptorEntry.parse(readDataInstance)<E...
Returns a new L{ImageBoundImportDescriptor} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object containing the data to create a new L{ImageBoundImportDescriptor} object. @rtype: L{ImageBoundImportDescriptor} @return: A new {ImageBoundImportDescriptor} object.
f11794:c2:m2
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack)<EOL>self.timeDateStamp = datatypes.DWORD(<NUM_LIT:0>) <EOL>self.offsetModuleName = datatypes.WORD(<NUM_LIT:0>) <EOL>self.numberOfModuleForwarderRefs = datatypes.WORD(<NUM_LIT:0>)<EOL>self.forwarderRefsList = ImageBoundForwarderRef() <EOL>self.moduleName = datatype...
This class represents a C{IMAGE_BOUND_IMPORT_DESCRIPTOR} structure. @see: U{http://msdn.microsoft.com/en-us/magazine/cc301808.aspx} @type shouldPack: bool @param shouldPack: (Optional) If set to c{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11794:c3:m0
def getType(self):
return consts.IMAGE_BOUND_IMPORT_DESCRIPTOR_ENTRY<EOL>
Returns L{consts.IMAGE_BOUND_IMPORT_DESCRIPTOR_ENTRY}
f11794:c3:m1
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
boundEntry = ImageBoundImportDescriptorEntry()<EOL>boundEntry.timeDateStamp.value = readDataInstance.readDword()<EOL>boundEntry.offsetModuleName.value = readDataInstance.readWord()<EOL>boundEntry.numberOfModuleForwarderRefs.value = readDataInstance.readWord()<EOL>numberOfForwarderRefsEntries = boundEntry.numberOfModule...
Returns a new L{ImageBoundImportDescriptorEntry} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object containing data to create a new L{ImageBoundImportDescriptorEntry}. @rtype: L{ImageBoundImportDescriptorEntry} @return: A new {ImageBoundImportDescriptorEntry} object.
f11794:c3:m2
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack)<EOL>self.startAddressOfRawData = datatypes.DWORD(<NUM_LIT:0>) <EOL>self.endAddressOfRawData = datatypes.DWORD(<NUM_LIT:0>) <EOL>self.addressOfIndex = datatypes.DWORD(<NUM_LIT:0>) <EOL>self.addressOfCallbacks = datatypes.DWORD(<NUM_LIT:0>) <EOL>self.sizeOfZeroFill =...
Class representation of a C{IMAGE_TLS_DIRECTORY} structure. @see: Figure 11 U{http://msdn.microsoft.com/en-us/magazine/bb985996.aspx} @type shouldPack: bool @param shouldPack: (Optional) If set to c{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11794:c4:m0
def getType(self):
return consts.TLS_DIRECTORY32<EOL>
Returns L{consts.TLS_DIRECTORY}.
f11794:c4:m1
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
tlsDir = TLSDirectory()<EOL>tlsDir.startAddressOfRawData.value = readDataInstance.readDword()<EOL>tlsDir.endAddressOfRawData.value = readDataInstance.readDword()<EOL>tlsDir.addressOfIndex.value = readDataInstance.readDword()<EOL>tlsDir.addressOfCallbacks.value = readDataInstance.readDword()<EOL>tlsDir.sizeOfZeroFill.va...
Returns a new L{TLSDirectory} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object containing data to create a new L{TLSDirectory} object. @rtype: L{TLSDirectory} @return: A new {TLSDirectory} object.
f11794:c4:m2
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack)<EOL>self.startAddressOfRawData = datatypes.QWORD(<NUM_LIT:0>) <EOL>self.endAddressOfRawData = datatypes.QWORD(<NUM_LIT:0>) <EOL>self.addressOfIndex = datatypes.QWORD(<NUM_LIT:0>) <EOL>self.addressOfCallbacks = datatypes.QWORD(<NUM_LIT:0>) <EOL>self.sizeOfZeroFill =...
Class representation of a C{IMAGE_TLS_DIRECTORY} structure in 64 bits systems. @type shouldPack: bool @param shouldPack: (Optional) If set to c{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11794:c5:m0
def getType(self):
return consts.TLS_DIRECTORY64<EOL>
Returns L{consts.TLS_DIRECTORY64}.
f11794:c5:m1
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
tlsDir = TLSDirectory64()<EOL>tlsDir.startAddressOfRawData.value = readDataInstance.readQword()<EOL>tlsDir.endAddressOfRawData.value = readDataInstance.readQword()<EOL>tlsDir.addressOfIndex.value = readDataInstance.readQword()<EOL>tlsDir.addressOfCallbacks.value = readDataInstance.readQword()<EOL>tlsDir.sizeOfZeroFill....
Returns a new L{TLSDirectory64} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object containing data to create a new L{TLSDirectory64} object. @rtype: L{TLSDirectory64} @return: A new L{TLSDirectory64} object.
f11794:c5:m2
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack)<EOL>self.size = datatypes.DWORD()<EOL>self.timeDateStamp = datatypes.DWORD()<EOL>self.majorVersion = datatypes.WORD()<EOL>self.minorVersion = datatypes.WORD()<EOL>self.globalFlagsClear = datatypes.DWORD()<EOL>self.globalFlagsSet = datatypes.DWORD()<EOL>self.critica...
Class representation of a C{IMAGE_LOAD_CONFIG_DIRECTORY32} structure. @type shouldPack: bool @param shouldPack: (Optional) If set to c{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11794:c6:m0
def getType(self):
return consts.IMAGE_LOAD_CONFIG_DIRECTORY32<EOL>
Returns L{consts.IMAGE_LOAD_CONFIG_DIRECTORY32}.
f11794:c6:m1
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
configDir = ImageLoadConfigDirectory()<EOL>configDir.size.value = readDataInstance.readDword()<EOL>configDir.timeDateStamp.value = readDataInstance.readDword()<EOL>configDir.majorVersion.value = readDataInstance.readWord()<EOL>configDir.minorVersion.value = readDataInstance.readWord()<EOL>configDir.globalFlagsClear.val...
Returns a new L{ImageLoadConfigDirectory} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object containing data to create a new L{ImageLoadConfigDirectory} object. @rtype: L{ImageLoadConfigDirectory} @return: A new L{ImageLoadConfigDirectory} object.
f11794:c6:m2
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack)<EOL>self.size = datatypes.DWORD()<EOL>self.timeDateStamp = datatypes.DWORD()<EOL>self.majorVersion = datatypes.WORD()<EOL>self.minorVersion = datatypes.WORD()<EOL>self.globalFlagsClear = datatypes.DWORD()<EOL>self.globalFlagsSet = datatypes.DWORD()<EOL>self.critica...
Class representation of a C{IMAGE_LOAD_CONFIG_DIRECTORY64} structure in 64 bits systems. @type shouldPack: bool @param shouldPack: (Optional) If set to c{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11794:c7:m0
def getType(self):
return consts.IMAGE_LOAD_CONFIG_DIRECTORY64<EOL>
Returns L{consts.IMAGE_LOAD_CONFIG_DIRECTORY64}.
f11794:c7:m1
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
configDir = ImageLoadConfigDirectory64()<EOL>configDir.size.value = readDataInstance.readDword()<EOL>configDir.timeDateStamp.value = readDataInstance.readDword()<EOL>configDir.majorVersion.value = readDataInstance.readWord()<EOL>configDir.minorVersion.value = readDataInstance.readWord()<EOL>configDir.globalFlagsClear.v...
Returns a new L{ImageLoadConfigDirectory64} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object containing data to create a new L{ImageLoadConfigDirectory64} object. @rtype: L{ImageLoadConfigDirectory64} @return: A new L{ImageLoadConfigDirectory64} object.
f11794:c7:m2
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack)<EOL>self.virtualAddress = datatypes.DWORD(<NUM_LIT:0>) <EOL>self.sizeOfBlock = datatypes.DWORD(<NUM_LIT:0>) <EOL>self.items = datatypes.Array(datatypes.TYPE_WORD) <EOL>self._attrsList = ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]<EOL>
A class representation of a C{IMAGE_BASE_RELOCATION} structure. @see: U{http://msdn.microsoft.com/en-us/magazine/cc301808.aspx} @type shouldPack: bool @param shouldPack: (Optional) If set to c{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11794:c8:m0
def getType(self):
return consts.IMAGE_BASE_RELOCATION_ENTRY<EOL>
Returns L{consts.IMAGE_BASE_RELOCATION_ENTRY}.
f11794:c8:m1
@staticmethod<EOL><INDENT>def parse(readDataInstance):<DEDENT>
reloc = ImageBaseRelocationEntry()<EOL>reloc.virtualAddress.value = readDataInstance.readDword()<EOL>reloc.sizeOfBlock.value = readDataInstance.readDword()<EOL>toRead = (reloc.sizeOfBlock.value - <NUM_LIT:8>) / len(datatypes.WORD(<NUM_LIT:0>))<EOL>reloc.items = datatypes.Array.parse(readDataInstance, datatypes.TYPE_WO...
Returns a new L{ImageBaseRelocationEntry} object. @type readDataInstance: L{ReadData} @param readDataInstance: A L{ReadData} object with data to parse as a L{ImageBaseRelocationEntry} object. @rtype: L{ImageBaseRelocationEntry} @return: A new L{ImageBaseRelocationEntry} object.
f11794:c8:m2
def __init__(self, shouldPack = True):
baseclasses.BaseStructClass.__init__(self, shouldPack)<EOL>self.characteristics = datatypes.DWORD(<NUM_LIT:0>) <EOL>self.timeDateStamp = datatypes.DWORD(<NUM_LIT:0>) <EOL>self.majorVersion = datatypes.WORD(<NUM_LIT:0>) <EOL>self.minorVersion = datatypes.WORD(<NUM_LIT:0>) <EOL>self.type = datatypes.DWORD(<NUM_LIT:0>) <...
Class representation of a C{IMAGE_DEBUG_DIRECTORY} structure. @see: U{http://msdn.microsoft.com/es-es/library/windows/desktop/ms680307%28v=vs.85%29.aspx} @type shouldPack: bool @param shouldPack: (Optional) If set to c{True}, the object will be packed. If set to C{False}, the object won't be packed.
f11794:c10:m0
def getType(self):
return consts.IMAGE_DEBUG_DIRECTORY<EOL>
Returns L{consts.IMAGE_DEBUG_DIRECTORY}.
f11794:c10:m1