-
Notifications
You must be signed in to change notification settings - Fork 1
/
version3.py
40 lines (30 loc) · 1.2 KB
/
version3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
import argparse, pyfiglet
from speedtest import Speedtest
netsp=Speedtest()
os.system('cls')
baner=pyfiglet.figlet_format("speedify")
print(baner,end=' ')
print('\t\t\t\t\t by naqviO7')
def SpeedTest(args):
print('[+] Choosing Best Server.')
bestserver=netsp.get_best_server()
print(f"[+] Best Server is: {bestserver['host']} in {bestserver['country']}")
print('[+] Preforming Download Speed Test.')
download_result=netsp.download()
print('[+] Preforming Upload Speed Test.')
upload_result=netsp.upload()
ping_result=netsp.results.ping
if args.speedtest=='speedtest' or args.sp=='speedtest':
print('\n---------------------- Scan Results ----------------------')
print(f"[!] Download Speed: {download_result/1024/1024:.2f} Mbits/s")
print(f"[!] Upload Speed: {upload_result/1024/1024:.2f} Mbits/s")
print(f"[!] Ping: {ping_result:.2f} ms")
print('----------------------------------------------------------\n')
else:
print('Arguement not Given Correctly!\n')
if __name__=='__main__':
parser=argparse.ArgumentParser(description='Speed Test Utility Written in Python!')
parser.add_argument('-sp','--speedtest',type=str,help='Start Speed Test!')
args=parser.parse_args()
SpeedTest(args)