def scan_network(self):
logger.info('scanning Network')
network = self._config_reader.get_config_section("Networking")['network']
netmask = self._config_reader.get_config_section("Networking")['netmask']
my_net = ipaddress.ip_network(network+'/'+netmask)
host_list = dict()
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.settimeout(2.0)
for ip in my_net:
try:
# print(ip)
host = self._generate_host(ip)
if host is not None:
host_list[ip] = host
except socket.herror as ex:
pass
return host_list
评论列表
文章目录