douyinWEB/scripts/_diag_dual_port_conflict.py
2026-09-13 22:10:49 -05:00

54 lines
1.7 KiB
Python

#!/usr/bin/env python3
from __future__ import annotations
import sys
import time
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())
c.connect(host, port, user, pw, timeout=45, banner_timeout=120, allow_agent=False, look_for_keys=False)
return c
def run(c, cmd, t=60):
_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")
run(
v,
r"""
set +e
echo '--- VPS pb dir ---'
ls -la /opt/douyinWEB/pb/ | head -20
file /opt/douyinWEB/pb/pocketbase /opt/douyinWEB/pb/pocketbase.exe 2>/dev/null
echo '--- who owns 9200 ---'
ss -lntp | grep ':9200'
# compare response identity: dylive neko vs dy neko title/cookies
echo '--- neko identity fingerprints ---'
curl -sS -m 8 http://127.0.0.1:9200/ | head -c 200; echo
curl -sS -m 8 -H 'Host: dylive.nomadro.com' http://127.0.0.1:9200/ | head -c 200; echo
# caddy routes for dylive neko1
grep -A3 'handle_path /neko/1' /etc/caddy/sites/dylive.nomadro.com.caddy | head -10
grep -A3 'handle_path /neko/1' /etc/caddy/sites/dy.nomadro.com.caddy | head -10
echo '--- dylive ops-neko routes ---'
grep -nE 'ops-neko|1820' /etc/caddy/sites/dylive.nomadro.com.caddy | head -20
echo '--- DY_PB_URL ---'
grep PB /etc/douyinweb.env
# pid 635 pocketbase cwd
pwdx 635 2>/dev/null; ls -l /proc/635/exe 2>/dev/null; tr '\0' ' ' < /proc/635/cmdline; echo
echo '--- nft masquerade context ---'
nft list ruleset 2>/dev/null | grep -n -B2 -A2 '10.8.0.2' | head -40
""",
)
v.close()
print("DONE")