mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-09-06 09:51:06 +00:00
Update server.py
This commit is contained in:
parent
ce23bd341e
commit
df42b8dc6e
18
server.py
18
server.py
|
@ -137,6 +137,24 @@ def proxy_server(webserver, port, scheme, method, url, conn, addr, data):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("SSL negotiation failed. %s" % (str(e)))
|
raise Exception("SSL negotiation failed. %s" % (str(e)))
|
||||||
|
|
||||||
|
if server_url == "localhost":
|
||||||
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
|
||||||
|
context = ssl.create_default_context()
|
||||||
|
context.check_hostname = False
|
||||||
|
context.verify_mode = ssl.CERT_NONE
|
||||||
|
|
||||||
|
ssl_sock = context.wrap_socket(sock, server_hostname=webserver)
|
||||||
|
ssl_sock.connect((webserver, port))
|
||||||
|
ssl_sock.sendall(data)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
data = ssl_sock.recv(1024)
|
||||||
|
if not data:
|
||||||
|
break
|
||||||
|
conn.send(data)
|
||||||
|
print("[*] Request and received. Done. %s" % (str(addr[0])))
|
||||||
|
else:
|
||||||
proxy_data = {
|
proxy_data = {
|
||||||
'headers': {
|
'headers': {
|
||||||
"User-Agent": "php-httpproxy/0.1.3 (Client; Python " + python_version() + "; abuse@catswords.net)",
|
"User-Agent": "php-httpproxy/0.1.3 (Client; Python " + python_version() + "; abuse@catswords.net)",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user