#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Read-only inventory of nomadro.com related units/sites on VPS.""" from __future__ import annotations import sys import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") REMOTE = r"""#!/bin/bash echo '=== systemd units matching nomadro ===' systemctl list-units --all --type=service --no-pager 2>/dev/null | grep -iE 'nomadro|dylive|douyin' || true systemctl list-unit-files --no-pager 2>/dev/null | grep -iE 'nomadro|dylive' || true echo '=== docker containers nomadro ===' docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' 2>/dev/null | grep -iE 'nomadro|NAME' || true echo '=== caddy sites ===' ls -la /etc/caddy/sites 2>/dev/null | head -40 ls -la /etc/caddy 2>/dev/null | head -20 grep -RIl 'nomadro.com' /etc/caddy 2>/dev/null | head -20 echo '=== processes / dirs ===' ls -d /opt/*nomadro* /opt/*Nomadro* /home/*/nomadro* 2>/dev/null || true ss -lntp 2>/dev/null | grep -E ':(80|443|3[0-9]{3}|4[0-9]{3}|8[0-9]{3})\s' | head -40 echo '=== curl public ===' curl -sS -m 8 -o /dev/null -w 'nomadro.com=%{http_code}\n' https://nomadro.com/ || true curl -sS -m 8 -o /dev/null -w 'www.nomadro.com=%{http_code}\n' https://www.nomadro.com/ || true curl -sS -m 8 -o /dev/null -w 'dylive=%{http_code}\n' https://dylive.nomadro.com/api/health || true """ def main() -> int: c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=40, allow_agent=False, look_for_keys=False) sftp = c.open_sftp() with sftp.file("/tmp/_inv_nomadro.sh", "w") as f: f.write(REMOTE) sftp.close() _, o, e = c.exec_command("bash /tmp/_inv_nomadro.sh", timeout=90) print((o.read() + e.read()).decode("utf-8", "replace")) c.close() return 0 if __name__ == "__main__": raise SystemExit(main())