mapcidr CIDR Range Processing Methodology
- 攻击大类:C42 网络扫描与枚举
mapcidr is a CIDR processing tool from ProjectDiscovery. Core advantages: expansion / aggregation / slicing / shuffling + dual-stack IPv4/IPv6 + pipeline friendly.
Project URL: https://github.com/projectdiscovery/mapcidr
Basic Operations
# expand a CIDR into an IP list
echo 192.168.1.0/24 | mapcidr
# count the number of IPs
echo 10.0.0.0/16 | mapcidr -count
# aggregate an IP list into CIDRs
cat ips.txt | mapcidr -aggregate
# shuffle IP order (avoid triggering alerts during sequential scanning)
echo 192.168.1.0/24 | mapcidr -si
# skip the network address and broadcast address
echo 192.168.1.0/24 | mapcidr -skip-base -skip-broadcast
Network Segment Slicing
# slice by host count (256 IPs per slice)
echo 10.0.0.0/16 | mapcidr -sbh 256
# slice by CIDR size (split into /24)
echo 10.0.0.0/16 | mapcidr -sbc 24
# distribute scanning across slices
echo 10.0.0.0/16 | mapcidr -sbc 24 | \
while read cidr; do naabu -host "$cidr" -p 80,443 -silent; done
Pipeline Integration
# CIDR expansion → port scanning
echo 10.0.0.0/24 | mapcidr -si | naabu -p 80,443 -silent
# deduplicate and aggregate IPs
cat scan_results.txt | mapcidr -aggregate
# filter IP ranges
echo 10.0.0.0/8 | mapcidr -fi 10.0.1.0/24