Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def testProxy(host, port):
- try:
- s = socket.socket()
- s.connect((host, int(port)))
- except:
- s.close()
- return False
- s.send(b"CONNECT %s:%s HTTP/1.0\r\n\r\n" % (host.encode('utf-8'), port.encode('utf-8')))
- try:
- buff = s.recv(128)
- except:
- s.close()
- return False
- if b"200 OK" in buff or b"200 Connection established" in buff:
- sendData(s, "NICK %s\r\n" % randNick())
- sendData(s, "USER x localhost %s :test\r\n" % targetHost)
- while 1:
- try:
- buff = s.recv(128)
- except Exception as err:
- print(err)
- if not buff:
- s.close()
- break
- for line in buff.split(b'\r\n'):
- words = line.split()
- if len(words) < 2:
- continue
- if words[0] == "PING":
- sendData(s, "PONG %s\r\n" % words[1])
- buff = ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement