grepcidr 2.99

I've updated grepcidr again, adding some code contributed by a user.
(This open source thing may actually have a future.)

grepcidr is what it sounds like, you give it a bunch of CIDR ranges,
and files to read, and it prints out the lines in the files that
contain addresses that match any of the CIDR ranges. The new feature
lets it match CIDR ranges in the input files as well as IP addresses.
It handles both IPv4 and IPv6. It maps each file into memory and runs
a state machine over the file in one pass so it's quite fast. There
should be no limits on line length, file size, or number of patterns
other than running out of memory.

Find it here:

http://www.taugh.com/grepcidr-2/

Regards,
John Levine, johnl@iecc.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. http://jl.ly

Hi John,

Great contribution. Thanks

Might I make a suggestion? with the following command it gives Invalid CIDR. In my usage it would seem logically convenient to throw any quad octet at it and have it translate to the proper CIDR range that isn’t reported as invalid since it does this anyway. For instance 127.0.0.1/8 would just become 127.0.0.0/8. Then add a (-d) flag for debugging or verbose messages. My first impression of the output was that it was only going to grep for valid CIDR ranges which was not true.

$ cidr 127.0.0.1/8
Invalid cidr: 127.0.0.1/8

$ grepcidr -q 192.0.0.1/24
Invalid cidr: 192.0.0.1/24

All-in-all great tool and putting it to use right away!

Thank you John

In article <6DFDC9F9-EE28-4263-8E5B-EB751B35B2B4@dataix.net> you write:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi John,

Great contribution. Thanks

Might I make a suggestion? with the following command it gives Invalid CIDR. In
my usage it would seem logically convenient to throw any quad octet at it and
have it translate to the proper CIDR range that isn’t reported as invalid since
it does this anyway. For instance 127.0.0.1/8 would just become 127.0.0.0/8.

Already does that with the -s for sloppy flag.