34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
import paramiko
|
|
|
|
client = paramiko.SSHClient()
|
|
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
client.connect('152.136.232.83', port=22, username='root', password='Jianhua105', timeout=10)
|
|
|
|
def run(cmd):
|
|
print(f"\n>>> {cmd[:120]}")
|
|
stdin, stdout, stderr = client.exec_command(cmd, timeout=15)
|
|
out = stdout.read().decode('utf-8', errors='replace').strip()
|
|
err = stderr.read().decode('utf-8', errors='replace').strip()
|
|
if out: print(out[-600:])
|
|
if err: print(f"ERR: {err[-200:]}")
|
|
return out
|
|
|
|
# Check what user-server (3002) is
|
|
run("pm2 show 2 | head -15")
|
|
|
|
# Check if user-server has config/public
|
|
run("grep -n 'config/public' /www/wwwroot/zhinengtiapp/user-server/*.js 2>/dev/null || echo 'no match'")
|
|
run("find /www/wwwroot -name '*.js' -path '*/user-server/*' 2>/dev/null | head -5")
|
|
|
|
# Check user-server path
|
|
run("pm2 show 2 | grep 'script path'")
|
|
|
|
# Check if 3001 is accessible externally
|
|
run("curl -s http://152.136.232.83:3001/api/system/config/public 2>&1 | head -5")
|
|
run("curl -s http://152.136.232.83:3002/api/system/config/public 2>&1 | head -5")
|
|
|
|
# Check nginx/firewall for port 3001
|
|
run("ss -tlnp | grep -E '3001|3002'")
|
|
|
|
client.close()
|