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