commit 63af3f2333ddca4fffb61fac07975b7f4355a3bb Author: elias Date: Wed Sep 17 11:02:18 2025 +0200 Upload files to "/" diff --git a/ipbin.py b/ipbin.py new file mode 100644 index 0000000..561c5e4 --- /dev/null +++ b/ipbin.py @@ -0,0 +1,11 @@ +import ipaddress + +ip = ipaddress.IPv4Address('172.16.0.0') +bits = '{:#b}'.format(ip).strip('0b') + +result = '' +for i in range(0, 32, 4): + result += bits[i:i+4] + result += ' ' if (i + 4) % 8 == 0 else ' ' + +print(result.strip()) \ No newline at end of file diff --git a/subnet.py b/subnet.py new file mode 100644 index 0000000..dd79105 --- /dev/null +++ b/subnet.py @@ -0,0 +1,9 @@ +import ipaddress + +net = ipaddress.ip_network("201.90.0.0/16") +subnets = net.subnets(new_prefix=22) + +for subnet in subnets: + start = subnet.network_address + end = subnet.broadcast_address + print(f"{start} - {end}") \ No newline at end of file