In my Python application, I have an array of IP address strings that looks something like this:
[
"50.28.85.81-140", // Matches any IP address that matches the first 3 octets, and has its final octet somewhere between 81 and 140
"26.83.152.12-194" // Same idea: 26.83.152.12 would match, 26.83.152.120 would match, 26.83.152.195 would not match
]
I installed netaddr, and while the documentation seems to be great, I can't wrap it around. It should be very simple: how to check if a given IP address matches one of these ranges? No need to use netaddrin particular - any simple Python solution.
source
share