IPv4 range conversion script

Document created by Q Nimbus on Dec 16, 2010
Version 1Show Document
  • View in full screen mode

Attached is the Python 3.1 script, licensed under GPL3.

 

Qualys is picky with how it accepts input for IP addresses.  For the most part, I give Qualys IP addresses in two formats.

 

Format 1:

octet1.octet2.octet3

Octet 4 is assumed "0-255".  This is equivalent to the following in QualysGuard:

octet1.octet2.octet3.0 - octet1.octet2.octet3.255

 

For example, "10.182.7" in QualysGuard's language should be "10.182.7.0 - 10.182.7.255"

 

Format 2:

octet1.octet2.octet3_start-octet3_end

Octet 4 is assumed "0-255".  This is equivalent to the following in QualysGuard:

octet1.octet2.octet3_start.0 - octet1.octet2.octet3_end.255

 

For example, "10.182.71-75" in QualysGuard's language should be "10.182.71.0 - 10.182.75.255"

 

 

I wrote up a script in Python that will convert the above formats to QualysGuard's language.  You can find it attached along with an example input file in csv format.  Note, it can only handle the above formats as of now from a csv named "temp IP addresses to scan.txt".  Feel free to comment on ways to improve it, or send improvements via comments!

Outcomes