def createFields(self): for index in range(1, 39+1): yield Float64(self, "unknown double[%s]" % index) for index in range(1, 2+1): yield UInt32(self, "unknown long[%s]" % index) for index in range(40, 41+1): yield Float64(self, "unknown double[%s]" % index)
def createFields(self): for index in range(1, 18 + 1): # 18 double yield Float64(self, "unknown double[%s]" % index) for index in range(1, 2 + 1): # 2 int yield UInt32(self, "unknown long[%s]" % index) for index in range(19, 22 + 1): # 4 double yield Float64(self, "unknown double[%s]" % index)
def createFields(self): for index in range(1, 4+1): yield UInt16(self, "unknown short[%s]" % index) for index in range(1, 3+1): yield Float64(self, "unknown double[%s]" % index) for index in range(5, 6+1): yield UInt16(self, "unknown short[%s]" % index) yield UInt32(self, "unknown long[%s]" % 3) yield Float64(self, "unknown double[%s]" % 4)
def createFields(self): for index in range(1, 2 + 1): yield UInt32(self, "unknown long[%s]" % index) for index in range(1, 3 + 1): yield Float64(self, "unknown double[%s]" % index) yield Float32(self, "unknown float[%s]" % 1) yield UInt32(self, "unknown long[%s]" % 3) yield Float64(self, "unknown double[%s]" % 4) yield Float64(self, "unknown double[%s]" % 5)
def createFields(self): for index in range(2, 10 + 1): yield Float32(self, "unknown float[%s]" % index) yield UInt32(self, "unknown long[%s]" % 45) for index in range(11, 13 + 1): yield Float64(self, "unknown double[%s]" % index) for index in range(46, 57 + 1): yield UInt32(self, "unknown long[%s]" % index) for index in range(14, 18 + 1): yield Float64(self, "unknown double[%s]" % index)
def createFields(self): yield SpectrumHeader(self, "header") yield RawBytes(self, "uknown area 1", 16) for index in range(1, 2 + 1): yield UInt32(self, "unknown index[%s]" % index) yield TimestampUnix32(self, "start") yield TimestampUnix32(self, "end") yield UInt32(self, "unknown long[%s]" % 1) yield RawBytes(self, "uknown area 2", 16) for index in range(2, 6 + 1): yield UInt32(self, "unknown long[%s]" % index) yield Float64(self, "unknown double") yield StructTwo(self, "unknown 52-byte structure") yield Struct100(self, "unknown 100-byte structure[1]") for index in range(1, 4 + 1): yield UInt16(self, "short[%s]" % index) yield Struct100(self, "unknown 100-byte structure[2]") for index in range(5, 6 + 1): yield UInt16(self, "short[%s]" % index) yield Struct100(self, "unknown 100-byte structure[3]") for index in range(7, 10 + 1): yield UInt16(self, "short[%s]" % index) yield Struct100(self, "unknown 100-byte structure[4]") for index in range(11, 14 + 1): yield UInt16(self, "short[%s]" % index)
def Float(parent): size = parent['size'].value if size == 4: return Float32(parent, 'float') elif size == 8: return Float64(parent, 'double') else: return RawBytes(parent, 'INVALID_FLOAT', size)
def createFields(self): for index in range(2, 5 + 1): yield UInt32(self, "unknown long[%s]" % index) yield Float64(self, "unknown double[%s]" % 1) yield Float32(self, "unknown float[%s]" % 10) for index in range(46, 55 + 1): yield UInt32(self, "unknown long[%s]" % index) for index in range(2, 4 + 1): yield Float64(self, "unknown double[%s]" % index) for index in range(11, 16 + 1): yield Float32(self, "unknown float[%s]" % index) # Undecoded tail if self.current_size < self._size: yield self.seekBit(self._size, "trailer")
def createFields(self): yield Enum(UInt8(self, "tag"), self.root.CONSTANT_TYPES) if self["tag"].value not in self.root.CONSTANT_TYPES: raise ParserError("Java: unknown constant type (%s)" % self["tag"].value) self.constant_type = self.root.CONSTANT_TYPES[self["tag"].value] if self.constant_type == "Utf8": yield PascalString16(self, "bytes", charset="UTF-8") elif self.constant_type == "Integer": yield Int32(self, "bytes") elif self.constant_type == "Float": yield Float32(self, "bytes") elif self.constant_type == "Long": yield Int64(self, "bytes") elif self.constant_type == "Double": yield Float64(self, "bytes") elif self.constant_type == "Class": yield CPIndex(self, "name_index", "Class or interface name", target_types="Utf8") elif self.constant_type == "String": yield CPIndex(self, "string_index", target_types="Utf8") elif self.constant_type == "Fieldref": yield CPIndex(self, "class_index", "Field class or interface name", target_types="Class") yield CPIndex(self, "name_and_type_index", target_types="NameAndType") elif self.constant_type == "Methodref": yield CPIndex(self, "class_index", "Method class name", target_types="Class") yield CPIndex(self, "name_and_type_index", target_types="NameAndType") elif self.constant_type == "InterfaceMethodref": yield CPIndex(self, "class_index", "Method interface name", target_types="Class") yield CPIndex(self, "name_and_type_index", target_types="NameAndType") elif self.constant_type == "NameAndType": yield CPIndex(self, "name_index", target_types="Utf8") yield CPIndex(self, "descriptor_index", target_types="Utf8") else: raise ParserError("Not a valid constant pool element type: " + self["tag"].value)
def createFields(self): if self["/suspected version"].value == 60: for index in range(1, 3 + 1): yield Float64(self, "unknown double[%s]" % index) for index in range(1, 14 + 1): yield UInt32(self, "unknown long[%s]" % index) yield UInt32(self, "structTwoCount") for n in range(1, self["structTwoCount"].value + 1): yield StructTwo(self, "StructTwo[%s]" % n) yield StructThree(self, "StructThree[%s]" % 1) elif self["/suspected version"].value == 52: yield Float64(self, "unknown double[%s]" % 1) yield UInt32(self, "unknown long[%s]" % 1) yield UInt32(self, "unknown long[%s]" % 2) yield Float64(self, "unknown double[%s]" % 2) for index in range(3, 4 + 1): yield UInt32(self, "unknown long[%s]" % index) yield Float64(self, "unknown double[%s]" % 3) for index in range(5, 13 + 1): yield UInt32(self, "unknown long[%s]" % index) yield UInt32(self, "structTwoCount") #for n in range(1, self["structTwoCount"].value + 1): for n in range(1, 9 + 1): yield StructTwo52(self, "StructTwo52[%s]" % n) yield StructThree52(self, "StructThree52[%s]" % 1) yield PascalStringWin32(self, "file name") for index in range(14, 17 + 1): yield UInt32(self, "unknown long[%s]" % index)
def createFields(self): for index in range(1, 2 + 1): yield Int32( self, "unknown long[%s]" % index, "these may be binary type flags (as in ScanEventPreamble)") for index in range(3, 4 + 1): yield UInt32(self, "unknown long[%s]" % index) yield Float64(self, "unknown double[%s]" % 1) yield Float32(self, "unknown float[%s]" % 1) yield UInt32( self, "resolution", "As in: FTMS + p norm !corona !pi res=60000 o(400.0-2000.0)") yield Float32(self, "unknown float[%s]" % 2) yield Float32(self, "unknown float[%s]" % 3) for index in range(6, 19 + 1): yield UInt32(self, "unknown long[%s]" % index) yield Float64(self, "unknown double[%s]" % 4) yield UInt32(self, "default charge state") yield UInt32(self, "unknown long[%s]" % 21) yield Float64(self, "unknown double[%s]" % 5) yield Float64(self, "unknown double[%s]" % 6) for index in range(4, 19 + 1): yield Float32(self, "unknown float[%s]" % index) yield UInt32(self, "n_act_param") for n in range(1, self["n_act_param"].value + 1): yield ActivationParam(self, "ActivationParam[%s]" % n) yield UInt32(self, "unknown long[%s]" % 23) yield UInt32(self, "unknown long[%s]" % 24) yield Float64(self, "low mz") yield Float64(self, "high mz") yield Float64(self, "unknown double[%s]" % 24) for index in range(20, 27 + 1): yield Float32(self, "unknown float[%s]" % index) for index in range(25, 25 + 1): yield UInt32(self, "unknown long[%s]" % index)
def createFields(self): yield ArrayOfShort18(self, "unknown array[2]", "some data similar to ArrayOfShort44") yield CString(self, "unknown string[1]", "", charset="UTF-16-LE") #, strip="\0") yield RawBytes(self, "zero[1]", 52, "padding") yield UInt16(self, "unknown short[1]") yield UInt32(self, "unknown long[1]") yield Float64(self, "unknown double[%s]" % 1) yield UInt32(self, "unknown long[2]") yield UInt32(self, "unknown long[3]") yield Float64(self, "unknown double[%s]" % 2) yield UInt16(self, "unknown short[2]") yield UInt16(self, "unknown short[3]") yield UInt32(self, "unknown long[4]") yield Float64(self, "unknown double[%s]" % 3) yield Float64(self, "unknown double[%s]" % 4) yield Float64(self, "unknown double[%s]" % 5) yield Struct1(self, "Struct1") yield ArrayOfShort512(self, "unknown array[1]", "Contains just a few numbers that can be relevant") yield Float64(self, "unknown double[%s]" % 6)
def createFields(self): for index in range(1, 6 + 1): # 6 int yield UInt32(self, "unknown long[%s]" % index) for index in range(1, 2 + 1): # 2 double yield Float64(self, "unknown double[%s]" % index)
def createFields(self): yield Float64(self, "normalized collision energy") yield Float64(self, "activation time") yield Float64(self, "activation Q")
def createFields(self): for index in range(1, 4+1): yield UInt16(self, "short[%s]" % index) yield Float64(self, "unknown double")
def createFields(self): for index in range(1, 28+1): yield Float64(self, "unknown double[%s]" % index)
def parseDouble(parent): yield Float64(parent, "value")
def parseBinaryComplex(parent): yield Float64(parent, "real") yield Float64(parent, "complex")
def parseDate(parent): yield Float64(parent, "timestamp_microsec") yield UInt16(parent, "timestamp_sec")
def parseBinaryFloat(parent): yield Float64(parent, "value")
def createFields(self): yield UInt32(self, "magic number") yield UInt32(self, "unknown long[%s]" % 2) yield UInt32(self, "suspected version") if self["suspected version"].value == 60: for index in range(4, 20 + 1): yield UInt32(self, "unknown long[%s]" % index) for index in range(1, 7 + 1): yield Float64(self, "unknown double[%s]" % index) yield Float64(self, "run time") for index in range(9, 10 + 1): yield Float64(self, "unknown double[%s]" % index) for index in range(21, 23 + 1): yield UInt32(self, "unknown long[%s]" % index) yield Float64(self, "segment duration") for index in range(24, 25 + 1): yield UInt32(self, "unknown long[%s]" % index) yield UInt32(self, "structOneCount") for n in range(1, self["structOneCount"].value + 1): yield StructOne(self, "StructOne[%s]" % n) yield UInt32(self, "n_events") for n in range(1, self["n_events"].value + 1): yield ScanEvent(self, "ScanEvent[%s]" % n) yield PascalStringWin32( self, "orig file name", "The original file name as seen on the instrument controller") yield PascalStringWin32(self, "unknown string") yield UInt32(self, "unknown long[%s]" % 26) for n in range(1, 3 + 1): yield StructFour(self, "StructFour[%s]" % n) for n in range(1, 3 + 1): yield StructFive(self, "StructFive[%s]" % n) ##################################################################### elif self["suspected version"].value == 52: for index in range(4, 18 + 1): yield UInt32(self, "unknown long[%s]" % index) for index in range(1, 7 + 1): yield Float64(self, "unknown double[%s]" % index) yield Float64(self, "run time") yield Float64(self, "segment duration") yield Float64(self, "unknown double[%s]" % 11) yield UInt32(self, "structOneCount") for n in range(1, self["structOneCount"].value + 1): yield StructOne(self, "StructOne[%s]" % n) for index in range(12, 13 + 1): yield Float64(self, "unknown double[%s]" % index) for index in range(19, 24 + 1): yield UInt32(self, "unknown long[%s]" % index) for index in range(14, 41 + 1): yield Float64(self, "unknown double[%s]" % index) for index in range(25, 26 + 1): yield UInt32(self, "unknown long[%s]" % index) for index in range(42, 43 + 1): yield Float64(self, "unknown double[%s]" % index) for index in range(27, 28 + 1): yield UInt32(self, "unknown long[%s]" % index) for index in range(44, 49 + 1): yield Float64(self, "unknown double[%s]" % index) for index in range(29, 36 + 1): yield UInt32(self, "unknown long[%s]" % index) yield Float64(self, "unknown double[%s]" % 50) for index in range(37, 56 + 1): yield UInt32(self, "unknown long[%s]" % index) for index in range(51, 54 + 1): yield Float64(self, "unknown double[%s]" % index) for index in range(57, 63 + 1): yield UInt32(self, "unknown long[%s]" % index) yield Float64(self, "unknown double[%s]" % 55) for index in range(64, 74 + 1): yield UInt32(self, "unknown long[%s]" % index) yield Float64(self, "unknown double[%s]" % 56) yield Float64(self, "unknown double[%s]" % 57) yield UInt32(self, "unknown long[%s]" % 75) for index in range(58, 66 + 1): yield Float64(self, "unknown double[%s]" % index) for index in range(76, 78 + 1): yield UInt32(self, "unknown long[%s]" % index) for index in range(67, 69 + 1): yield Float64(self, "unknown double[%s]" % index) for index in range(79, 90 + 1): yield UInt32(self, "unknown long[%s]" % index) yield Float64(self, "unknown double[%s]" % 70) for index in range(91, 96 + 1): yield UInt32(self, "unknown long[%s]" % index) for index in range(71, 80 + 1): yield Float64(self, "unknown double[%s]" % index)
def createFields(self): yield Enum(Bits(self, "marker_type", 4), {0: "Simple", 1: "Int", 2: "Real", 3: "Date", 4: "Data", 5: "ASCII String", 6: "UTF-16-BE String", 8: "UID", 10: "Array", 13: "Dict",}) markertype = self['marker_type'].value if markertype == 0: # Simple (Null) yield Enum(Bits(self, "value", 4), {0: "Null", 8: "False", 9: "True", 15: "Fill Byte",}) if self['value'].display == "False": self.xml=lambda prefix:prefix + "<false/>" elif self['value'].display == "True": self.xml=lambda prefix:prefix + "<true/>" else: self.xml=lambda prefix:prefix + "" elif markertype == 1: # Int yield Bits(self, "size", 4, "log2 of number of bytes") size=self['size'].value # 8-bit (size=0), 16-bit (size=1) and 32-bit (size=2) numbers are unsigned # 64-bit (size=3) numbers are signed yield GenericInteger(self, "value", (size>=3), (2**size)*8) self.xml=lambda prefix:prefix + "<integer>%s</integer>"%self['value'].value elif markertype == 2: # Real yield Bits(self, "size", 4, "log2 of number of bytes") if self['size'].value == 2: # 2**2 = 4 byte float yield Float32(self, "value") elif self['size'].value == 3: # 2**3 = 8 byte float yield Float64(self, "value") else: # FIXME: What is the format of the real? yield Bits(self, "value", (2**self['size'].value)*8) self.xml=lambda prefix:prefix + "<real>%s</real>"%self['value'].value elif markertype == 3: # Date yield Bits(self, "extra", 4, "Extra value, should be 3") cvt_time=lambda v:datetime(2001,1,1) + timedelta(seconds=v) yield displayHandler(Float64(self, "value"),lambda x:humanDatetime(cvt_time(x))) self.xml=lambda prefix:prefix + "<date>%s</date>"%(cvt_time(self['value'].value).isoformat()) elif markertype == 4: # Data yield BPListSize(self, "size") if self['size'].value: yield Bytes(self, "value", self['size'].value) self.xml=lambda prefix:prefix + "<data>\n%s\n%s</data>"%(self['value'].value.encode('base64').strip(),prefix) else: self.xml=lambda prefix:prefix + '<data></data>' elif markertype == 5: # ASCII String yield BPListSize(self, "size") if self['size'].value: yield String(self, "value", self['size'].value, charset="ASCII") self.xml=lambda prefix:prefix + "<string>%s</string>"%(self['value'].value.encode('iso-8859-1')) else: self.xml=lambda prefix:prefix + '<string></string>' elif markertype == 6: # UTF-16-BE String yield BPListSize(self, "size") if self['size'].value: yield String(self, "value", self['size'].value*2, charset="UTF-16-BE") self.xml=lambda prefix:prefix + "<string>%s</string>"%(self['value'].value.encode('utf-8')) else: self.xml=lambda prefix:prefix + '<string></string>' elif markertype == 8: # UID yield Bits(self, "size", 4, "Number of bytes minus 1") yield GenericInteger(self, "value", False, (self['size'].value + 1)*8) self.xml=lambda prefix:prefix + "" # no equivalent? elif markertype == 10: # Array yield BPListSize(self, "size") size = self['size'].value if size: yield BPListArray(self, "value", size) self.xml=lambda prefix:self['value'].createXML(prefix) elif markertype == 13: # Dict yield BPListSize(self, "size") yield BPListDict(self, "value", self['size'].value) self.xml=lambda prefix:self['value'].createXML(prefix) else: yield Bits(self, "value", 4) self.xml=lambda prefix:''
def createFields(self): #yield CString(self, "finnigan signature", "Finnigan signature (wide ASCIIZ string)", charset="UTF-16-LE") #, strip="\0") yield String(self, "finnigan signature", 120, "Finnigan signature (wide ASCIIZ string)", charset="UTF-16-LE", truncate="\0") for index in range(2, 4+1): yield UInt32(self, "unknown long[%s]" % index) yield TimestampUnix32(self, "time[1]") yield UInt32(self, "unknown long[%s]" % 6) yield RawBytes(self, "zero[2]", 120, "padding") for index in range(7, 10+1): yield UInt32(self, "unknown long[%s]" % index) ##################################################################### #yield ArrayOfLong(self, "unknown array") yield ArrayOfLong(self, "unknown array") yield RawBytes(self, "zero[3]", 80, "padding") yield LinearRamp(self, "linear ramp") yield CString(self, "header file", "The full filesystem path to the header file", charset="UTF-16-LE") yield ArrayOfShort172(self, "unknown array[2]") yield CString(self, "method file", "The full filesystem path to the method file", charset="UTF-16-LE") yield RawBytes(self, "zero[4]", 1044, "padding") ## --------------- struct 2 -------------------- yield UInt16(self, "unknown short") yield RawBytes(self, "zero[5]", 28, "padding") # ----- strutct 1 -------------- yield Struct1(self, "Struct1[1]") yield Struct1(self, "Struct1[2]") yield ArrayOfShort96(self, "unknown array[3]") yield RawBytes(self, "zero[6]", 1586, "padding") ## --------------- struct 2 -------------------- yield UInt16(self, "unknown short (bis)") yield RawBytes(self, "zero[7]", 28, "padding") # ----- strutct 1 -------------- yield Struct1(self, "Struct1[3]") yield Struct1var(self, "unknown struct") yield Struct1(self, "Struct1[5]") yield UInt16(self, "unknown short[1]") yield RawBytes(self, "junk[1]", 766, "probably buffer detritus") yield Struct1(self, "Struct1[4]") yield RawBytes(self, "undecoded[1]", 4184, "probably junk, but there are several instances of Struct1 in it") yield ArrayOfShort32(self, "unknown array[4]") yield TimestampUnix32(self, "time[1]") yield CString(self, "tune file", "Path to tune file (wide ASCIIZ string)", charset="UTF-16-LE") #, strip="\0") yield UInt16(self, "unknown short[2]") yield CString(self, "file path[1]", "Uknown file path", charset="UTF-16-LE") #, strip="\0") yield ArrayOfShort120(self, "unknown array[5]", "Contains 9x periodic structure with inrementing element") yield CString(self, "unknown string[1]", "", charset="UTF-16-LE") #, strip="\0") yield CString(self, "unknown string[2]", "", charset="UTF-16-LE") #, strip="\0") yield ArrayOfShort30(self, "unknown array[6]") yield TimestampUnix32(self, "time[2]") yield TimestampUnix32(self, "time[3]") yield CString(self, "unknown string[3]", "", charset="UTF-16-LE") #, strip="\0") yield ArrayOfShort36(self, "unknown array[7]", "Contains 4x periodic structure") yield CString(self, "unknown string[4]", "", charset="UTF-16-LE") #, strip="\0") yield RawBytes(self, "zero[8]", 530, "padding") yield CString(self, "unknown string[5]", "", charset="UTF-16-LE") #, strip="\0") yield CString(self, "unknown string[6]", "", charset="UTF-16-LE") #, strip="\0") yield RawBytes(self, "zero[9]", 266, "padding") yield CString(self, "unknown string[7]", "", charset="UTF-16-LE") #, strip="\0") yield CString(self, "unknown string[8]", "", charset="UTF-16-LE") #, strip="\0") yield RawBytes(self, "zero[10]", 226, "padding") yield CString(self, "unknown string[9]", "", charset="UTF-16-LE") #, strip="\0") yield CString(self, "unknown string[10]", "", charset="UTF-16-LE") #, strip="\0") yield RawBytes(self, "zero[11]", 226, "padding") yield CString(self, "unknown string[11]", "", charset="UTF-16-LE") #, strip="\0") yield RawBytes(self, "zero[12]", 236, "padding") yield ArrayOfShort44(self, "unknown array[8]", "Contains 4x periodic structure with increment [0..3]") # -------------- Ions -------------------------- for index in range(1, 4+1): yield IonStruct(self, "ion struct[%s]" % index, "unknown ion-based structure") yield ArrayOfShort1856(self, "unknown array[9]", "Contains a 4x-periodic structure near the start [25..40]") for index in range(1, 4+1): yield Struct2(self, "Struct2[%s]" % index, "") yield ArrayOfShort2344(self, "unknown array[10]", "Poissibly contains two large and two small periods") for index in range(1, 2+1): yield Struct4(self, "Struct4[%s]" % index) yield ArrayOfLong224(self, "unknown Struct4[%s]-associated array" % index) yield Struct4(self, "Struct4[%s]" % 3) yield UInt16(self, "count 1") yield UInt16(self, "count 2") for index in range(1, 40+1): yield Struct3(self, "Struct3[%s]" % index) for index in range(1, 10+1): yield Float64(self, "unknown double[%s]" % index) for index in range(1, 40+1): yield Struct5(self, "Struct5[%s]" % index) # --- irregularity --- for index in range(1, 2+1): yield UInt32(self, "unknown long[%s]" % index) for index in range(41, 80+1): yield Struct5(self, "Struct5[%s]" % index) for index in range(81, 120+1): yield Struct5(self, "Struct5var[%s]" % index) yield self.seekBit(self._size, "trailer")