def __init__(self, readLen = None): """ @param readLen: Max size of packet """ CompositeType.__init__(self, readLen = readLen) self.numberRectangles = UInt16Le(lambda:len(self.rectangles._array)) self.rectangles = ArrayType(BitmapData, readLen = self.numberRectangles)
def __init__(self, targetUser = 0, readLen = None): """ @param targetUser: MCS Channel ID """ CompositeType.__init__(self, readLen = readLen) self.messageType = UInt16Le(1, constant = True) self.targetUser = UInt16Le(targetUser)
def __init__(self, incremental = False, x = 0, y = 0, width = 0, height = 0): CompositeType.__init__(self) self.incremental = UInt8(incremental) self.x = UInt16Be(x) self.y = UInt16Be(y) self.width = UInt16Be(width) self.height = UInt16Be(height)
def __init__(self): CompositeType.__init__(self) self.x = UInt16Be() self.y = UInt16Be() self.width = UInt16Be() self.height = UInt16Be() self.encoding = SInt32Be()
def __init__(self, readLen = None): CompositeType.__init__(self, readLen = readLen) self.glyphCache = ArrayType(CacheEntry, init = [CacheEntry() for _ in range(0,10)], readLen = CallableValue(10)) self.fragCache = UInt32Le() #all fonts are sent with bitmap format (very expensive) self.glyphSupportLevel = UInt16Le(GlyphSupport.GLYPH_SUPPORT_NONE) self.pad2octets = UInt16Le()
def __init__(self): #in old version this packet is empty i don't know #and not specified CompositeType.__init__(self, optional = True) self.shareId = UInt32Le() self.lengthSourceDescriptor = UInt16Le(lambda:sizeof(self.sourceDescriptor)) self.sourceDescriptor = String("rdpy", readLen = self.lengthSourceDescriptor)
def __init__(self, readLen = None): CompositeType.__init__(self, readLen = readLen) self.serverRandom = String("\x00" * 32, readLen = CallableValue(32)) self.productInfo = ProductInformation() self.keyExchangeList = LicenseBinaryBlob(BinaryBlobType.BB_KEY_EXCHG_ALG_BLOB) self.serverCertificate = LicenseBinaryBlob(BinaryBlobType.BB_CERTIFICATE_BLOB) self.scopeList = ScopeList()
def __init__(self): CompositeType.__init__(self) self.Signature = String("NTLMSSP\x00", readLen = CallableValue(8), constant = True) self.MessageType = UInt32Le(0x00000003, constant = True) self.LmChallengeResponseLen = UInt16Le() self.LmChallengeResponseMaxLen = UInt16Le(lambda:self.LmChallengeResponseLen.value) self.LmChallengeResponseBufferOffset = UInt32Le() self.NtChallengeResponseLen = UInt16Le() self.NtChallengeResponseMaxLen = UInt16Le(lambda:self.NtChallengeResponseLen.value) self.NtChallengeResponseBufferOffset = UInt32Le() self.DomainNameLen = UInt16Le() self.DomainNameMaxLen = UInt16Le(lambda:self.DomainNameLen.value) self.DomainNameBufferOffset = UInt32Le() self.UserNameLen = UInt16Le() self.UserNameMaxLen = UInt16Le(lambda:self.UserNameLen.value) self.UserNameBufferOffset = UInt32Le() self.WorkstationLen = UInt16Le() self.WorkstationMaxLen = UInt16Le(lambda:self.WorkstationLen.value) self.WorkstationBufferOffset = UInt32Le() self.EncryptedRandomSessionLen = UInt16Le() self.EncryptedRandomSessionMaxLen = UInt16Le(lambda:self.EncryptedRandomSessionLen.value) self.EncryptedRandomSessionBufferOffset = UInt32Le() self.NegotiateFlags = UInt32Le() self.Version = Version(conditional = lambda:(self.NegotiateFlags.value & Negotiate.NTLMSSP_NEGOTIATE_VERSION)) self.MIC = String("\x00" * 16, readLen = CallableValue(16)) self.Payload = String()
def __init__(self): CompositeType.__init__(self) self.len = UInt8(lambda:sizeof(self) - 1) self.code = UInt8(MessageType.X224_TPDU_CONNECTION_CONFIRM, constant = True) self.padding = (UInt16Be(), UInt16Be(), UInt8()) #read if there is enough data self.protocolNeg = Negotiation(optional = True)
def __init__(self, updateData = None, readLen = None): """ @param updateType: UpdateType macro @param updateData: Update data PDU in accordance with updateType (BitmapUpdateDataPDU) @param readLen: Max length to read """ CompositeType.__init__(self, readLen = readLen) self.updateType = UInt16Le(lambda:updateData.__class__._UPDATE_TYPE_) def UpdateDataFactory(): """ @summary: Create object in accordance self.updateType value """ for c in [BitmapUpdateDataPDU]: if self.updateType.value == c._UPDATE_TYPE_: return c() log.debug("unknown PDU update data type : %s"%hex(self.updateType.value)) return String() if updateData is None: updateData = FactoryType(UpdateDataFactory, conditional = lambda:(self.updateType.value != UpdateType.UPDATETYPE_SYNCHRONIZE)) elif not "_UPDATE_TYPE_" in updateData.__class__.__dict__: raise InvalidExpectedDataException("Try to send an invalid data update PDU") self.updateData = updateData
def __init__(self, conditional): CompositeType.__init__(self, conditional = conditional) self.ProductMajorVersion = UInt8(MajorVersion.WINDOWS_MAJOR_VERSION_6) self.ProductMinorVersion = UInt8(MinorVersion.WINDOWS_MINOR_VERSION_0) self.ProductBuild = UInt16Le(6002) self.Reserved = UInt24Le() self.NTLMRevisionCurrent = UInt8(NTLMRevision.NTLMSSP_REVISION_W2K3)
def __init__(self, errorInfo = 0, readLen = None): """ @param errorInfo: ErrorInfo macro @param readLen: Max length to read """ CompositeType.__init__(self, readLen = readLen) #use to collect error info PDU self.errorInfo = UInt32Le(errorInfo)
def __init__(self, readLen = None): CompositeType.__init__(self, readLen = readLen) self.encryptionMethod = UInt32Le() self.encryptionLevel = UInt32Le() self.serverRandomLen = UInt32Le(0x00000020, constant = True, conditional = lambda:not(self.encryptionMethod.value == 0 and self.encryptionLevel == 0)) self.serverCertLen = UInt32Le(lambda:sizeof(self.serverCertificate), conditional = lambda:not(self.encryptionMethod.value == 0 and self.encryptionLevel == 0)) self.serverRandom = String(readLen = self.serverRandomLen, conditional = lambda:not(self.encryptionMethod.value == 0 and self.encryptionLevel == 0)) self.serverCertificate = ServerCertificate(readLen = self.serverCertLen, conditional = lambda:not(self.encryptionMethod.value == 0 and self.encryptionLevel == 0))
def __init__(self, optional = False): CompositeType.__init__(self, optional = optional) self.code = UInt8() self.flag = UInt8(0) #always 8 self.len = UInt16Le(0x0008, constant = True) self.selectedProtocol = UInt32Le(conditional = lambda: (self.code.value != NegociationType.TYPE_RDP_NEG_FAILURE)) self.failureCode = UInt32Le(conditional = lambda: (self.code.value == NegociationType.TYPE_RDP_NEG_FAILURE))
def __init__(self, isDelta, conditional = lambda:True): """ @param isDelta: callable object to know if coord field is in delta mode @param conditional: conditional read or write type """ CompositeType.__init__(self, conditional = conditional) self.delta = SInt8(conditional = isDelta) self.coordinate = SInt16Le(conditional = isDelta)
def __init__(self): CompositeType.__init__(self) self.len = UInt8(lambda:sizeof(self) - 1) self.code = UInt8(MessageType.X224_TPDU_CONNECTION_REQUEST, constant = True) self.padding = (UInt16Be(), UInt16Be(), UInt8()) self.cookie = String(until = "\x0d\x0a", conditional = lambda:(self.len._is_readed and self.len.value > 14)) #read if there is enough data self.protocolNeg = Negotiation(optional = True)
def __init__(self, size, pduType2 = 0, shareId = 0): CompositeType.__init__(self) self.shareId = UInt32Le(shareId) self.pad1 = UInt8() self.streamId = UInt8(StreamId.STREAM_LOW) self.uncompressedLength = UInt16Le(lambda:(UInt16Le(size).value - 8)) self.pduType2 = UInt8(pduType2) self.compressedType = UInt8() self.compressedLength = UInt16Le()
def __init__(self): CompositeType.__init__(self) self.dwVersion = UInt32Le() self.cbCompanyName = UInt32Le(lambda:sizeof(self.pbCompanyName)) #may contain "Microsoft Corporation" from server microsoft self.pbCompanyName = String("Microsoft Corporation", readLen = self.cbCompanyName, unicode = True) self.cbProductId = UInt32Le(lambda:sizeof(self.pbProductId)) #may contain "A02" from microsoft license server self.pbProductId = String("A02", readLen = self.cbProductId, unicode = True)
def __init__(self, readLen = None): """ @param readLen: Max read length """ CompositeType.__init__(self, readLen = readLen) self.numberFonts = UInt16Le() self.totalNumFonts = UInt16Le() self.listFlags = UInt16Le(0x0003) self.entrySize = UInt16Le(0x0032)
def __init__(self, action = None, readLen = None): """ @param action: Action macro @param readLen: Max length to read """ CompositeType.__init__(self, readLen = readLen) self.action = UInt16Le(action, constant = True) if not action is None else UInt16Le() self.grantId = UInt16Le() self.controlId = UInt32Le()
def __init__(self, controlFlag): CompositeType.__init__(self) #only one field self.fieldFlag = UInt8(conditional = lambda:(controlFlag.value & ControlFlag.TS_ZERO_FIELD_BYTE_BIT0 == 0 and controlFlag.value & ControlFlag.TS_ZERO_FIELD_BYTE_BIT1 == 0)) self.nLeftRect = CoordField(lambda:not controlFlag.value & ControlFlag.TS_DELTA_COORDINATES == 0) self.nTopRect = CoordField(lambda:not controlFlag.value & ControlFlag.TS_DELTA_COORDINATES == 0) self.nWidth = CoordField(lambda:not controlFlag.value & ControlFlag.TS_DELTA_COORDINATES == 0) self.nHeight = CoordField(lambda:not controlFlag.value & ControlFlag.TS_DELTA_COORDINATES == 0) self.bRop = CoordField(lambda:not controlFlag.value & ControlFlag.TS_DELTA_COORDINATES == 0)
def __init__(self, readLen = None): """ @param readLen: Max read length """ CompositeType.__init__(self, readLen = readLen) self.numberEntries = UInt16Le() self.totalNumEntries = UInt16Le() self.mapFlags = UInt16Le(0x0003) self.entrySize = UInt16Le(0x0004)
def __init__(self, readLen = None): CompositeType.__init__(self, readLen = readLen) self.lenUsername = UInt16Le(lambda:sizeof(self.username)) self.username = String(readLen = self.lenUsername) self.lenPassword = UInt16Le(lambda:sizeof(self.password)) self.password = String(readLen = self.lenPassword) self.lenDomain = UInt16Le(lambda:sizeof(self.domain)) self.domain = String(readLen = self.lenDomain) self.lenHostname = UInt16Le(lambda:sizeof(self.hostname)) self.hostname = String(readLen = self.lenHostname)
def __init__(self, readLen): CompositeType.__init__(self, readLen = readLen) #magic is RSA1(0x31415352) self.magic = UInt32Le(0x31415352, constant = True) self.keylen = UInt32Le(lambda:(sizeof(self.modulus) + sizeof(self.padding))) self.bitlen = UInt32Le(lambda:((self.keylen.value - 8) * 8)) self.datalen = UInt32Le(lambda:((self.bitlen.value / 8) - 1)) self.pubExp = UInt32Le() self.modulus = String(readLen = CallableValue(lambda:(self.keylen.value - 8))) self.padding = String("\x00" * 8, readLen = CallableValue(8))
def __init__(self): CompositeType.__init__(self) self.shareId = UInt32Le() self.originatorId = UInt16Le(0x03EA, constant = True) self.lengthSourceDescriptor = UInt16Le(lambda:sizeof(self.sourceDescriptor)) self.lengthCombinedCapabilities = UInt16Le(lambda:(sizeof(self.numberCapabilities) + sizeof(self.pad2Octets) + sizeof(self.capabilitySets))) self.sourceDescriptor = String("rdpy", readLen = self.lengthSourceDescriptor) self.numberCapabilities = UInt16Le(lambda:len(self.capabilitySets._array)) self.pad2Octets = UInt16Le() self.capabilitySets = ArrayType(caps.Capability, readLen = self.numberCapabilities)
def __init__(self, readLen = None): CompositeType.__init__(self, readLen = readLen) #RSA and must be only RSA self.preferredKeyExchangeAlg = UInt32Le(0x00000001, constant = True) #pure microsoft client ;-) #http://msdn.microsoft.com/en-us/library/1040af38-c733-4fb3-acd1-8db8cc979eda#id10 self.platformId = UInt32Le(0x04000000 | 0x00010000) self.clientRandom = String("\x00" * 32, readLen = CallableValue(32)) self.encryptedPreMasterSecret = LicenseBinaryBlob(BinaryBlobType.BB_RANDOM_BLOB) self.ClientUserName = LicenseBinaryBlob(BinaryBlobType.BB_CLIENT_USER_NAME_BLOB) self.ClientMachineName = LicenseBinaryBlob(BinaryBlobType.BB_CLIENT_MACHINE_NAME_BLOB)
def __init__(self, conditional): CompositeType.__init__(self, conditional = conditional) self.clientAddressFamily = UInt16Le(AfInet.AF_INET) self.cbClientAddress = UInt16Le(lambda:sizeof(self.clientAddress)) self.clientAddress = String(readLen = self.cbClientAddress, unicode = True) self.cbClientDir = UInt16Le(lambda:sizeof(self.clientDir)) self.clientDir = String(readLen = self.cbClientDir, unicode = True) #TODO make tiomezone self.clientTimeZone = String("\x00" * 172) self.clientSessionId = UInt32Le() self.performanceFlags = UInt32Le()
def __init__(self, totalLength, pduType, userId): """ @summary: Set pduType as constant @param totalLength: total length of PDU packet """ CompositeType.__init__(self) #share control header self.totalLength = UInt16Le(totalLength) self.pduType = UInt16Le(pduType) #for xp sp3 and deactiveallpdu PDUSource may not be present self.PDUSource = UInt16Le(userId, optional = True)
def __init__(self): CompositeType.__init__(self) self.dwSigAlgId = UInt32Le(0x00000001, constant = True) self.dwKeyAlgId = UInt32Le(0x00000001, constant = True) self.wPublicKeyBlobType = UInt16Le(0x0006, constant = True) self.wPublicKeyBlobLen = UInt16Le(lambda:sizeof(self.PublicKeyBlob)) self.PublicKeyBlob = RSAPublicKey(readLen = self.wPublicKeyBlobLen) self.wSignatureBlobType = UInt16Le(0x0008, constant = True) self.wSignatureBlobLen = UInt16Le(lambda:(sizeof(self.SignatureBlob) + sizeof(self.padding))) self.SignatureBlob = String(readLen = CallableValue(lambda:(self.wSignatureBlobLen.value - sizeof(self.padding)))) self.padding = String(b"\x00" * 8, readLen = CallableValue(8))
def __init__(self, readLen = None): CompositeType.__init__(self, readLen = readLen) self.destLeft = UInt16Le() self.destTop = UInt16Le() self.destRight = UInt16Le() self.destBottom = UInt16Le() self.width = UInt16Le() self.height = UInt16Le() self.bpp = UInt8() self.format = UInt8() self.length = UInt32Le(lambda:sizeof(self.data)) self.data = String(readLen = self.length)
def __init__(self): CompositeType.__init__(self) self.scopeCount = UInt32Le(lambda: sizeof(self.scopeArray)) self.scopeArray = ArrayType(Scope, readLen=self.scopeCount)
def __init__(self): CompositeType.__init__(self) self.scope = LicenseBinaryBlob(BinaryBlobType.BB_SCOPE_BLOB)
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen) self.dwErrorCode = UInt32Le() self.dwStateTransition = UInt32Le() self.blob = LicenseBinaryBlob(BinaryBlobType.BB_ANY_BLOB)
def __init__(self, init=[], readLen=None): CompositeType.__init__(self, readLen=readLen) self.settings = ArrayType(DataBlock, [DataBlock(i) for i in init])
def __init__(self): CompositeType.__init__(self) self.length = UInt32Le(lambda:(sizeof(self) - 4)) self.encryptedClientRandom = String(readLen = CallableValue(lambda:(self.length.value - 8))) self.padding = String("\x00" * 8, readLen = CallableValue(8))
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen) self.colorTableCacheSize = UInt16Le(0x0006) self.pad2octets = UInt16Le()
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen) self.MaxRequestSize = UInt32Le(0)
def __init__(self, blobType = BinaryBlobType.BB_ANY_BLOB, optional = False): CompositeType.__init__(self, optional = optional) self.wBlobType = UInt16Le(blobType, constant = True if blobType != BinaryBlobType.BB_ANY_BLOB else False) self.wBlobLen = UInt16Le(lambda:sizeof(self.blobData)) self.blobData = String(readLen = self.wBlobLen)
def __init__(self, readLen = None): CompositeType.__init__(self, readLen = readLen) self.controlFlags = UInt16Le() self.remoteDetachFlag = UInt16Le() self.controlInterest = UInt16Le(0x0002) self.detachInterest = UInt16Le(0x0002)
def __init__(self, readLen = None): CompositeType.__init__(self, readLen = readLen) self.flags = UInt32Le(VirtualChannelCompressionFlag.VCCAPS_NO_COMPR) self.VCChunkSize = UInt32Le(optional = True)
def __init__(self, readLen = None): CompositeType.__init__(self, readLen = readLen) self.brushSupportLevel = UInt32Le(BrushSupport.BRUSH_DEFAULT)
def __init__(self): CompositeType.__init__(self) self.cacheEntries = UInt16Le() self.cacheMaximumCellSize = UInt16Le()
def __init__(self): CompositeType.__init__(self) self.Version = UInt32Le(0x00000001, constant = True) self.Checksum = String(readLen = CallableValue(8)) self.SeqNum = UInt32Le()
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen) self.connectFlags = UInt32Le() self.encryptedPlatformChallenge = LicenseBinaryBlob( BinaryBlobType.BB_ANY_BLOB) self.MACData = String(readLen=CallableValue(16))
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen) self.encryptedPlatformChallengeResponse = LicenseBinaryBlob( BinaryBlobType.BB_DATA_BLOB) self.encryptedHWID = LicenseBinaryBlob(BinaryBlobType.BB_DATA_BLOB) self.MACData = String(readLen=CallableValue(16))
def __init__(self): CompositeType.__init__(self) self.cbCert = UInt32Le(lambda: sizeof(self.abCert)) self.abCert = String(readLen=self.cbCert)
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen) self.nodeId = UInt16Le() self.pad2octets = UInt16Le()
def __init__(self): CompositeType.__init__(self) self.NumCertBlobs = UInt32Le() self.CertBlobArray = ArrayType(CertBlob, readLen=self.NumCertBlobs) self.padding = String( readLen=CallableValue(lambda: (8 + 4 * self.NumCertBlobs.value)))
def __init__(self): CompositeType.__init__(self) self.AvId = UInt16Le() self.AvLen = UInt16Le(lambda:sizeof(self.Value)) self.Value = String(readLen = self.AvLen)
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen) self.channelCount = UInt32Le(lambda: len(self.channelDefArray._array)) self.channelDefArray = ArrayType(ChannelDef, readLen=self.channelCount)
def __init__(self): CompositeType.__init__(self) self.header = UInt8(2) self.messageType = UInt8(MessageType.X224_TPDU_DATA, constant=True) self.separator = UInt8(0x80, constant=True)
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen) self.width = UInt16Le() self.height = UInt16Le() self.colorDepth = UInt8()
def __init__(self, isServer = False, readLen = None): CompositeType.__init__(self, readLen = readLen) self.colorPointerFlag = UInt16Le() self.colorPointerCacheSize = UInt16Le(20) #old version of rdp doesn't support ... self.pointerCacheSize = UInt16Le(conditional = lambda:isServer)
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen)
def __init__(self, readLen = None): CompositeType.__init__(self, readLen = readLen) self.offscreenSupportLevel = UInt32Le(OffscreenSupportLevel.FALSE) self.offscreenCacheSize = UInt16Le() self.offscreenCacheEntries = UInt16Le()
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen) self.code = UInt32Le() self.isPressed = UInt8()
def __init__(self, readLen = None): CompositeType.__init__(self, readLen = readLen) self.soundFlags = UInt16Le(SoundFlag.NONE) self.pad2octetsA = UInt16Le()
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen) self.flags = UInt32Le() self.redirectedSessionID = UInt32Le()
def __init__(self, readLen = None): CompositeType.__init__(self, readLen = readLen) self.helpKeyFlag = UInt16Le() self.helpKeyIndexFlag = UInt16Le() self.helpExtendedKeyFlag = UInt16Le() self.windowManagerKeyFlag = UInt16Le()
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen) self.rdpVersion = UInt32Le(Version.RDP_VERSION_5_PLUS) self.clientRequestedProtocol = UInt32Le(optional=True)