-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNetwork_App.py
36 lines (28 loc) · 937 Bytes
/
Network_App.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
#Importing necessary modules
import sys
import time
from ip_file_valid import ip_file_valid
from ip_addr_valid import ip_addr_valid
from ip_reach import ip_reach
from ssh_connection import ssh_connection
from create_threads import create_threads
#Saving the list of IP addresses in ip.txt to a variable
ip_list = ip_file_valid()
#Verifying the validity of each IP address in the list
try:
print(ip_list)
ip_addr_valid(ip_list)
except KeyboardInterrupt:
print("\n\n* Program aborted by user. Exiting...\n")
sys.exit()
#Verifying the reachability of each IP address in the list
try:
ip_reach(ip_list)
except KeyboardInterrupt:
print("\n\n* Program aborted by user. Exiting...\n")
sys.exit()
#Calling threads creation function for one or multiple SSH connections
while True:
create_threads(ip_list, ssh_connection)
time.sleep(1)
#End of program