gogs3.py 554 B

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