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
943ff478aa
commit
69a3c5f323
|
@ -140,7 +140,7 @@ def conn_string(conn: socket.socket, data: bytes, addr: bytes):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# debugging
|
# debugging
|
||||||
logger.debug("@ " + str(addr))
|
logger.debug("@ " + ("%s:%s" % addr))
|
||||||
logger.debug("> " + str(data))
|
logger.debug("> " + str(data))
|
||||||
|
|
||||||
# JSON-RPC 2.0 request over Socket (stateful)
|
# JSON-RPC 2.0 request over Socket (stateful)
|
||||||
|
@ -625,13 +625,13 @@ def proxy_server(
|
||||||
logger.info("[*] Connecting...")
|
logger.info("[*] Connecting...")
|
||||||
connector.connect(conn, data, webserver, port, scheme, method, url)
|
connector.connect(conn, data, webserver, port, scheme, method, url)
|
||||||
else:
|
else:
|
||||||
raise Exception("Unsupported connection type")
|
raise Exception("[*] The request from " + ("%s:%s" % addr) + " is ignored due to an undefined connector type.")
|
||||||
|
|
||||||
logger.info("[*] Request and received. Done. %s" % (str(addr[0])))
|
logger.info("[*] Request and received. Done. %s" % (str(addr[0])))
|
||||||
conn.close()
|
conn.close()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
logger.error("[*] Exception on requesting the data.", exc_info=e)
|
logger.warning("[*] Ignored the request.", exc_info=e)
|
||||||
conn.sendall(b'HTTP/1.1 403 Forbidden\r\n\r\n{"status":403}')
|
conn.sendall(b'HTTP/1.1 403 Forbidden\r\n\r\n{"status":403}')
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user