| 12345678910111213 |
- import paramiko
- c=paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- c.connect(hostname="139.159.253.131", username="root", password="bofang666.", timeout=25)
- cmds = [
- "hostname; cat /etc/os-release | head -2",
- "docker ps --format '{{.Names}}' | grep -i -E 'gogs|git' ",
- "ss -ltnp 2>/dev/null | grep -E ':3000|:80 ' | head -5",
- "find / -maxdepth 5 -name 'app.ini' 2>/dev/null | head -5",
- ]
- for cmd in cmds:
- _,o,e = c.exec_command(cmd, timeout=40)
- print(f"$ {cmd}\n{o.read().decode().strip()[:700]}\n---")
- c.close()
|