Example #1
0
def DES(key, data):
    """
    @summary: DES use in microsoft specification
    @param key: {str}    Des key on 56 bits or 7 bytes
    @param data: {str}    data to encrypt
    """
    return pyDes.des(expandDesKey(key)).encrypt(data)
Example #2
0
def DES(key, data):
    """
    @summary: DES use in microsoft specification
    @param key: {str}    Des key on 56 bits or 7 bytes
    @param data: {str}    data to encrypt
    """
    return pyDes.des(expandDesKey(key)).encrypt(data)
Example #3
0
File: rfb.py Project: chushuai/rdpy
    def recvVNCChallenge(self, data):
        """
        @summary: receive challenge in VNC authentication case
        @param data: Stream that contain well formed packet 
        """
        key = (self._password + '\0' * 8)[:8]
        newkey = []
        for ki in range(len(key)):
            bsrc = ord(key[ki])
            btgt = 0
            for i in range(8):
                if bsrc & (1 << i):
                    btgt = btgt | (1 << 7 - i)
            newkey.append(chr(btgt))

        algo = des(newkey)
        self.send(String(algo.encrypt(data.getvalue())))
        self.expect(4, self.recvSecurityResult)
Example #4
0
    def recvVNCChallenge(self, data):
        """
        @summary: receive challenge in VNC authentication case
        @param data: Stream that contain well formed packet 
        """
        key = (self._password + '\0' * 8)[:8]
        newkey = []
        for ki in range(len(key)):
            bsrc = ord(key[ki])
            btgt = 0
            for i in range(8):
                if bsrc & (1 << i):
                    btgt = btgt | (1 << 7-i)
            newkey.append(chr(btgt))

        algo = des(newkey)
        self.send(String(algo.encrypt(data.getvalue())))
        self.expect(4, self.recvSecurityResult)