-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathping.py
55 lines (43 loc) · 1.22 KB
/
ping.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import sys
from cli_args_system import Args
import Backend_Code.h as h
import Backend_Code.checkip as checkip
import Backend_Code.running as running
import pyfiglet
import os
os.popen(f"clear").read()
# art
T = "Ping Range"
ASCII_art_1 = pyfiglet.figlet_format(T)
print(ASCII_art_1)
def main():
if len(sys.argv) < 2:
print("must have a arg")
sys.exit()
elif "-h" in sys.argv or "--help" in sys.argv:
h.help()
sys.exit()
args = Args(convert_numbers=False)
Start_Ip = args.flag_str('si','start_ip','start')
End_Ip = args.flag_str('ei','end_ip', 'end')
if Start_Ip == None or End_Ip == None:
print("Must have both start and end ip addresses")
sys.exit()
print(f'start: {Start_Ip}')
print(f'end: {End_Ip}')
print("starting.....")
print("")
if checkip.check(Start_Ip) and checkip.check(End_Ip):
running.run(Start_Ip, End_Ip)
else:
sys.exit()
print("Finished")
print("Results are in ping_output.txt")
print("")
sys.exit()
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("Keyboard Interupt")
sys.exit()