From dd8ccf6f6eee0114e79018a55be3a01a2830fcdb Mon Sep 17 00:00:00 2001 From: clowwindy Date: Sun, 30 Dec 2012 14:57:56 +0800 Subject: [PATCH] rollback --- local.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/local.py b/local.py index f0e889f..04f283b 100755 --- a/local.py +++ b/local.py @@ -100,9 +100,9 @@ class Socks5Server(SocketServer.StreamRequestHandler): def handle(self): try: - data = self.rfile.read(2) - self.rfile.read(ord(data[1])) - self.wfile.write("\x05\x00") + sock = self.connection + sock.recv(262) + sock.send("\x05\x00") data = self.rfile.read(4) mode = ord(data[1]) if mode != 1: @@ -127,7 +127,7 @@ class Socks5Server(SocketServer.StreamRequestHandler): port = struct.unpack('>H', addr_port) try: reply = "\x05\x00\x00\x01" - reply += socket.inet_aton('0.0.0.0') + struct.pack(">H", 0) + reply += socket.inet_aton('0.0.0.0') + struct.pack(">H", 2222) self.wfile.write(reply) # reply immediately if '-6' in sys.argv[1:]: @@ -141,7 +141,7 @@ class Socks5Server(SocketServer.StreamRequestHandler): except socket.error, e: logging.warn(e) return - self.handle_tcp(self.connection, remote) + self.handle_tcp(sock, remote) except socket.error, e: logging.warn(e)