Remove `None` values from list of networks to scan

Fixes #540
This commit is contained in:
Shreya 2020-02-20 12:24:58 +05:30
parent 48875b003a
commit 20fff43fa9
2 changed files with 2 additions and 1 deletions

View File

@ -44,9 +44,9 @@ class NetworkRange(object, metaclass=ABCMeta):
@staticmethod
def get_range_obj(address_str):
address_str = address_str.strip()
if not address_str: # Empty string
return None
address_str = address_str.strip()
if NetworkRange.check_if_range(address_str):
return IpRange(ip_range=address_str)
if -1 != address_str.find('/'):

View File

@ -34,6 +34,7 @@ class NetworkScanner(object):
LOG.info("Found local IP addresses of the machine: %r", self._ip_addresses)
# for fixed range, only scan once.
self._ranges = [NetworkRange.get_range_obj(address_str=x) for x in WormConfiguration.subnet_scan_list]
self._ranges = list(filter(None, self._ranges))
if WormConfiguration.local_network_scan:
self._ranges += get_interfaces_ranges()
self._ranges += self._get_inaccessible_subnets_ips()