Exemple #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))
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #6
0
 def send(self, data: bytes, header=0):
     pdu = SecurityPDU(header, data)
     data = self.mainParser.write(pdu)
     self.previous.send(data)
Exemple #7
0
 def sendBytes(self, data: bytes, header=0):
     pdu = SecurityPDU(header, data)
     self.sendPDU(pdu)
Exemple #8
0
 def sendLicensing(self, data: bytes):
     """
     Send raw licensing data.
     """
     pdu = SecurityPDU(SecurityFlags.SEC_LICENSE_PKT, data)
     self.sendPDU(pdu)