gogslog.py 449 B

12345678910
  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. for cmd in [
  5. "find / -maxdepth 6 -name 'gogs.log' 2>/dev/null | head -3",
  6. "ls -la /var/log/gogs* /opt/gogs*/log* 2>/dev/null | head -10",
  7. ]:
  8. _,o,e = c.exec_command(cmd, timeout=50)
  9. print("$", cmd); print(o.read().decode()[:600]); print("---")
  10. c.close()