Production hardening: REAPER all-in-one launcher, rdpthread UX, logic fixes
- Add REAPER.bat single entry (pip, dirs, smoke test, launch); MASTER/MASTERSTER shim to it - bruteforce: rdpthread helpers, safe writer close, spray_all_hosts incremental writes, progress - gui: credential banner, spray messaging without spam; cmdkey TERMSRV host - scanner: adaptive progress; proxy: retry cap on open_connection - ip_utils: /32 CIDR, count_ips aligned with large dash ranges - README/install/run: deployment docs and REAPER.bat references Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
19
ip_utils.py
19
ip_utils.py
@@ -19,12 +19,15 @@ def parse_line(line: str) -> Generator[str, None, None]:
|
||||
if not line or line.startswith('#') or line.startswith('//'):
|
||||
return
|
||||
|
||||
# CIDR: 192.168.1.0/24
|
||||
# CIDR: 192.168.1.0/24 (/32 must use the network address — .hosts() is empty)
|
||||
if '/' in line:
|
||||
try:
|
||||
network = ipaddress.IPv4Network(line, strict=False)
|
||||
for host in network.hosts():
|
||||
yield str(host)
|
||||
if network.prefixlen == 32:
|
||||
yield str(network.network_address)
|
||||
else:
|
||||
for host in network.hosts():
|
||||
yield str(host)
|
||||
except ValueError:
|
||||
pass
|
||||
return
|
||||
@@ -69,7 +72,10 @@ def count_ips(filepath: str) -> int:
|
||||
if '/' in line:
|
||||
try:
|
||||
n = ipaddress.IPv4Network(line, strict=False)
|
||||
total += max(0, n.num_addresses - 2)
|
||||
if n.prefixlen >= 31:
|
||||
total += n.num_addresses
|
||||
else:
|
||||
total += max(0, n.num_addresses - 2)
|
||||
except ValueError:
|
||||
total += 1
|
||||
elif IP_RANGE_RE.match(line):
|
||||
@@ -81,7 +87,10 @@ def count_ips(filepath: str) -> int:
|
||||
e = int(ipaddress.IPv4Address(m.group(2)))
|
||||
if s > e:
|
||||
s, e = e, s
|
||||
total += min(e - s + 1, 65536)
|
||||
# Same /16 cap as parse_line() so Total matches work done
|
||||
if e - s > 65536:
|
||||
e = s + 65536
|
||||
total += e - s + 1
|
||||
elif SINGLE_IP_RE.match(line):
|
||||
total += 1
|
||||
return total
|
||||
|
||||
Reference in New Issue
Block a user