#!/usr/bin/env python3 from __future__ import annotations import sys import time import httpx import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") def ssh(host, port, user, pw): c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) for i in range(6): try: c.connect( host, port, user, pw, timeout=45, banner_timeout=120, allow_agent=False, look_for_keys=False, ) return c except Exception as ex: print("retry", i, ex, flush=True) time.sleep(3) raise SystemExit("ssh fail") def run(c, cmd, t=90): _i, o, e = c.exec_command(cmd, timeout=t) o.channel.recv_exit_status() print((o.read() + e.read()).decode("utf-8", "replace"), flush=True) v = ssh("107.173.30.245", 22, "root", "Xiao4669805") print("===== VPS PB / neko / frp-aux =====", flush=True) run( v, r""" set +e echo '--- pb unit ---' systemctl status douyinweb-pb --no-pager -l | head -35 ls -la /opt/douyinWEB/pb/pocketbase 2>/dev/null grep -E '8092|8090|PB' /etc/systemd/system/douyinweb-pb.service /etc/douyinweb.env 2>/dev/null | head echo '--- who on 8090/8092 ---' ss -lntp | grep -E ':(8090|8092)\b' curl -sS -m 3 -o /dev/null -w '8090=%{http_code}\n' http://127.0.0.1:8090/ curl -sS -m 3 -o /dev/null -w '8092=%{http_code}\n' http://127.0.0.1:8092/ echo '--- neko containers all ---' docker ps -a --format '{{.Names}} {{.Status}}' | grep -i neko | head -40 echo '--- frp-aux tunnels ---' systemctl status dy-frp-http-aux --no-pager -l | head -50 ss -lntp | grep -E ':(18014|14015|28333|9999|920[0-7]|1820)\b' | head -40 echo '--- dylive neko1 public ---' curl -sS -m 8 -o /dev/null -w 'neko1=%{http_code}\n' https://dylive.nomadro.com/neko/1/ curl -sS -m 8 -o /dev/null -w 'neko1_local=%{http_code}\n' http://127.0.0.1:9200/ echo '--- wg latest-handshakes ---' wg show wg-dy latest-handshakes wg show wg-dy transfer # check firewall for 51820 reply iptables -L INPUT -n 2>/dev/null | grep -E '51820|wg' | head nft list ruleset 2>/dev/null | grep -E '51820|wg-dy' | head """, ) v.close() p = ssh("107.173.30.245", 4014, "eric", "4669805") print("===== PHYS PB binary / youtube =====", flush=True) run( p, r""" echo '4669805' | sudo -S -p '' bash -lc ' set +e ls -la /opt/douyinWEB/pb/ 2>/dev/null | head -20 file /opt/douyinWEB/pb/pocketbase 2>/dev/null which pocketbase 2>/dev/null cat /etc/systemd/system/douyinweb-pb.service echo "--- youtube service files ---" ls /etc/systemd/system/douyinweb* 2>/dev/null ps aux | grep -E "youtube|8020" | grep -v grep | head echo "--- neko 9+ (should fail via wg) ---" curl -sS -m 5 --noproxy "*" -o /dev/null -w "local9208=%{http_code}\n" http://127.0.0.1:9208/ || echo no9208 ss -lntp | grep 9208 || echo no_listen_9208 echo "--- iptables OUTPUT wg? ---" iptables -L OUTPUT -n 2>/dev/null | head -20 iptables -L INPUT -n 2>/dev/null | head -20 # check if UDP 51820 from phys can reach and get reply - just show conntrack? echo "--- home NAT public ---" curl -sS -m 5 --noproxy "*" https://api.ipify.org; echo ' """, ) p.close() print("===== public neko higher ids =====", flush=True) with httpx.Client(follow_redirects=False, timeout=12) as cl: for base in ("https://dy.nomadro.com", "https://dylive.nomadro.com"): for path in ("/neko/1/", "/neko/8/", "/neko/9/", "/ops-neko/1/", "/_/", "/shellcrash-ui"): url = base + path try: r = cl.get(url) print(f"{r.status_code} {url} loc={r.headers.get('location','')[:80]}", flush=True) except Exception as ex: print(f"ERR {url} {ex}", flush=True) print("DONE", flush=True)