69 lines
1.7 KiB
Python
69 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Probe 108.174.50.68 for old douyinWEB / dy.nomadro.live install."""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
HOST = "108.174.50.68"
|
|
USER = "root"
|
|
PASS = "Xiao4669805"
|
|
|
|
|
|
def ssh():
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(
|
|
HOST,
|
|
22,
|
|
USER,
|
|
PASS,
|
|
timeout=45,
|
|
allow_agent=False,
|
|
look_for_keys=False,
|
|
banner_timeout=120,
|
|
)
|
|
return c
|
|
|
|
|
|
def run(c, cmd, t=60):
|
|
print(f"\n$ {cmd[:200]}", flush=True)
|
|
_i, o, e = c.exec_command(cmd, timeout=t)
|
|
code = o.channel.recv_exit_status()
|
|
out = (o.read() + e.read()).decode("utf-8", "replace")
|
|
print(out[-12000:] if len(out) > 12000 else out, flush=True)
|
|
return code, out
|
|
|
|
|
|
c = ssh()
|
|
run(
|
|
c,
|
|
r"""
|
|
set +e
|
|
echo ===HOST===
|
|
uname -a
|
|
free -h
|
|
df -h /
|
|
echo ===OLD_PATHS===
|
|
ls -la /opt/douyinWEB 2>/dev/null | head -20
|
|
ls -la /var/www 2>/dev/null | head
|
|
ls -la /etc/douyinweb.env /etc/systemd/system/douyinweb* 2>/dev/null
|
|
echo ===UNITS===
|
|
systemctl list-units --all 'douyinweb*' --no-pager 2>/dev/null
|
|
systemctl list-unit-files 'douyinweb*' --no-pager 2>/dev/null
|
|
echo ===DOCKER===
|
|
docker ps -a --format '{{.Names}} {{.Status}}' 2>/dev/null | head -40
|
|
echo ===CADDY_NGINX===
|
|
ls /etc/caddy 2>/dev/null; ls /etc/nginx/sites-enabled 2>/dev/null
|
|
grep -RIn 'nomadro\|douyinWEB\|8014\|4015' /etc/caddy /etc/nginx 2>/dev/null | head -40
|
|
echo ===PORTS===
|
|
ss -lntp | grep -E ':80|:443|:8014|:4015|:8080|:3000|:5173' || true
|
|
echo ===DISK_APP===
|
|
du -sh /opt/douyinWEB /opt/* 2>/dev/null | head -30
|
|
""",
|
|
)
|
|
c.close()
|