예제 #1
0
 def __init__(self, shouldPack=True):
     """
     Class representation of the C{IMAGE_DATA_DIRECTORY} structure. 
     @see: U{http://msdn.microsoft.com/es-es/library/windows/desktop/ms680305%28v=vs.85%29.aspx}
     
     @type shouldPack: bool
     @param shouldPack: If set to C{True} the L{Directory} object will be packed. If set to C{False} the object won't be packed.
     """
     self.name = datatypes.String("")
     self.rva = datatypes.DWORD(0)  #: L{DWORD} rva.
     self.size = datatypes.DWORD(0)  #: L{DWORD} size.
     self.info = None  #: This variable holds the information of the directory.
     self.shouldPack = shouldPack
예제 #2
0
 def parse(self, readDataInstance):
     if self.dt.netMetaDataTableHeader.heapOffsetSizes.value & 0x4:
         self.offset = datatypes.DWORD(readDataInstance.readDword()).value
     else:
         self.offset = datatypes.WORD(readDataInstance.readWord()).value
     self.value = self.getBlob(self.offset)
     return self
예제 #3
0
 def parse(self, readDataInstance):
     if self.dwordIndex():
         self.value = self.decodeValue(
             datatypes.DWORD(readDataInstance.readDword()).value)
     else:
         self.value = self.decodeValue(
             datatypes.WORD(readDataInstance.readWord()).value)
     return self
예제 #4
0
def MetadataTableDefinitions(dt, netMetaDataStreams):
    return {
        0x00: [
            {
                "generation": datatypes.WORD()
            },
            {
                "name": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "mvId": GuidHeapIndex(dt, netMetaDataStreams)
            },
            {
                "encId": GuidHeapIndex(dt, netMetaDataStreams)
            },
            {
                "encBaseId": GuidHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x01: [
            {
                "resolutionScope":
                ResolutionScopeIndex(dt, netMetaDataStreams)
            },
            {
                "typeName": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "typeNamespace": StringHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x02: [
            {
                "flags": datatypes.DWORD()
            },
            {
                "typeName": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "typeNamespace": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "extends": TypeDefOrRefIndex(dt, netMetaDataStreams)
            },
            {
                "fieldList": FieldIndex(dt, netMetaDataStreams)
            },
            {
                "methodList": MethodDefIndex(dt, netMetaDataStreams)
            },
        ],
        0x03: [
            {
                "ref": datatypes.WORD()
            },
        ],
        0x04: [
            {
                "flags": datatypes.WORD()
            },
            {
                "name": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "signature": BlobHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x05: [
            {
                "ref": datatypes.WORD()
            },
        ],
        0x06: [
            {
                "rva": datatypes.DWORD()
            },
            {
                "implFlags": datatypes.WORD()
            },
            {
                "flags": datatypes.WORD()
            },
            {
                "name": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "signature": BlobHeapIndex(dt, netMetaDataStreams)
            },
            {
                "paramList": ParamIndex(dt, netMetaDataStreams)
            },
        ],
        0x07: [
            {
                "ref": datatypes.WORD()
            },
        ],
        0x08: [
            {
                "flags": datatypes.WORD()
            },
            {
                "sequence": datatypes.WORD()
            },
            {
                "name": StringHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x09: [
            {
                "class": TypeDefIndex(dt, netMetaDataStreams)
            },
            {
                "interface": TypeDefOrRefIndex(dt, netMetaDataStreams)
            },
        ],
        0x0a: [
            {
                "class": MemberRefParentIndex(dt, netMetaDataStreams)
            },
            {
                "name": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "signature": BlobHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x0b: [
            {
                "type": datatypes.WORD()
            },
            {
                "parent": HasConstantIndex(dt, netMetaDataStreams)
            },
            {
                "value": BlobHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x0c: [
            {
                "parent": HasCustomAttributeIndex(dt, netMetaDataStreams)
            },
            {
                "type": CustomAttributeTypeIndex(dt, netMetaDataStreams)
            },
            {
                "value": BlobHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x0d: [
            {
                "parent": HasFieldMarshallIndex(dt, netMetaDataStreams)
            },
            {
                "nativeType": BlobHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x0e: [
            {
                "action": datatypes.WORD()
            },
            {
                "parent": HasDeclSecurityIndex(dt, netMetaDataStreams)
            },
            {
                "permissionSet": BlobHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x0f: [
            {
                "packingSize": datatypes.WORD()
            },
            {
                "classSize": datatypes.DWORD()
            },
            {
                "parent": TypeDefIndex(dt, netMetaDataStreams)
            },
        ],
        0x10: [
            {
                "offset": datatypes.DWORD()
            },
            {
                "field": FieldIndex(dt, netMetaDataStreams)
            },
        ],
        0x11: [
            {
                "signature": BlobHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x12: [
            {
                "parent": TypeDefIndex(dt, netMetaDataStreams)
            },
            {
                "eventList": EventIndex(dt, netMetaDataStreams)
            },
        ],
        0x13: [
            {
                "ref": datatypes.WORD()
            },
        ],
        0x14: [
            {
                "eventFlags": datatypes.WORD()
            },
            {
                "name": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "eventType": TypeDefOrRefIndex(dt, netMetaDataStreams)
            },
        ],
        0x15: [
            {
                "parent": TypeDefIndex(dt, netMetaDataStreams)
            },
            {
                "propertyList": PropertyIndex(dt, netMetaDataStreams)
            },
        ],
        0x16: [
            {
                "ref": datatypes.WORD()
            },
        ],
        0x17: [
            {
                "flags": datatypes.WORD()
            },
            {
                "name": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "type": BlobHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x18: [
            {
                "semantics": datatypes.WORD()
            },
            {
                "method": MethodDefIndex(dt, netMetaDataStreams)
            },
            {
                "association": HasSemanticsIndex(dt, netMetaDataStreams)
            },
        ],
        0x19: [
            {
                "class": TypeDefIndex(dt, netMetaDataStreams)
            },
            {
                "methodBody": MethodDefOrRefIndex(dt, netMetaDataStreams)
            },
            {
                "methodDeclaration":
                MethodDefOrRefIndex(dt, netMetaDataStreams)
            },
        ],
        0x1a: [
            {
                "name": StringHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x1b: [
            {
                "signature": BlobHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x1c: [
            {
                "mappingFlags": datatypes.WORD()
            },
            {
                "memberForwarded":
                MemberForwardedIndex(dt, netMetaDataStreams)
            },
            {
                "importName": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "importScope": ModuleRefIndex(dt, netMetaDataStreams)
            },
        ],
        0x1d: [
            {
                "rva": datatypes.DWORD()
            },
            {
                "field": FieldIndex(dt, netMetaDataStreams)
            },
        ],
        0x1e:
        None,
        0x1f:
        None,
        0x20: [
            {
                "hashAlgId": datatypes.DWORD()
            },
            {
                "majorVersion": datatypes.WORD()
            },
            {
                "minorVersion": datatypes.WORD()
            },
            {
                "buildNumber": datatypes.WORD()
            },
            {
                "revisionNumber": datatypes.WORD()
            },
            {
                "flags": datatypes.DWORD()
            },
            {
                "publicKey": BlobHeapIndex(dt, netMetaDataStreams)
            },
            {
                "name": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "culture": StringHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x21: [
            {
                "processor": datatypes.DWORD()
            },
        ],
        0x22: [
            {
                "osPlatformId": datatypes.DWORD()
            },
            {
                "osMajorVersion": datatypes.DWORD()
            },
            {
                "osMinorVersion": datatypes.DWORD()
            },
        ],
        0x23: [
            {
                "majorVersion": datatypes.WORD()
            },
            {
                "minorVersion": datatypes.WORD()
            },
            {
                "buildNumber": datatypes.WORD()
            },
            {
                "revisionNumber": datatypes.WORD()
            },
            {
                "flags": datatypes.DWORD()
            },
            {
                "publicKeyOrToken": BlobHeapIndex(dt, netMetaDataStreams)
            },
            {
                "name": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "culture": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "hashValue": BlobHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x24: [
            {
                "processor": datatypes.DWORD()
            },
            {
                "assemblyRef": AssemblyRefIndex(dt, netMetaDataStreams)
            },
        ],
        0x25: [
            {
                "osPlatformId": datatypes.DWORD()
            },
            {
                "osMajorVersion": datatypes.DWORD()
            },
            {
                "osMinorVersion": datatypes.DWORD()
            },
            {
                "assemblyRef": AssemblyRefIndex(dt, netMetaDataStreams)
            },
        ],
        0x26: [
            {
                "flags": datatypes.DWORD()
            },
            {
                "name": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "hashValue": BlobHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x27: [
            {
                "flags": datatypes.DWORD()
            },
            {
                "typeDefId": datatypes.DWORD()
            },
            {
                "typeName": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "typeNamespace": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "implementation": ImplementationIndex(dt, netMetaDataStreams)
            },
        ],
        0x28: [
            {
                "offset": datatypes.DWORD()
            },
            {
                "flags": datatypes.DWORD()
            },
            {
                "name": StringHeapIndex(dt, netMetaDataStreams)
            },
            {
                "implementation": ImplementationIndex(dt, netMetaDataStreams)
            },
        ],
        0x29: [
            {
                "nestedClass": TypeDefIndex(dt, netMetaDataStreams)
            },
            {
                "enclosingClass": TypeDefIndex(dt, netMetaDataStreams)
            },
        ],
        0x2a: [
            {
                "number": datatypes.WORD()
            },
            {
                "flags": datatypes.WORD()
            },
            {
                "owner": TypeOrMethodDefIndex(dt, netMetaDataStreams)
            },
            {
                "name": StringHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x2b: [
            {
                "method": MethodDefOrRefIndex(dt, netMetaDataStreams)
            },
            {
                "instantiation": BlobHeapIndex(dt, netMetaDataStreams)
            },
        ],
        0x2c: [
            {
                "owner": GenericParamIndex(dt, netMetaDataStreams)
            },
            {
                "constraint": TypeDefOrRefIndex(dt, netMetaDataStreams)
            },
        ],
        0x2d:
        None,
        0x2e:
        None,
        0x2f:
        None,
        0x30:
        None,
        0x31:
        None,
        0x32:
        None,
        0x33:
        None,
        0x34:
        None,
        0x35:
        None,
        0x36:
        None,
        0x37:
        None,
        0x38:
        None,
        0x39:
        None,
        0x3a:
        None,
        0x3b:
        None,
        0x3c:
        None,
        0x3d:
        None,
        0x3e:
        None,
        0x3f:
        None,
    }