~ubuntu-branches/ubuntu/trusty/grepcidr/trusty-proposed

« back to all changes in this revision

Viewing changes to README

  • Committer: Bazaar Package Importer
  • Author(s): Ryan Finnie
  • Date: 2006-10-05 01:58:17 UTC
  • Revision ID: james.westby@ubuntu.com-20061005015817-yge9lcfrk55azh4d
Tags: upstream-1.3
ImportĀ upstreamĀ versionĀ 1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
grepcidr 1.3 - Filter IP addresses matching IPv4 CIDR specification
 
2
Copyright (C) 2004-2005  Jem E. Berkes <jberkes@pc-tools.net>
 
3
        http://www.pc-tools.net/unix/grepcidr/
 
4
        http://www.sysdesign.ca/
 
5
 
 
6
 
 
7
PURPOSE
 
8
-------
 
9
grepcidr can be used to filter a list of IP addresses against one or more
 
10
Classless Inter-Domain Routing (CIDR) specifications, or arbitrary networks
 
11
specified by an address range. As with grep, there are options to invert
 
12
matching and load patterns from a file. grepcidr is capable of comparing
 
13
thousands or even millions of IPs to networks with little memory usage and
 
14
in reasonable computation time.
 
15
 
 
16
grepcidr has endless uses in network software, including: mail filtering and
 
17
processing, network security, log analysis, and many custom applications.
 
18
 
 
19
Many thanks to Dick Wesseling <ftu@fi.uu.nl> who suggested an improved data
 
20
structure format as well as binary search, to improve grepcidr performance.
 
21
 
 
22
 
 
23
COMPILING & INSTALLING
 
24
----------------------
 
25
Edit Makefile to customize the build. Then,
 
26
make
 
27
make install
 
28
 
 
29
 
 
30
COMMAND USAGE
 
31
-------------
 
32
Usage:
 
33
        grepcidr [-V] [-c] [-v] PATTERN [FILE]
 
34
        grepcidr [-V] [-c] [-v] [-e PATTERN | -f FILE] [FILE]
 
35
 
 
36
-V      Show software version
 
37
-c      Display count of the matching lines, instead of showing the lines
 
38
-v      Invert the sense of matching, to select non-matching IP addresses
 
39
-e      Specify pattern(s) on command-line
 
40
-f      Obtain CIDR and range pattern(s) from file
 
41
 
 
42
PATTERN specified on the command line may contain multiple patterns
 
43
separated by whitespace or commas. For long lists of network patterns,
 
44
specify a -f FILE to load where each line contains one pattern. Comment
 
45
lines starting with # are ignored, as are any lines that don't parse.
 
46
 
 
47
Each pattern, whether on the command line or inside a file, may be:
 
48
CIDR format     a.b.c.d/xx
 
49
IP range        a.b.c.d-e.f.g.h
 
50
Single IP       a.b.c.d
 
51
 
 
52
 
 
53
EXAMPLES
 
54
--------
 
55
 
 
56
grepcidr -f ournetworks blocklist > abuse.log
 
57
        Find our customers that show up in blocklists
 
58
 
 
59
grepcidr 127.0.0.0/8 iplog
 
60
        Searches for any localnet IP addresses inside the iplog file
 
61
 
 
62
grepcidr "192.168.0.1-192.168.10.13" iplog
 
63
        Searches for IPs matching indicated range in the iplog file
 
64
 
 
65
script | grepcidr -vf whitelist > blacklist
 
66
        Create a blacklist, with whitelisted networks removed (inverse)
 
67
 
 
68
grepcidr -f list1 list2
 
69
        Cross-reference two lists, outputs IPs common to both lists