Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3201,9 +3201,26 @@ def load_addresses(path: str) -> List[str]:
return [str(d) for d in data[key] if d]
except (json.JSONDecodeError, TypeError):
pass
return [ln.strip() for ln in raw.splitlines() if ln.strip()]


lines = [ln.strip() for ln in raw.splitlines() if ln.strip()]
expanded: List[str] = []
for line in lines:
# Skip comment lines
if line.startswith("#"):
continue
# Try to parse as CIDR network
try:
net = ipaddress.IPv4Network(line, strict=False)
# If it's a host address (no mask or /32), just add as-is
if net.prefixlen == 32:
expanded.append(str(net.network_address))
else:
expanded.extend(str(ip) for ip in net.hosts())
continue
except (ValueError, TypeError):
pass
# Not a CIDR — keep original (domain, plain IP, etc.)
expanded.append(line)
return expanded
def _split_to_24s(subnets: List[str]) -> list:
"""Split CIDR subnets into /24 blocks, deduplicate."""
seen = set()
Expand Down