Forum Moderators: phranque

Message Too Old, No Replies

Need script to convert individual IP list to CIDR ranges

IP list is 7000 entries. Need to reduce to CIDR ranges. HELP!

         

Wizcrafts

3:08 pm on Jul 27, 2004 (gmt 0)

10+ Year Member



I am compiling a list of Nigerian dotted quad IP addresses, which I obtained from blackholes.us. I intend to add them to a .htaccess file to block anybody from any IP registered to that country. Little did I know that the blackholes list shows every IP address in numeric sequence, starting with the lowest first quad and increasing in number as you descend down the list. Sometimes there are full w.x.y.z/24 ranges, going from w.x.y.0 through w.x.y.255, but I am finding many more ranges that are split up; not continuing numerically unbroken in the last quad; ex: ww.****.yyy.0-63, then skipping 64-127 and restarting at ww.xxx.yyy.128-255. I am jumping back and forth to the CIDR range list on dnsstuff.com, and it is very tiring manually counting and converting individual entries into combined ranges. As I type this I have 6600 lines remaining to condense!

If anybody knows of a script, whether javascript (preferred, for offline use), cgi, or php, that will see the common quad patterns and reduce them into CIDR ranges, please let me know. I'd like to have my reduced list usable by the next millennium!

Wiz