use random iv so we finally have strong encryption now

This commit is contained in:
clowwindy
2013-05-22 11:35:25 +08:00
parent 0aa252e2b0
commit 9a6a934261
5 changed files with 65 additions and 30 deletions

View File

@ -67,18 +67,18 @@ class Socks5Server(SocketServer.StreamRequestHandler):
while True:
r, w, e = select.select(fdset, [], [])
if sock in r:
data = sock.recv(4096)
data = self.encrypt(sock.recv(4096))
if len(data) <= 0:
break
result = send_all(remote, self.encrypt(data))
result = send_all(remote, data)
if result < len(data):
raise Exception('failed to send all data')
if remote in r:
data = remote.recv(4096)
data = self.decrypt(remote.recv(4096))
if len(data) <= 0:
break
result = send_all(sock, self.decrypt(data))
result = send_all(sock, data)
if result < len(data):
raise Exception('failed to send all data')
finally: