mirror of https://github.com/n1nj4sec/pupy.git
fix socks5proxy / issue #88
This commit is contained in:
parent
4780fbcedf
commit
9a10eac781
|
@ -66,13 +66,19 @@ class SocketPiper(threading.Thread):
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
self.write_sock.shutdown(socket.SHUT_RDWR)
|
self.write_sock.shutdown(socket.SHUT_RDWR)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
self.write_sock.close()
|
self.write_sock.close()
|
||||||
except Exception:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
self.read_sock.shutdown(socket.SHUT_RDWR)
|
self.read_sock.shutdown(socket.SHUT_RDWR)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
self.read_sock.close()
|
self.read_sock.close()
|
||||||
except Exception:
|
except:
|
||||||
pass
|
pass
|
||||||
logging.debug("piper finished")
|
logging.debug("piper finished")
|
||||||
|
|
||||||
|
@ -82,8 +88,14 @@ class Socks5RequestHandler(SocketServer.BaseRequestHandler):
|
||||||
port=struct.pack("!H",self.server.server_address[1])
|
port=struct.pack("!H",self.server.server_address[1])
|
||||||
self.request.sendall("\x05"+code+"\x00"+"\x01"+ip+port)
|
self.request.sendall("\x05"+code+"\x00"+"\x01"+ip+port)
|
||||||
if terminate:
|
if terminate:
|
||||||
|
try:
|
||||||
self.request.shutdown(socket.SHUT_RDWR)
|
self.request.shutdown(socket.SHUT_RDWR)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
self.request.close()
|
self.request.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def handle(self):
|
def handle(self):
|
||||||
|
|
Loading…
Reference in New Issue