48 lines
1.1 KiB
Python
Executable file
48 lines
1.1 KiB
Python
Executable file
#!/bin/python3
|
|
#
|
|
## Wizard Kit: HW Diagnostics - Network
|
|
|
|
import os
|
|
import sys
|
|
|
|
# Init
|
|
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
|
from functions.network import *
|
|
|
|
|
|
def check_connection():
|
|
if not is_connected():
|
|
# Raise to cause NS in try_and_print()
|
|
raise Exception
|
|
|
|
|
|
if __name__ == '__main__':
|
|
try:
|
|
# Prep
|
|
clear_screen()
|
|
print_standard('Hardware Diagnostics: Network\n')
|
|
|
|
# Connect
|
|
print_standard('Initializing...')
|
|
connect_to_network()
|
|
|
|
# Tests
|
|
try_and_print(
|
|
message='Network connection:', function=check_connection, cs='OK')
|
|
show_valid_addresses()
|
|
try_and_print(message='Internet connection:', function=ping,
|
|
addr='8.8.8.8', cs='OK')
|
|
try_and_print(message='DNS Resolution:', function=ping, cs='OK')
|
|
try_and_print(message='Speedtest:', function=speedtest,
|
|
print_return=True)
|
|
|
|
# Done
|
|
print_standard('\nDone.')
|
|
#pause("Press Enter to exit...")
|
|
exit_script()
|
|
except SystemExit as sys_exit:
|
|
exit_script(sys_exit.code)
|
|
except:
|
|
major_exception()
|
|
|
|
# vim: sts=2 sw=2 ts=2
|