def __init__(self, extendedInfoConditional): CompositeType.__init__(self) #code page self.codePage = UInt32Le() #support flag self.flag = UInt32Le(InfoFlag.INFO_MOUSE | InfoFlag.INFO_UNICODE | InfoFlag.INFO_LOGONNOTIFY | InfoFlag.INFO_LOGONERRORS | InfoFlag.INFO_DISABLECTRLALTDEL) self.cbDomain = UInt16Le(lambda: sizeof(self.domain) - 2) self.cbUserName = UInt16Le(lambda: sizeof(self.userName) - 2) self.cbPassword = UInt16Le(lambda: sizeof(self.password) - 2) self.cbAlternateShell = UInt16Le( lambda: sizeof(self.alternateShell) - 2) self.cbWorkingDir = UInt16Le(lambda: sizeof(self.workingDir) - 2) #microsoft domain self.domain = String( readLen=CallableValue(lambda: self.cbDomain.value + 2), unicode=True) self.userName = String( readLen=CallableValue(lambda: self.cbUserName.value + 2), unicode=True) self.password = String( readLen=CallableValue(lambda: self.cbPassword.value + 2), unicode=True) #shell execute at start of session self.alternateShell = String( readLen=CallableValue(lambda: self.cbAlternateShell.value + 2), unicode=True) #working directory for session self.workingDir = String( readLen=CallableValue(lambda: self.cbWorkingDir.value + 2), unicode=True) self.extendedInfo = RDPExtendedInfo( conditional=extendedInfoConditional)
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen) self.MCSChannelId = UInt16Le(mcs.Channel.MCS_GLOBAL_CHANNEL) self.channelCount = UInt16Le(lambda: len(self.channelIdArray._array)) self.channelIdArray = ArrayType(UInt16Le, readLen=self.channelCount) self.pad = UInt16Le( conditional=lambda: ((self.channelCount.value % 2) == 1))
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): 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, 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): 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): #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, userId=0, pduMessage=None): CompositeType.__init__(self) self.shareControlHeader = ShareControlHeader( lambda: sizeof(self), lambda: pduMessage.__class__._PDUTYPE_, userId) def PDUMessageFactory(): """ @summary: build message in accordance of type self.shareControlHeader.pduType.value """ for c in [ DemandActivePDU, ConfirmActivePDU, DataPDU, DeactiveAllPDU ]: if self.shareControlHeader.pduType.value == c._PDUTYPE_: return c() log.debug("unknown PDU type : %s" % hex(self.shareControlHeader.pduType.value)) #read entire packet return String() if pduMessage is None: pduMessage = FactoryType(PDUMessageFactory) elif not "_PDUTYPE_" in pduMessage.__class__.__dict__: raise InvalidExpectedDataException("Try to send an invalid PDU") self.pduMessage = pduMessage
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, pduData=None, shareId=0): CompositeType.__init__(self) self.shareDataHeader = ShareDataHeader( lambda: sizeof(self), lambda: self.pduData.__class__._PDUTYPE2_, shareId) def PDUDataFactory(): """ @summary: Create object in accordance self.shareDataHeader.pduType2 value """ for c in [ UpdateDataPDU, SynchronizeDataPDU, ControlDataPDU, ErrorInfoDataPDU, FontListDataPDU, FontMapDataPDU, PersistentListPDU, ClientInputEventPDU, ShutdownDeniedPDU, ShutdownRequestPDU, SupressOutputDataPDU ]: if self.shareDataHeader.pduType2.value == c._PDUTYPE2_: return c() log.debug("unknown PDU data type : %s" % hex(self.shareDataHeader.pduType2.value)) return String() if pduData is None: pduData = FactoryType(PDUDataFactory) elif not "_PDUTYPE2_" in pduData.__class__.__dict__: raise InvalidExpectedDataException( "Try to send an invalid data PDU") self.pduData = pduData
def __init__(self, dataBlock=None): CompositeType.__init__(self) self.type = UInt16Le(lambda: self.dataBlock.__class__._TYPE_) self.length = UInt16Le(lambda: sizeof(self)) def DataBlockFactory(): """ @summary: build settings in accordance of type self.type.value """ for c in [ ClientCoreData, ClientSecurityData, ClientNetworkData, ServerCoreData, ServerNetworkData, ServerSecurityData ]: if self.type.value == c._TYPE_: return c(readLen=self.length - 4) log.debug("unknown GCC block type : %s" % hex(self.type.value)) #read entire packet return String(readLen=self.length - 4) if dataBlock is None: dataBlock = FactoryType(DataBlockFactory) elif not "_TYPE_" in dataBlock.__class__.__dict__: raise InvalidExpectedDataException( "Try to send an invalid GCC blocks") self.dataBlock = dataBlock
def __init__(self, event=None): CompositeType.__init__(self) self.type = UInt16Le(lambda: event.__class__._TYPE_) self.timestamp = UInt32Le() self.length = UInt32Le(lambda: (sizeof(self) - 10)) def EventFactory(): """ @summary: Closure for event factory """ for c in [ UpdateEvent, ScreenEvent, InfoEvent, CloseEvent, KeyEventScancode, KeyEventUnicode ]: if self.type.value == c._TYPE_: return c(readLen=self.length) log.debug("unknown event type : %s" % hex(self.type.value)) #read entire packet return String(readLen=self.length) if event is None: event = FactoryType(EventFactory) elif not "_TYPE_" in event.__class__.__dict__: raise error.InvalidExpectedDataException( "Try to send an invalid event block") self.event = event
def __init__(self, readLen=None): CompositeType.__init__(self, readLen=readLen) self.encryptionMethods = UInt32Le( EncryptionMethod.ENCRYPTION_FLAG_40BIT | EncryptionMethod.ENCRYPTION_FLAG_56BIT | EncryptionMethod.ENCRYPTION_FLAG_128BIT) self.extEncryptionMethods = UInt32Le()
def __init__(self): CompositeType.__init__(self) self.x = UInt16Be() self.y = UInt16Be() self.width = UInt16Be() self.height = UInt16Be() self.encoding = SInt32Be()
def __init__(self, updateData=None): CompositeType.__init__(self) self.updateHeader = UInt8( lambda: updateData.__class__._FASTPATH_UPDATE_TYPE_) self.compressionFlags = UInt8(conditional=lambda: ( (self.updateHeader.value >> 4 ) & FastPathOutputCompression.FASTPATH_OUTPUT_COMPRESSION_USED)) self.size = UInt16Le(lambda: sizeof(self.updateData)) def UpdateDataFactory(): """ @summary: Create correct object in accordance to self.updateHeader field """ for c in [FastPathBitmapUpdateDataPDU]: if (self.updateHeader.value & 0xf) == c._FASTPATH_UPDATE_TYPE_: return c() log.debug("unknown Fast Path PDU update data type : %s" % hex(self.updateHeader.value & 0xf)) return String() if updateData is None: updateData = FactoryType(UpdateDataFactory) elif not "_FASTPATH_UPDATE_TYPE_" in updateData.__class__.__dict__: raise InvalidExpectedDataException( "Try to send an invalid fast path data update PDU") self.updateData = updateData
def __init__(self): CompositeType.__init__(self) self.shareId = UInt32Le() self.lengthSourceDescriptor = UInt16Le( lambda: sizeof(self.sourceDescriptor)) self.sourceDescriptor = String("rdpy", readLen=self.lengthSourceDescriptor)
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, 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, 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, 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, message=None): CompositeType.__init__(self) #preambule self.bMsgtype = UInt8( lambda: self.licensingMessage.__class__._MESSAGE_TYPE_) self.flag = UInt8(Preambule.PREAMBLE_VERSION_3_0) self.wMsgSize = UInt16Le(lambda: sizeof(self)) def LicensingMessageFactory(): """ @summary: factory for message nego Use in read mode """ for c in [ LicensingErrorMessage, ServerLicenseRequest, ClientNewLicenseRequest, ServerPlatformChallenge, ClientPLatformChallengeResponse ]: if self.bMsgtype.value == c._MESSAGE_TYPE_: return c(readLen=self.wMsgSize - 4) log.debug("unknown license message : %s" % self.bMsgtype.value) return String() if message is None: message = FactoryType(LicensingMessageFactory) elif not "_MESSAGE_TYPE_" in message.__class__.__dict__: raise InvalidExpectedDataException( "Try to send an invalid license message") self.licensingMessage = message
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, 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, 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, readLen = None): CompositeType.__init__(self, readLen = readLen) self.glyphCache = ArrayType(CacheEntry, init = [CacheEntry() for _ in range(0,10)], readLen = UInt8(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, name="", options=0): CompositeType.__init__(self) #name of channel self.name = String(name[0:8] + "\x00" * (8 - len(name)), readLen=CallableValue(8)) #unknown self.options = UInt32Le()
def __init__(self): CompositeType.__init__(self) self.pad2OctetsA = UInt16Le() self.numberOrders = UInt16Le(lambda: len(self.orderData._array)) self.pad2OctetsB = UInt16Le() self.orderData = ArrayType(order.PrimaryDrawingOrder, readLen=self.numberOrders)
def __init__(self, capability=None): CompositeType.__init__(self) self.capabilitySetType = UInt16Le(lambda: capability.__class__._TYPE_) self.lengthCapability = UInt16Le(lambda: sizeof(self)) def CapabilityFactory(): """ Closure for capability factory """ for c in [ GeneralCapability, BitmapCapability, OrderCapability, BitmapCacheCapability, BitmapCacheRev2Capability, PointerCapability, InputCapability, BrushCapability, GlyphCapability, OffscreenBitmapCacheCapability, VirtualChannelCapability, SoundCapability, ControlCapability, WindowActivationCapability, FontCapability, ColorCacheCapability, ShareCapability, MultiFragmentUpdate ]: if self.capabilitySetType.value == c._TYPE_ and ( self.lengthCapability.value - 4) > 0: return c(readLen=self.lengthCapability - 4) log.debug("unknown Capability type : %s" % hex(self.capabilitySetType.value)) #read entire packet return String(readLen=self.lengthCapability - 4) if capability is None: capability = FactoryType(CapabilityFactory) elif not "_TYPE_" in capability.__class__.__dict__: raise InvalidExpectedDataException( "Try to send an invalid capability block") self.capability = capability
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, 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, 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, readLen=None): CompositeType.__init__(self, readLen=readLen) self.rdpVersion = UInt32Le(Version.RDP_VERSION_5_PLUS) self.desktopWidth = UInt16Le(1280) self.desktopHeight = UInt16Le(800) self.colorDepth = UInt16Le(ColorDepth.RNS_UD_COLOR_8BPP) self.sasSequence = UInt16Le(Sequence.RNS_UD_SAS_DEL) self.kbdLayout = UInt32Le(KeyboardLayout.US) self.clientBuild = UInt32Le(3790) self.clientName = String("rdpy" + "\x00" * 11, readLen=UInt8(32), unicode=True) self.keyboardType = UInt32Le(KeyboardType.IBM_101_102_KEYS) self.keyboardSubType = UInt32Le(0) self.keyboardFnKeys = UInt32Le(12) self.imeFileName = String("\x00" * 64, readLen=UInt8(64)) self.postBeta2ColorDepth = UInt16Le(ColorDepth.RNS_UD_COLOR_8BPP) self.clientProductId = UInt16Le(1) self.serialNumber = UInt32Le(0) self.highColorDepth = UInt16Le(HighColor.HIGH_COLOR_24BPP) self.supportedColorDepths = UInt16Le(Support.RNS_UD_15BPP_SUPPORT | Support.RNS_UD_16BPP_SUPPORT | Support.RNS_UD_24BPP_SUPPORT | Support.RNS_UD_32BPP_SUPPORT) self.earlyCapabilityFlags = UInt16Le( CapabilityFlags.RNS_UD_CS_SUPPORT_ERRINFO_PDU) self.clientDigProductId = String("\x00" * 64, readLen=UInt8(64)) self.connectionType = UInt8() self.pad1octet = UInt8() self.serverSelectedProtocol = UInt32Le()
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, 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, 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, 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, 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, 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, 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, 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, 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, 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): 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, 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): 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) 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, 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): 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) #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, 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, 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)