Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from crypto import *
- from socket import *
- message = ''
- seed = int(input('Seed: '))
- a = Crypto('key1', message, seed)
- s = socket(AF_INET,SOCK_STREAM)
- s.bind(('', 20))
- s.listen(5)
- c,b = s.accept()
- print(b)
- key = a.key+'\n'
- c.send(b'CRYPT_KEY\n '+key.encode()+b'\n ')
- message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at vestibulum ante, sed lobortis nisi. Etiam est lacus, euismod at lorem eu, vulputate vehicula nunc.'
- message = message.split(' ')
- ack = False
- n = 0
- for word in message:
- a.update(word)
- c.send(a.In().encode())
- n += 1
- print(n)
- resp = b''
- while resp is not b'ACK\n':
- print('Waiting for client response...')
- resp = c.recv(4096)
- continue
- c.send(b'FIN\n')
- c.close()
- s.close()
Advertisement
Add Comment
Please, Sign In to add comment