# -*- coding: utf-8 -*- """Set ShellCrash firewall_area=0 (no transparent hijack); verify paths.""" from __future__ import annotations import sys import httpx import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") GUEST_PW = "4669805" def main() -> int: c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect( "107.173.30.245", 4014, "eric", GUEST_PW, timeout=40, banner_timeout=80, allow_agent=False, look_for_keys=False, ) script = r""" set -e CFG=/etc/ShellCrash/configs/ShellCrash.cfg # Physical app host: do NOT transparent-redir the whole box (breaks WG/ops). # Explicit mixed :7890 still works for apps that opt in. if grep -q '^firewall_area=' "$CFG"; then sed -i 's/^firewall_area=.*/firewall_area=0/' "$CFG" else echo 'firewall_area=0' >>"$CFG" fi grep '^firewall_area=' "$CFG" systemctl restart shellcrash sleep 4 systemctl is-active shellcrash # clear any inherited proxy for this probe env -u http_proxy -u https_proxy -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u all_proxy \ curl -sS -m 8 -o /dev/null -w 'direct:%{http_code}\n' https://www.google.com/generate_204 || echo direct:fail env -u http_proxy -u https_proxy -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u all_proxy \ curl -sS -m 8 -o /dev/null -w 'mixed:%{http_code}\n' -x http://127.0.0.1:7890 https://www.google.com/generate_204 || echo mixed:fail curl -sS -m 3 -o /dev/null -w 'api:%{http_code}\n' http://127.0.0.1:8014/api/health ping -c1 -W2 10.8.0.1 >/dev/null && echo wg_ping:ok || echo wg_ping:fail ss -ltn | grep -E ':(7890|9999|8014|4015)\s' || true """ sftp = c.open_sftp() with sftp.file("/tmp/_sc_fw0.sh", "w") as f: f.write(script.replace("\r\n", "\n")) sftp.close() _, o, e = c.exec_command( f"echo '{GUEST_PW}' | sudo -S -p '' bash /tmp/_sc_fw0.sh", timeout=90, ) print((o.read() + e.read()).decode("utf-8", "replace")) c.close() print("dylive", httpx.get("https://dylive.nomadro.com/api/health", timeout=15).status_code) print("dy", httpx.get("https://dy.nomadro.com/api/health", timeout=15).status_code) return 0 if __name__ == "__main__": raise SystemExit(main())