import paramiko import requests import time ssh_host = "139.18.143.253" ssh_username = "" ssh_password = "" def sshVerbindung(): client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) try: client.connect(ssh_host, username=ssh_username, password=ssh_password) channel = client.invoke_shell() while True: time.sleep(60) if not checkGoogle(): break except Exception as e: print(f"Fehler: {e}") finally: client.close() def checkGoogle(): try: response = requests.get("https://www.google.com", timeout=5) if response.status_code == 200: return True else: return False except requests.ConnectionError: return False except requests.Timeout: return False except Exception as e: return False while True: sshVerbindung() time.sleep(10)