Name Last modified Size Description
Parent Directory - COPYING 2015-06-09 09:13 15K ChangeLog 2015-10-25 11:08 1.9K Makefile 2015-10-25 11:09 621 grepcidr-2.95.tgz 2013-12-20 11:21 16K grepcidr-2.96.tgz 2013-12-30 12:32 17K grepcidr-2.97.tgz 2014-01-16 00:12 17K grepcidr-2.98.tjz 2014-01-18 15:45 17K grepcidr-2.99.tjz 2015-06-09 11:25 17K grepcidr-2.991.tjz 2015-10-25 11:13 18K grepcidr.1 2015-10-25 10:55 5.2K grepcidr.c 2015-10-25 11:11 37K sha256-checksums.txt 2016-01-06 13:59 565
More recent versions are on github at https://github.com/jrlevine/grepcidr3.
Parts copyright (C) 2004-2005 Jem E. Berkes
Other parts by John Levine <email@example.com>
This is a largely rewritten version of grepcidr to handle both IPv4 and IPv6 addresses, and to make it considerably faster. It is mostly backward compatible with earlier versions of grepcidr, except by default it matches addresses anywhere on the line. (Use -a for anchor to match only at the beginning.)
The syntax of IPv6 addresses can be hard to pick out in lines that contain other colon separated data. The state machine attempts to make reasonable guesses, and will handle simple cases like address:1234:56::78 but more complex colon patterns may confuse it. It does handle IPv4 addresses embedded in IPv6 addresses like ::ffff:126.96.36.199 or ab:cd::188.8.131.52 which will match either the IPv6 or IPv4 address.
The -q (quick) flag tells it to skip IP addresses followed by a dot, which can help avoid false matches of IP-like strings in rDNS names.
A new (2.99) feature matches CIDR ranges in the input. It can either match any range that overlaps a pattern range, or only ranges completely covered by pattern ranges.
I have compiled and run this on MacOS 10.10.5, FreeBSD 10.x and the current version of Ubuntu. It doesn't do anything exotic and in particular, does not use any system libraries to parse IP addresses, so it'll probably work on any reasonably current Posix-ish system. If you find bugs, feel free to fix them and send me the patches.
- John Levine, Oct 2015