Skip to content

Random list of IP addresses to ordered list of CIDRs

Notifications You must be signed in to change notification settings

dmgeurts/iplist2cidr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

iplist2cidr

Random list of IP addresses to ordered list of CIDRs

** Bring together existing tools to be more useful **

Occasionally I find myself cleaning up firewall, router/switch and proxy configurations. Often there's a list of host addresses in some random order, with duplicates and other atrocities. Too big for anyone to dare to touch. For ease of use, readability and efficiency it's best to convert these things to a shorter list of CIDR notations. I've found some useful tools but nothing where I can just dump a list of unordered IP addresses and see what the resulting list of CIDRs would be.

PHP seems an obvious candidate due to the available code and ease of web integration as well as terminal usage.

Tools:

The result should be a sorted list of CIDRs.

** Limitations of existing tools **

  • ip2cidr requires IP ranges, it only takes two arguments and not a list like: 1.1.1.1 / 1.1.1.2 / 1.1.1.3 etc., you get the point.
  • A few existing online tools allow multiple IP ranges to be pasted (http://ip2cidr.com/bulk-ip-to-cidr-converter.php), one per line. But this does not help me as I'd still have to feed it a sanitised list, by which time I'm quicker converting it manually.

About

Random list of IP addresses to ordered list of CIDRs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published