I am a newbie to Python and looking for assistance how possible this is. I am looking for a way to do a lookup of IP Address that is in one file and do a lookup of where that IP Subnet is based on another file:
Device IP Address File:
Device | IP Address
-------- | ------------
Server 1 | 1.1.1.1
Server 2 | 2.2.2.2
Server 3 | 3.3.3.3
Computer 1 | 4.4.4.4
Computer 2 | 5.5.5.5
Computer 3 | 6.6.6.6
Computer 4 | 7.7.7.7
Subnet File:
network | cidr | type | Location
---------- | ---- | ----- | -----------
1.1.1.0 | /23 | network | Data Center - Zone 1
2.2.2.0 | /23 | network | Data Center - Zone 2
3.3.3.0 | /21 | network | Data Center - Zone 3
4.4.4.0 | /21 | network | Office Location 1
5.5.5.0 | /23 | network | Office Location 2
6.6.6.0 | /28 | network | Office Location 3
7.7.7.0 | /31 | network | Office Location 4
8.8.8.0 | /31 | network | Office Location 5
What I am trying to do is get create a python script that will read Device IP Address from one file and do a lookup of location based on subnet of that IP Address that is listed in subnet file and output results to a new file:
Output File:
Device | IP Address | Location
-------- | ------------ | -----------
Server 1 | 1.1.1.1 | Data Center - Zone 1
Server 2 | 2.2.2.2 | Data Center - Zone 2
Server 3 | 3.3.3.3 | Data Center - Zone 3
Computer 1 | 4.4.4.4 | Office Location 1
Computer 2 | 5.5.5.5 | Office Location 2
Computer 3 | 6.6.6.6 | Office Location 3
Computer 4 | 7.7.7.7 | Office Location 4
Currently these files are in XLSX format but can easily convert to another format if easier.