For example, I have a file ( city and ip addresses ):
....
City1 31.25.87.0 - 31.25.87.15
.... ....
City2 31.47.224.0 - 31.47.255.255
....
How to know by ip adress city name ?
asked Nov 30, 2011 at 13:25
Bdfy
24.9k58 gold badges136 silver badges180 bronze badges
1 Answer 1
http://www.icir.org/robin/pysubnettree/
you may need to convert ip ranges in cidr, so this library can help you
http://code.google.com/p/python-iptools/
Please consider that converting ip ranges to cidrs you may have multiple cidr blocks so you have to repeat the city in the tree
answered Nov 30, 2011 at 13:35
sherpya
4,9542 gold badges36 silver badges53 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
linbo
Looks no method works to convert ip range to cidrs in python-iptools module. Find another module for converting github.com/jathanism/cidrize
lang-py