131543d148
- deploy_webrunner.py: full rewrite following attack_box pattern exactly — auto-generate engagement name when blank, select_provider+gather_provider_config per provider (handles region selection), separate teardown_after_scan (default=yes) from enhanced_opsec, use_tor prompt, bundled YAML defaults, setup_logging+confirm_action+show_naming_relationship - utils/cidr_resolver.py: self-contained RIR delegation file downloader/parser — downloads APNIC/ARIN/RIPE/LACNIC/AFRINIC, caches 24h in ~/.cache/c2itall/cidr/, no geo-scout dep - utils/chunk_utils.py: remove geo-scout _try_load_geo_scout() dependency, use cidr_resolver - modules/webrunner/inputs/countries.yaml: bundled default country list (no external dep) - modules/webrunner/inputs/targets.yaml: bundled default scan targets and ports - deploy.py: move WEBRUNNER from main menu (item 14) to tools submenu (item 10) - configure_node.yml: install tor+proxychains4, start tor service, configure proxychains, wait for circuit establishment when use_tor=true - run_scan.yml: prefix command with proxychains4 when use_tor=true - providers/webrunner.yml: add Play 4 teardown — Linode DELETE + AWS terminate-instances using hostvars instance IDs stored during provisioning, conditional on teardown_after_scan
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
import ipaddress
|
|
from utils.cidr_resolver import get_country_cidrs
|
|
|
|
|
|
def ip_count(cidr: str) -> int:
|
|
try:
|
|
return ipaddress.ip_network(cidr, strict=False).num_addresses
|
|
except ValueError:
|
|
return 0
|
|
|
|
|
|
def chunk_cidrs(all_cidrs: list[str], chunk_size: int) -> list[dict]:
|
|
chunks = []
|
|
current_cidrs: list[str] = []
|
|
current_count = 0
|
|
|
|
for cidr in all_cidrs:
|
|
n = ip_count(cidr)
|
|
if n == 0:
|
|
continue
|
|
if current_count > 0 and current_count + n > chunk_size * 1.5:
|
|
chunks.append({'cidrs': current_cidrs, 'ip_count': current_count})
|
|
current_cidrs = []
|
|
current_count = 0
|
|
current_cidrs.append(cidr)
|
|
current_count += n
|
|
if current_count >= chunk_size:
|
|
chunks.append({'cidrs': current_cidrs, 'ip_count': current_count})
|
|
current_cidrs = []
|
|
current_count = 0
|
|
|
|
if current_cidrs:
|
|
chunks.append({'cidrs': current_cidrs, 'ip_count': current_count})
|
|
|
|
return chunks
|
|
|
|
|
|
__all__ = ['get_country_cidrs', 'chunk_cidrs', 'ip_count']
|