Agent: Remove duplicate IPs in compile_scan_target_list()
This commit is contained in:
parent
a0d679285c
commit
8d383d2832
|
@ -1,4 +1,4 @@
|
|||
from typing import List
|
||||
from typing import List, Set
|
||||
|
||||
from common.network.network_range import NetworkRange
|
||||
|
||||
|
@ -10,16 +10,18 @@ def compile_scan_target_list(
|
|||
blocklisted_ips: List[str],
|
||||
enable_local_network_scan: bool,
|
||||
) -> List[str]:
|
||||
scan_target_list = _get_ips_from_ranges_to_scan(ranges_to_scan)
|
||||
scan_targets = _get_ips_from_ranges_to_scan(ranges_to_scan)
|
||||
|
||||
scan_target_list = list(scan_targets)
|
||||
scan_target_list.sort()
|
||||
return scan_target_list
|
||||
|
||||
|
||||
def _get_ips_from_ranges_to_scan(ranges_to_scan):
|
||||
scan_target_list = []
|
||||
def _get_ips_from_ranges_to_scan(ranges_to_scan: List[str]) -> Set[str]:
|
||||
scan_targets = set()
|
||||
|
||||
network_ranges = [NetworkRange.get_range_obj(_range) for _range in ranges_to_scan]
|
||||
for _range in network_ranges:
|
||||
scan_target_list.extend([ip for ip in _range])
|
||||
scan_targets.update(set(_range))
|
||||
|
||||
return scan_target_list
|
||||
return scan_targets
|
||||
|
|
Loading…
Reference in New Issue