-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHL_Engine_Network_Processing.py
More file actions
29 lines (26 loc) · 1003 Bytes
/
HL_Engine_Network_Processing.py
File metadata and controls
29 lines (26 loc) · 1003 Bytes
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
"""HL_Engine_Network_Processing.py"""
import nmap
from HL_Engine_2.HL_CommonDependency import *
class NetworkProcessEngine:
"""Network Process Engine"""
def scan_wifi(self, base_ip):
"""Scan wifi network"""
try:
print()
display_message(WLAN_NETWORK_SCANNER)
nm = nmap.PortScanner()
count = 1
while count < 10:
ip = base_ip + str(count)
print(ip + " Scanning ...")
count = count + 1
nm.scan(hosts=ip, arguments="-n -sP -PE -PA21,23,80,3389")
hosts_list = [(x, nm[x]["status"]["state"]) for x in nm.all_hosts()]
for host, status in hosts_list:
print(host, status)
if status == "up":
report = open(ACTIVE_DEVICES_LOG, "a")
report.writelines(host + "\n")
report.close()
except:
return(False)