22 lines
561 B
Python
22 lines
561 B
Python
import paramiko
|
|
|
|
ssh = paramiko.SSHClient()
|
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh.connect('140.44.4.71', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
|
|
|
def run(cmd):
|
|
print(f">>> {cmd}")
|
|
_, o, e = ssh.exec_command(cmd)
|
|
print(o.read().decode().strip())
|
|
err = e.read().decode().strip()
|
|
if err:
|
|
print("[stderr]", err)
|
|
|
|
run("cat /etc/resolv.conf")
|
|
run("getent hosts zabbix.snarfnet.net")
|
|
run("nc -zv 140.44.4.64 10051")
|
|
run("nc -zv zabbix.snarfnet.net 10051")
|
|
|
|
ssh.close()
|
|
|