Created
March 16, 2023 01:08
-
-
Save res0nat0r/81ca619a216d5e313af32ea774e3e6c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from ipaddress import ip_network, ip_address | |
import sys | |
cidrs = [] | |
with open(sys.argv[1], "r") as f: | |
for line in f: | |
cidrs.append(line.strip()) | |
for cidr in cidrs: | |
net = ip_network(cidr) | |
print(f"ip address {sys.argv[2]} in {net}: ", end="") | |
print(ip_address(sys.argv[2]) in net) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment