def readHeader(self): try: header = hexRepToBin(self.field1Form.get()) (bodySize, offset) = asn1.asn1Length(header[1:]) bodySize = hexToHexRep(bodySize) offset = hexToHexRep(offset + 1) self.writeToLog("HEADER:\n Body size: {0}\n Offset: {1}".format( bodySize, offset)) self.field1Form.delete(0, END) self.field2Form.delete(0, END) self.field1Form.insert(0, bodySize) self.field2Form.insert(0, offset) except Exception, msg: tkMessageBox.showerror("Error: Read header", str(msg))
def readHeader(self): try: header = hexRepToBin(self.field1Form.get()) (bodySize, offset) = asn1.asn1Length(header[1:]) bodySize = hexToHexRep(bodySize) offset = hexToHexRep(offset+1) self.writeToLog("HEADER:\n Body size: {0}\n Offset: {1}".format(bodySize, offset)) self.field1Form.delete(0, END) self.field2Form.delete(0, END) self.field1Form.insert(0, bodySize) self.field2Form.insert(0, offset) except Exception, msg: tkMessageBox.showerror("Error: Read header", str(msg))
def _getLength(self): (length, offset) = asn1Length(self._data[self._byteNb:]) self._byteNb += offset return length