Files
SnarfCode/scripts/check_opt_pihole.py

22 lines
921 B
Python

import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('140.44.4.11', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
stdin, stdout, stderr = ssh.exec_command('k3s kubectl exec -n dns deployment/pihole -- grep -rn "setFTLConfigValue" /opt/pihole/')
print("grep setFTLConfigValue in /opt/pihole/:")
print(stdout.read().decode('utf-8', errors='ignore'))
stdin, stdout, stderr = ssh.exec_command('k3s kubectl exec -n dns deployment/pihole -- sed -n "1,50p" /opt/pihole/COL_TABLE')
print("head /opt/pihole/COL_TABLE or similar scripts:")
print(stdout.read().decode('utf-8', errors='ignore'))
# Check files in /opt/pihole/
stdin, stdout, stderr = ssh.exec_command('k3s kubectl exec -n dns deployment/pihole -- ls -la /opt/pihole/')
print("ls /opt/pihole/:")
print(stdout.read().decode('utf-8', errors='ignore'))
ssh.close()