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

49 lines
1.9 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Find nomadro.com Next.js vs WordPress on VPS (read-only)."""
from __future__ import annotations
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
REMOTE = r"""#!/bin/bash
echo '=== systemd nomadro / next / node ==='
systemctl list-unit-files --no-pager 2>/dev/null | grep -iE 'nomadro|next|wordpress|wp-|httpd|nginx' || true
systemctl list-units --all --type=service --no-pager 2>/dev/null | grep -iE 'nomadro|next|wordpress|wp-|caddy|nginx' || true
echo '=== /opt /var/www candidates ==='
ls -la /opt 2>/dev/null | head -60
ls -la /var/www 2>/dev/null | head -40
ls -d /opt/* /var/www/* /home/*/www* /home/*/nomadro* 2>/dev/null | head -80
echo '=== package.json with nomadro or next ==='
find /opt /var/www /home -maxdepth 4 -name package.json 2>/dev/null | head -40
echo '=== caddy nomadro.com ==='
grep -RIn --include='*.caddy' --include='Caddyfile*' 'nomadro.com' /etc/caddy 2>/dev/null | grep -v 'dy\.nomadro\|dylive\|book\|s3\|wx\|ro' | head -40
ls /etc/caddy/sites 2>/dev/null
echo '=== docker ==='
docker ps -a --format '{{.Names}} {{.Status}} {{.Image}}' 2>/dev/null | grep -iE 'nomadro|wordpress|wp|next' || true
echo '=== pm2 / screen ==='
command -v pm2 >/dev/null && pm2 list || echo no-pm2
"""
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/_find_nomadro_next.sh", "w") as f:
f.write(REMOTE)
sftp.close()
_, o, e = c.exec_command("bash /tmp/_find_nomadro_next.sh", timeout=90)
out = (o.read() + e.read()).decode("utf-8", "replace")
print(out[-14000:] if len(out) > 14000 else out)
c.close()
return 0
if __name__ == "__main__":
raise SystemExit(main())