pw.py 592 B

123456789
  1. import paramiko, base64
  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. sql = "SELECT id, name, passwd, salt, passwd_hash_algo FROM \"user\" WHERE lower_name='fmode';"
  5. b = base64.b64encode(sql.encode()).decode()
  6. cmd = f'echo {b} | base64 -d > /tmp/q.sql && PGPASSWORD=666 psql -h 127.0.0.1 -p 5433 -U dev -d gogs -At -f /tmp/q.sql; rm -f /tmp/q.sql'
  7. _,o,e = c.exec_command(cmd, timeout=45)
  8. print(o.read().decode()[:500]); print("ERR", e.read().decode()[:200])
  9. c.close()