Browse Source

fix local

1.4
clowwindy 11 years ago
parent
commit
6dae7d231e
  1. 5
      shadowsocks/local.py

5
shadowsocks/local.py

@ -122,7 +122,6 @@ class Socks5Server(SocketServer.StreamRequestHandler):
self.encryptor = encrypt.Encryptor(KEY, METHOD) self.encryptor = encrypt.Encryptor(KEY, METHOD)
sock = self.connection sock = self.connection
data = sock.recv(262) data = sock.recv(262)
print '1.', len(data), data.encode('hex')
if not data: if not data:
sock.close() sock.close()
return return
@ -135,16 +134,13 @@ class Socks5Server(SocketServer.StreamRequestHandler):
sock.send('\x05\x02') sock.send('\x05\x02')
try: try:
ver_ulen = sock.recv(2) ver_ulen = sock.recv(2)
print ver_ulen.encode('hex')
ulen = ord(ver_ulen[1]) ulen = ord(ver_ulen[1])
if ulen: if ulen:
username = sock.recv(ulen) username = sock.recv(ulen)
print username
assert(ulen == len(username)) assert(ulen == len(username))
plen = ord(sock.recv(1)) plen = ord(sock.recv(1))
if plen: if plen:
_password = sock.recv(plen) _password = sock.recv(plen)
print _password
assert(plen == len(_password)) assert(plen == len(_password))
sock.send('\x01\x00') sock.send('\x01\x00')
except Exception as e: except Exception as e:
@ -156,7 +152,6 @@ class Socks5Server(SocketServer.StreamRequestHandler):
logging.error('unsupported method %d' % method) logging.error('unsupported method %d' % method)
return return
data = self.rfile.read(4) or '\x00' * 4 data = self.rfile.read(4) or '\x00' * 4
print '2.', len(data), data.encode('hex')
mode = ord(data[1]) mode = ord(data[1])
if mode == 1: if mode == 1:
pass pass

Loading…
Cancel
Save