From e875df752f8cb6a22066823f4e97879d2d7bf0da Mon Sep 17 00:00:00 2001 From: clowwindy Date: Wed, 6 Jun 2012 15:43:50 +0800 Subject: [PATCH] lint code --- local.py | 14 +++++++------- server.py | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/local.py b/local.py index 6889260..34f7d10 100755 --- a/local.py +++ b/local.py @@ -64,13 +64,13 @@ class Socks5Server(SocketServer.StreamRequestHandler): remote.close() def encrypt(self, data): - return data.translate(encrypt_table) + return data.translate(encrypt_table) def decrypt(self, data): - return data.translate(decrypt_table) + return data.translate(decrypt_table) def send_encrpyt(self, sock, data): - sock.send(self.encrypt(data)) + sock.send(self.encrypt(data)) def handle(self): try: @@ -81,8 +81,8 @@ class Socks5Server(SocketServer.StreamRequestHandler): data = self.rfile.read(4) mode = ord(data[1]) if mode != 1: - print 'mode != 1' - return + print 'mode != 1' + return addrtype = ord(data[3]) addr_to_send = data[3] if addrtype == 1: @@ -94,9 +94,9 @@ class Socks5Server(SocketServer.StreamRequestHandler): addr = self.rfile.read(ord(addr_len)) addr_to_send += addr_len + addr else: - print 'not support' + print 'not support' # not support - return + return addr_port = self.rfile.read(2) addr_to_send += addr_port port = struct.unpack('>H', addr_port) diff --git a/server.py b/server.py index a6d82a4..276e75f 100755 --- a/server.py +++ b/server.py @@ -62,13 +62,13 @@ class Socks5Server(SocketServer.StreamRequestHandler): remote.close() def encrypt(self, data): - return data.translate(encrypt_table) + return data.translate(encrypt_table) def decrypt(self, data): - return data.translate(decrypt_table) + return data.translate(decrypt_table) def send_encrpyt(self, sock, data): - sock.send(self.encrypt(data)) + sock.send(self.encrypt(data)) def handle(self): try: @@ -86,10 +86,10 @@ class Socks5Server(SocketServer.StreamRequestHandler): return port = struct.unpack('>H', self.decrypt(self.rfile.read(2))) try: + print 'Tcp connecting to', addr, port[0] remote = socket.socket(socket.AF_INET, socket.SOCK_STREAM) remote.connect((addr, port[0])) local = remote.getsockname() - print 'Tcp connect to', addr, port[0] except socket.error: # Connection refused return