From 63af3f2333ddca4fffb61fac07975b7f4355a3bb Mon Sep 17 00:00:00 2001 From: elias Date: Wed, 17 Sep 2025 11:02:18 +0200 Subject: [PATCH] Upload files to "/" --- ipbin.py | 11 +++++++++++ subnet.py | 9 +++++++++ 2 files changed, 20 insertions(+) create mode 100644 ipbin.py create mode 100644 subnet.py 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