feat: add various infrastructure check and automation scripts
This commit is contained in:
22
scripts/check_nut_wifi.py
Normal file
22
scripts/check_nut_wifi.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import paramiko
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect('14.4.4.44', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
def run(cmd):
|
||||
stdin, stdout, stderr = c.exec_command(cmd)
|
||||
return stdout.read().decode().strip(), stderr.read().decode().strip()
|
||||
|
||||
print("--- iwconfig / nmcli on nutserver ---")
|
||||
out, _ = run("iwconfig 2>&1 || nmcli 2>&1")
|
||||
print(out)
|
||||
|
||||
print("--- SSID / Network connection ---")
|
||||
out, _ = run("echo 'Katzir476!' | sudo -S grep -h ssid /etc/wpa_supplicant/wpa_supplicant.conf /etc/NetworkManager/system-connections/* 2>/dev/null")
|
||||
print(out)
|
||||
|
||||
c.close()
|
||||
|
||||
Reference in New Issue
Block a user