Trying to create IP address lookup script, getting errors 07-02-2014, 12:05 AM
#1
Hey HC,
I'm trying to create a python script that will allow me to check if an IP address that I enter belongs to any of various subnets that I will define. I'm trying to use to do this, but any time I try, I get an error:
If is a module, why am I getting an error saying it's not defined? It doesn't matter if I'm doing ipaddress.ip_address or any other variations, I still get the same "name not defined" error.
Bonus Points: Anyone have any suggestions on how to create an IP lookup for subnets if they think this isn't the way to go about doing it?
I'm trying to create a python script that will allow me to check if an IP address that I enter belongs to any of various subnets that I will define. I'm trying to use
Code:
ipaddressCode:
ipaddress.ip_network('192.168.1.0/24')
Traceback (most recent call last):
File "/var/folders/3d/67fb39kx2mb21yd8tqkzgrg40000gn/T/PythonRunner/dummy.py", line 1, in <module>
ipaddress.ip_network('192.168.1.0/24')
NameError: name 'ipaddress' is not definedIf
Code:
ipaddressBonus Points: Anyone have any suggestions on how to create an IP lookup for subnets if they think this isn't the way to go about doing it?

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)
![[Image: wvBFmA5.png]](http://i.imgur.com/wvBFmA5.png)