first commit

This commit is contained in:
Vincent Hanewinkel
2025-05-21 16:47:43 +02:00
commit 0a84c90257
3 changed files with 97 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
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)