Monday, March 19, 2018

Convert IP Notation - (X.X.X.X-X.X.Y.Z -> Individual IPs)

I was provided a list of IPs and ranges, most of them were in the format of 1.1.1.1-1.1.1.4. Nmap doesnt like this format, nmap likes the format of 1.1.1.1-4. This is easy if everything is a /24. Most of my ranges were not. I used the iptools python module written for Django to parse the IPs. All I had to do was supply a file formatted properly (no spaced in between the dash) and boom, each possible IP was spit out:

1 comment:

  1. Man, I totally didn't realize that iptools would do that out of the box.

    I wrote my own script for this using netaddr back in February - https://www.doyler.net/security-not-included/ipexpander-netaddr

    ReplyDelete