Example:
from netaddr
import IPNetwork
net = IPNetwork('8.0.0.0/8')
subnets = net.subnet(10)
for subnet in subnets:
print subnet
Output:
8.0 .0 .0 / 10 8.64 .0 .0 / 10 8.128 .0 .0 / 10 8.192 .0 .0 / 10
In Python 3.3+, using suggested by @Thomas Orozco ipaddress
module:
#!/usr/bin/env python3
import ipaddress
import fileinput
for line in fileinput.input():
for subnet in ipaddress.ip_network(line.strip()).subnets(new_prefix = 10):
print(subnet)
Example:
$. / convert - cidr input.txt
Output
8.0 .0 .0 / 10 8.64 .0 .0 / 10 8.128 .0 .0 / 10 8.192 .0 .0 / 10 9.0 .0 .0 / 10 9.64 .0 .0 / 10
CIDR is the short for Classless Inter-Domain Routing, an IP addressing scheme that replaces the older system based on classes A, B, and C. A single IP address can be used to designate many unique IP addresses with CIDR. A CIDR IP address looks like a normal IP address except that it ends with a slash followed by a number, called the IP network prefix. CIDR addresses reduce the size of routing tables and make more IP addresses available within organizations. , IPv6 Tools IPv6 Ping IPv6 Traceroute IPv6 Decimal IPv6 CIDR IPv4 to IPv6 Conversion IPv6 Compression & Expansion IPv6 Compatibility Test , IPv4 Tools IPv4 Ping IPv4 Traceroute IPv4 Decimal IPv4 CIDR IPv4 Netmask ,You can easily add the CIDR widget on your website by copying the following HTML code and place it on your web page
<div style="text-align:center">
<form action="https://www.ipaddressguide.com/cidr" method="post">
<p style="background:#fff;border:1px solid #99A8AE;width:180px;padding:5px 5px 5px 5px;font-size:11px;font-family:'Trebuchet MS',Arial,Sans-serif;">
<a href="https://www.ipaddressguide.com" target="_blank"><img src="https://www.ipaddressguide.com/images/ipaddressguide.png" alt="CIDR to IPv4 Address Range Utility Tool | IPAddressGuide" border="0" width="120" height="12" /></a><br />
<b>CIDR to IPv4 Conversion</b><br /><br />
<label>CIDR</label><br />
<input type="text" name="cidr" value="" style="border:solid 1px #C0C0C0;font-size:9px;width:110px;" /><br />
<input type="submit" value="Calculate" style="width:100px;font-size:10px;margin-top:3px;padding:2px 3px;color:#FFF;background:#8EB50C;border-width:1px;border-style:solid;">
</p>
</form>
</div>
Mihai, May 07, 2019 - 2:00 pm UTC ,Last updated: May 13, 2019 - 4:28 am UTC
IP address range: 10.188 .57 .192 - 10.188 .57 .255
CIDR expansion support (default),In order to represent given IP into multiple formats, -if 0 flag can be used to display all the supported format values, and specific type of format can be displayed using specific index number as listed here, currently 10 unique formats are supported.,In order to count number of hosts for a given CIDR or list of CIDR, use the following command.,In order to slice given CIDR or list of CIDR by CIDR count or slice into multiple and equal smaller subnets, use the following command.
v1 .0 .1 Release
go install - v github.com / projectdiscovery / mapcidr / cmd / mapcidr @latest
mapcidr - h
INPUT:
-cl, -cidr string[] CIDR / IP / File containing list of CIDR / IP to process
PROCESS:
-sbc int Slice CIDRs by given CIDR count -
sbh int Slice CIDRs by given HOST count -
a, -aggregate Aggregate IPs / CIDRs into minimum subnet -
aa, -aggregate - approx Aggregate sparse IPs / CIDRs into minimum approximated subnet -
c, -count Count number of IPs in given CIDR -
t4, -to - ipv4 Convert IPs to IPv4 format -
t6, -to - ipv6 Convert IPs to IPv6 format -
ip - format, -
if string[] IP formats(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) -
zpn, -zero - pad - n int number of padded zero to use(
default 3) -
zpp, -zero - pad - permute enable permutations from 0 to zero - pad - n
for each octets
FILTER:
-f4, -filter - ipv4 Filter IPv4 IPs from input -
f6, -filter - ipv6 Filter IPv6 IPs from input -
skip - base Skip base IPs(ending in .0) in output -
skip - broadcast Skip broadcast IPs(ending in .255) in output -
mi, -match - ip string[] IP / CIDR / FILE containing list of IP / CIDR to match(comma - separated, file input) -
fi, -filter - ip string[] IP / CIDR / FILE containing list of IP / CIDR to filter(comma - separated, file input)
MISCELLANEOUS:
-s, -sort Sort input IPs / CIDRs in ascending order -
sr, -sort - reverse Sort input IPs / CIDRs in descending order -
si, -shuffle - ip Shuffle Input IPs in random order -
sp, -shuffle - port string Shuffle Input IP: Port in random order
OUTPUT:
-verbose Verbose mode -
o, -output string File to write output to -
silent Silent mode -
version Show version of the project
mapcidr - cidr 173.0 .84 .0 / 24
____________ ___
__ _ ___ ____ / ___ / _ / _\ / _\ /
' \/ _ ' / _\ / /___/ // // / , _/
/
_ / _ / _ / \_, _ / .__ / \___ / ___ / ____ / _ / | _ | v0 .5 /
_ /
projectdiscovery.io
[WRN] Use with caution.You are responsible
for your actions
[WRN] Developers assume no liability and are not responsible
for any misuse or damage.
173.0 .84 .0
173.0 .84 .1
173.0 .84 .2
173.0 .84 .3
173.0 .84 .4
173.0 .84 .5
173.0 .84 .13
173.0 .84 .14
173.0 .84 .15
173.0 .84 .16
Date published - December 16, 2015
>>> 12 & 9 8
>>> 13 & 7 5
01100011 | 00110111 | 10001100 | 01010010
01100011001101111000110001010010
99.55 .140 .82
255 & 142 == 142