示例#1
0
 def sendLicensing(self, data):
     """
     Send raw licensing data.
     :type data: bytes
     """
     pdu = SecurityPDU(SecurityFlags.SEC_LICENSE_PKT, data)
     self.previous.send(self.mainParser.write(pdu))
示例#2
0
 def sendClientInfo(self, pdu: ClientInfoPDU):
     """
     Send a client info PDU.
     """
     data = self.clientInfoParser.write(pdu)
     pdu = SecurityPDU(SecurityFlags.SEC_INFO_PKT, data)
     self.sendPDU(pdu)
示例#3
0
 def sendClientInfo(self, pdu):
     """
     Send a client info PDU.
     :type pdu: ClientInfoPDU
     """
     data = self.clientInfoParser.write(pdu)
     pdu = SecurityPDU(SecurityFlags.SEC_INFO_PKT, data)
     data = self.mainParser.write(pdu)
     self.previous.send(data)
示例#4
0
    def parse(self, data):
        """
        Decode a security PDU from bytes.
        :type data: bytes
        :return: RDPSecurityPDU
        """
        stream = BytesIO(data)
        header = Uint32LE.unpack(stream)

        if header & SecurityFlags.SEC_EXCHANGE_PKT != 0:
            return self.parseSecurityExchange(stream, header)

        payload = stream.read()
        return SecurityPDU(header, payload)
示例#5
0
    def parse(self, data):
        stream = BytesIO(data)
        header = Uint32LE.unpack(stream)

        if header & SecurityFlags.SEC_EXCHANGE_PKT != 0:
            return self.parseSecurityExchange(stream, header)

        signature = stream.read(8)
        payload = stream.read()

        if header & SecurityFlags.SEC_ENCRYPT != 0:
            payload = self.crypter.decrypt(payload)
            self.crypter.addDecryption()

        return SecurityPDU(header, payload)
示例#6
0
 def send(self, data: bytes, header=0):
     pdu = SecurityPDU(header, data)
     data = self.mainParser.write(pdu)
     self.previous.send(data)
示例#7
0
 def sendBytes(self, data: bytes, header=0):
     pdu = SecurityPDU(header, data)
     self.sendPDU(pdu)
示例#8
0
 def sendLicensing(self, data: bytes):
     """
     Send raw licensing data.
     """
     pdu = SecurityPDU(SecurityFlags.SEC_LICENSE_PKT, data)
     self.sendPDU(pdu)