Updated Jul 14, 2026

Network

Turn CIDR ranges into host lists for scanners

Expand, aggregate, and slice CIDR ranges into host lists.

Agent

overview

What mapcidr does

mapcidr sits between discovered network ranges and host-level scanners. Feed a CIDR or a file of CIDRs; expand to every IP, or collapse scattered IPs with -aggregate into a minimal subnet set.

Use it when asnmap (or another range source) produced address space and the next node needs individual hosts, parallel chunks via -sbc/-sbh, or a cleaned list after -match-ip / -filter-ip.

It rewrites address lists only; it does not probe ports. Pass FILE and FOLDER output to naabu or a similar scanner for the next discovery stage.

source github.com/projectdiscovery/mapcidr

use cases

Where mapcidr fits

Expand CIDR ranges into a host list

Turn a file of subnets from asnmap into every individual IP so a port scanner like naabu can probe each host directly instead of a range.

Aggregate scattered IPs into minimal subnets

Collapse a long list of single IPs and overlapping ranges into the smallest set of CIDRs that covers them, shrinking the scope you hand downstream.

Slice a large range for parallel scanning

Split a wide CIDR into a fixed number of chunks or by host count, then fan the slices out across parallel scanner nodes to cover the space faster.

Filter and clean an address set before scanning

Keep only IPv4 or IPv6, drop base and broadcast addresses, and match or exclude against a file so the scan runs only on the IPs that matter.

reference

mapcidr inputs and flags

24 inputs
NameTypeFlagDescription
targetSTRING-cidrA single CIDR or IP to process, example: 173.0.84.0/24.
cidrFILE-cidrFile containing a list of CIDRs or IPs to process in bulk.
aggregateBOOLEAN-aggregateAggregate the input IPs and CIDRs into the minimum subnet set.
slice-by-host-countSTRING-sbhSlice the input CIDRs by a given host count per slice.
slice-by-countSTRING-sbcSlice the input CIDRs into a given number of CIDR chunks.
countBOOLEAN-countCount the number of IPs in the given CIDR.
match-ipFILE-match-ipFile of IPs or CIDRs to keep, dropping everything else.
filter-ipFILE-filter-ipFile of IPs or CIDRs to exclude from the output.

Showing key inputs. mapcidr exposes 24 inputs in total.

Full flag reference (24 inputs)
NameTypeFlagDescription
cidrFILE-cidrFile containing a list of CIDRs or IPs to process.
sortBOOLEAN-sortSort input IPs and CIDRs in ascending order.
countBOOLEAN-countCount the number of IPs in a given CIDR.
silentBOOLEAN-silentSilent mode; print only results.
targetSTRING-cidrA single CIDR or IP to process.
to-ipv4BOOLEAN-to-ipv4Convert IPs to IPv4 format.
to-ipv6BOOLEAN-to-ipv6Convert IPs to IPv6 format.
verboseBOOLEAN-verboseVerbose mode.
match-ipFILE-match-ipFile of IPs or CIDRs to match, keeping only those.
aggregateBOOLEAN-aggregateAggregate input IPs and CIDRs into the minimum subnet set.
filter-ipFILE-filter-ipFile of IPs or CIDRs to filter out of the output.
ip-formatSTRING-ip-formatIP output formats (0,1,2,3,4,5,6,7,8,9,10,11).
skip-baseBOOLEAN-skip-baseSkip base IPs (ending in .0) in the output.
shuffle-ipBOOLEAN-shuffle-ipShuffle input IPs into random order.
filter-ipv4BOOLEAN-filter-ipv4Filter IPv4 addresses from the input.
filter-ipv6BOOLEAN-filter-ipv6Filter IPv6 addresses from the input.
shuffle-portSTRING-shuffle-portShuffle input IP:Port pairs into random order.
sort-reverseBOOLEAN-sort-reverseSort input IPs and CIDRs in descending order.
skip-broadcastBOOLEAN-skip-broadcastSkip broadcast IPs (ending in .255) in the output.
slice-by-countSTRING-sbcSlice CIDRs into a given number of CIDR chunks.
zero-pad-numberSTRING-zero-pad-nNumber of padded zeros to use (default 3).
aggregate-approxBOOLEAN-aggregate-approxAggregate sparse IPs and CIDRs into a minimum approximated subnet.
zero-pad-permuteBOOLEAN-zero-pad-permuteEnable permutations from 0 to zero-pad-n for each octet.
slice-by-host-countSTRING-sbhSlice CIDRs by a given host count per slice.

example

Run mapcidr

mapcidr · command
# expand a CIDR into hosts, dropping .0 and .255mapcidr -cidr 198.51.100.0/24 -skip-base -skip-broadcast -o hosts.txt
sample output
198.51.100.1198.51.100.2198.51.100.3198.51.100.4198.51.100.5198.51.100.6198.51.100.7198.51.100.8…  (254 hosts for the /24 after skipping .0 and .255)

guidance

Choosing mapcidr

Use mapcidr to expand CIDRs into host lists, aggregate scattered IPs, or slice ranges for parallel scans. It manipulates address space only. Feed it from asnmap; pass output to a port scanner such as naabu.

asnmap

Maps an organization to CIDR ranges. Run before mapcidr to produce the ranges you expand.

get-asn-prefixes

Pulls prefixes for an ASN. A focused range source when you already have the AS number.

prips

Prints every IP in a CIDR. Minimal expansion only; mapcidr adds aggregation, slicing, and filtering.

faq

mapcidr questions

Expand to host IPs, aggregate into minimal subnets, count with -count, slice with -sbc or -sbh, sort, shuffle, and filter by IPv4 or IPv6. Each step reads a list and writes a list.

Run mapcidr yourself

An organization name feeds asnmap, which maps its CIDR ranges and passes them to mapcidr, expanding them into a host-list output ready for scanning.

Facts on this page come from the live Trickest tool library.