IPCC is a program for generating aggregated CIDR blocks by country based on official data from Regional Internet Registries (RIRs).
It supports IPv4 and IPv6 and can automatically merge adjacent networks.
-
Generates CIDR blocks by country (ISO 3166-1 alpha-2)
-
Supports IPv4 and IPv6
-
Automatically collapses adjacent networks (
collapse) -
Uses RIR data:
- RIPE NCC
- ARIN
- APNIC
- LACNIC
- AFRINIC
.
├── app
│ ├── __init__.py
│ ├── args.py # CLI arguments
│ └── ipcc.py # programm
├── tests
│ ├── test_ipcc.py
│ └── test_args.py
├── pyproject.toml
└── README.md
Generate USA IPv4:
./ipcc --country US --output ~/us.zoneThe program will download RIR data, select networks of the specified country, merge adjacent CIDRs, and save the result to a file.
To run tests, use pytest:
pytestВсе тесты проходят, что гарантирует корректность парсинга и объединения сетей.
| Option | Description | Default |
|---|---|---|
--country |
ISO country code | RU |
--ipv6 |
Use IPv6 | false |
--output |
Output file name | <country>.zone |
Plain text CIDR list:
5.8.0.0/13
5.16.0.0/12
31.128.0.0/10
MIT License