Browse Source

rollback

1.4
clowwindy 12 years ago
parent
commit
dd8ccf6f6e
  1. 10
      local.py

10
local.py

@ -100,9 +100,9 @@ class Socks5Server(SocketServer.StreamRequestHandler):
def handle(self): def handle(self):
try: try:
data = self.rfile.read(2) sock = self.connection
self.rfile.read(ord(data[1])) sock.recv(262)
self.wfile.write("\x05\x00") sock.send("\x05\x00")
data = self.rfile.read(4) data = self.rfile.read(4)
mode = ord(data[1]) mode = ord(data[1])
if mode != 1: if mode != 1:
@ -127,7 +127,7 @@ class Socks5Server(SocketServer.StreamRequestHandler):
port = struct.unpack('>H', addr_port) port = struct.unpack('>H', addr_port)
try: try:
reply = "\x05\x00\x00\x01" 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) self.wfile.write(reply)
# reply immediately # reply immediately
if '-6' in sys.argv[1:]: if '-6' in sys.argv[1:]:
@ -141,7 +141,7 @@ class Socks5Server(SocketServer.StreamRequestHandler):
except socket.error, e: except socket.error, e:
logging.warn(e) logging.warn(e)
return return
self.handle_tcp(self.connection, remote) self.handle_tcp(sock, remote)
except socket.error, e: except socket.error, e:
logging.warn(e) logging.warn(e)

Loading…
Cancel
Save