当前位置: 编程技术>python
Python写的Socks5协议代理服务器
来源: 互联网 发布时间:2014-10-10
本文导语: 直接上代码: #!/usr/bin/python # Filename s5.py # Python Dynamic Socks5 Proxy # Usage: python s5.py 1080 # Background Run: nohup python s5.py 1080 & import socket, sys, select, SocketServer, struct, time class ThreadingTCPServer(SocketServer.ThreadingMixIn, SocketServer.TC...
直接上代码:
#!/usr/bin/python # Filename s5.py # Python Dynamic Socks5 Proxy # Usage: python s5.py 1080 # Background Run: nohup python s5.py 1080 & import socket, sys, select, SocketServer, struct, time class ThreadingTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer): pass class Socks5Server(SocketServer.StreamRequestHandler): def handle_tcp(self, sock, remote): fdset = [sock, remote] while True: r, w, e = select.select(fdset, [], []) if sock in r: if remote.send(sock.recv(4096))