fix socks5proxy / issue #88

This commit is contained in:
n1nj4sec 2016-05-01 23:03:59 +02:00
parent 4780fbcedf
commit 9a10eac781
1 changed files with 16 additions and 4 deletions

View File

@ -66,13 +66,19 @@ class SocketPiper(threading.Thread):
finally:
try:
self.write_sock.shutdown(socket.SHUT_RDWR)
except:
pass
try:
self.write_sock.close()
except Exception:
except:
pass
try:
self.read_sock.shutdown(socket.SHUT_RDWR)
except:
pass
try:
self.read_sock.close()
except Exception:
except:
pass
logging.debug("piper finished")
@ -82,8 +88,14 @@ class Socks5RequestHandler(SocketServer.BaseRequestHandler):
port=struct.pack("!H",self.server.server_address[1])
self.request.sendall("\x05"+code+"\x00"+"\x01"+ip+port)
if terminate:
try:
self.request.shutdown(socket.SHUT_RDWR)
except:
pass
try:
self.request.close()
except:
pass
def handle(self):