sync: auto-sync from GURU-5070 at 2026-06-12 05:57:38
Author: Mike Swanson Machine: GURU-5070 Timestamp: 2026-06-12 05:57:38
This commit is contained in:
15
tmp/jssh.py
Normal file
15
tmp/jssh.py
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Run a command on Jupiter (172.16.3.20) via password SSH. Usage: jssh.py '<cmd>'"""
|
||||
import sys, paramiko
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect("172.16.3.20", port=22, username="root", password="Th1nk3r^99##",
|
||||
look_for_keys=False, allow_agent=False, timeout=20)
|
||||
cmd = sys.argv[1]
|
||||
stdin, stdout, stderr = c.exec_command(cmd, timeout=int(sys.argv[2]) if len(sys.argv) > 2 else 60)
|
||||
out = stdout.read().decode(errors="replace")
|
||||
err = stderr.read().decode(errors="replace")
|
||||
sys.stdout.write(out)
|
||||
if err.strip():
|
||||
sys.stderr.write("\n--STDERR--\n" + err)
|
||||
c.close()
|
||||
Reference in New Issue
Block a user