mcpField
M
mapcidr-cidr

mapcidr-cidr

github.com/wgpsecCloud & DevOps1.8k44 installsUpdated 4d ago
Repository

About mapcidr-cidr

mapcidr is a CIDR processing tool from ProjectDiscovery for command-line workflows involving IP ranges. It supports expansion, aggregation, slicing, and shuffling across IPv4 and IPv6.

Key features

  1. 01Expand CIDRs into IP lists
  2. 02Aggregate IP lists into CIDRs
  3. 03Slice by host count or CIDR size
  4. 04Count IP addresses
  5. 05Filter IP ranges

Use cases

  1. 01Expand a CIDR range for port scanning
  2. 02Aggregate IPs from scan results
  3. 03Slice a large range to distribute scans
  4. 04Filter a specified IP range

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/wgpsec/aboutsecurity --skill mapcidr-cidr

After installing, type/mapcidr-cidrin Claude Code to confirm it loaded.

Details

From the project README

mapcidr CIDR 网段处理方法论

mapcidr 是 ProjectDiscovery 出品的 CIDR 处理工具。核心优势:展开/聚合/切片/打乱 + IPv4/IPv6 双栈 + 管道友好。

项目地址:https://github.com/projectdiscovery/mapcidr

基本操作

# CIDR 展开为 IP 列表
echo 192.168.1.0/24 | mapcidr

# 统计 IP 数量
echo 10.0.0.0/16 | mapcidr -count

# IP 列表聚合为 CIDR
cat ips.txt | mapcidr -aggregate

# 打乱 IP 顺序(避免顺序扫描触发告警)
echo 192.168.1.0/24 | mapcidr -si

# 跳过基址和广播地址
echo 192.168.1.0/24 | mapcidr -skip-base -skip-broadcast

网段切片

# 按主机数切片(每片 256 个 IP)
echo 10.0.0.0/16 | mapcidr -sbh 256

# 按 CIDR 大小切片(切成 /24)
echo 10.0.0.0/16 | mapcidr -sbc 24

# 切片后分发扫描
echo 10.0.0.0/16 | mapcidr -sbc 24 | \
  while read cidr; do naabu -host "$cidr" -p 80,443 -silent; done

管道集成

# CIDR 展开 → 端口扫描
echo 10.0.0.0/24 | mapcidr -si | naabu -p 80,443 -silent

# IP 去重聚合
cat scan_results.txt | mapcidr -aggregate

# 过滤 IP 范围
echo 10.0.0.0/8 | mapcidr -fi 10.0.1.0/24

Comments

Markdown supported