Skip to content

Commit 6a1ab69

Browse files
authored
Merge pull request #20 from bylickilabs/bylickilabs-patch-4
Update diagnose_tool.py
2 parents 9cb3cd4 + 827c9fb commit 6a1ab69

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

diagnose_tool.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ def check_open_ports():
6363
except Exception as e:
6464
log_and_print(f"Portprüfung Fehler: {e}", Fore.RED)
6565

66+
def check_dns_resolution():
67+
try:
68+
subprocess.check_output(['nslookup', 'google.com'], stderr=subprocess.STDOUT)
69+
log_and_print("DNS-Auflösung OK (Domain google.com erreichbar)", Fore.GREEN)
70+
except subprocess.CalledProcessError:
71+
log_and_print("WARNUNG: DNS-Auflösung fehlgeschlagen", Fore.RED)
72+
6673
# Menü anzeigen
6774
def show_menu():
6875
menu_items = [
@@ -73,6 +80,7 @@ def show_menu():
7380
"5. Netzwerkprüfung",
7481
"6. Systemupdateprüfung",
7582
"7. Offene Ports anzeigen",
83+
"8. DNS-Auflösung prüfen", # Neue Funktion hinzugefügt
7684
"0. Beenden"
7785
]
7886
print(Style.BRIGHT + "\nSystem Diagnose Menü:")
@@ -81,15 +89,15 @@ def show_menu():
8189

8290
# Hauptfunktion modular gestaltet
8391
def main():
84-
checks = [check_disk, check_memory, check_cpu, check_network, check_system_updates, check_open_ports]
92+
checks = [check_disk, check_memory, check_cpu, check_network, check_system_updates, check_open_ports, check_dns_resolution]
8593

8694
while True:
8795
show_menu()
8896
choice = input("Wähle eine Option: ")
8997
if choice == '1':
9098
for check in checks:
9199
check()
92-
elif choice in map(str, range(2, 8)):
100+
elif choice in map(str, range(2, 9)):
93101
checks[int(choice) - 2]()
94102
elif choice == '0':
95103
log_and_print("Programm beendet.")

0 commit comments

Comments
 (0)