=pod =head1 NAME B - Print the IP addresses in a binary IPset file =head1 SYNOPSIS rwsetcat [--count-ips] [--print-statistics] [--print-ips] [{--integer-ips | --zero-pad-ips}] [--cidr-blocks] [--network-structure[={T | A | B | C | X | H}...[S]]] [--ip-ranges] [--no-columns] [--column-separator=C] [{--delimited | --delimited=C}] [--pager=PAGER_PROG] [SET_FILE...] =head1 DESCRIPTION When run with no switches, B reads each IPset file given on the command line and prints its constituent IP addresses to the standard output, with one IP address per line. If no file names are listed on the command line, B will attempt to read an IPset from the standard input. B can produce additional information about IPset files, such as the number of IPs they contain, the number of IPs at the /8, /16, /24, and /27 levels, and the minimum and maximum IPs. =head1 OPTIONS Option names may be abbreviated if the abbreviation is unique or is an exact match for an option. A parameter to an option may be specified as B<--arg>=I or B<--arg> I, though the first form is required for options that take optional parameters. =over 4 =item B<--count-ips> Prints a count of IP addresses in the IPset file. When this switch is the only one specified, the IPs in the IPset file will not be printed. =item B<--print-statistics> Prints statistics about the IPset. The statistics include the minimum IP address, the maximum IP address, and, for each CIDR block of /8, /16, /24, /27, and /32, the number of blocks occupied and what percentage of coverage that represents. When this switch is the only one specified, the IPs in the IPset file will not be printed. =item B<--print-ips> Forces printing of the IP addresses, even when the B<--count-ips> or B<--print-statistics> option is provided. =item B<--integer-ips> Causes IP addresses to be printed as integers. =item B<--zero-pad-ips> Causes IP addresses to be printed as dotted decimal, but each octet is padded with zeros so that each is three characters wide. =item B<--cidr-blocks> Prints the IPs in the binary IPset file, but it causes the sequential IPs to be grouped into the largest possible CIDR block. This switch cannot be combined with the B<--network-structure> switch. =item B<--network-structure>[={C | C | C | C | C | C}...[C]] Prints the network structure around the IP addresses in the binary IPset file. =over 4 =item C total network header and host count =item C class A (/8) network header and host count =item C class B (/16) network header and host count =item C class C (/24) network header and host count =item C (/27) network header and host count =item C individual IP addresses =item C count of /8,/16,/24,/27s in each smaller subnet =back If no argument is specified, the default is C. Any combination of C,C,C,C,C,C may be specified; the C argument by itself is illegal. This option will disable printing of the IPs in the IPset file; specify the C argument to the switch to print the IP addresses. =item B<--ip-ranges> Causes the output to contain three columns: the first is the number of IPs in the contiguous range, the second is the start of the range, and the final is the end of the range. This is the most compact way to print the output. =item B<--no-columns> Disables fixed-width columnar output when printing the output from the B<--network-structure> or B<--ip-ranges> swtich. =item B<--column-separator>=I Uses the specified character between the columns produced by the B<--network-structure> and B<--ip-ranges> swtiches. When this switch is not specified, the default of 'B<|>' is used. =item B<--delimited> =item B<--delimited>=I Runs as if B<--no-columns> B<--column-sep>=I had been specified. That is, disables fixed-width column output; if character I is provided, it is used as the delimiter between columns instead of the default 'B<|>'. =item B<--pager>=I When output is to a terminal, invoke the program I to view the output one screen full at a time. This switch overrides the SILK_PAGER environment variable, which in turn overrides the PAGER variable. If the value of the pager is determined to be the empty string, no paging will be performed and all output will be printed to the terminal. =back =head1 EXAMPLES Print the contents of a IPset. $ rwsetcat sample.set 10.1.2.250 10.1.2.251 10.1.2.252 10.1.2.253 10.1.2.254 10.1.2.255 10.1.3.0 10.1.3.1 10.1.3.2 10.1.3.3 10.1.3.4 To get the contents in CIDR notation: $ rwsetcat --cidr-blocks sample.set 10.1.2.250/31 10.1.2.252/30 10.1.3.0/30 10.1.3.4 To see contiguous IPs printed as ranges: $ rwsetcat --ip-ranges sample.set 11| 10.1.2.250| 10.1.3.4| To see contiguous IPs printed as ranges of integers: $ rwsetcat --ip-ranges --integer-ips sample.set 11| 167838458| 167838468| To count the IPs in the IPset: $ rwsetcat --count-ips sample.set 11 To see the contents of the IPset and get a count of IPs, use multiple options: $ rwsetcat --count-ips --cidr-blocks sample.set 11 10.1.2.250/31 10.1.2.252/30 10.1.3.0/30 10.1.3.4 For text-based sorting, use the --zero-pad-ips switch to force three digits per octet: $ rwsetcat --zero-pad-ips --cidr-blocks sample.set 010.001.002.250/31 010.001.002.252/30 010.001.003.000/30 010.001.003.004 For numerical sorting, print as an integer: $ rwsetcat --integer-ips sample.set 167838458 167838459 167838460 167838461 167838462 167838463 167838464 167838465 167838466 167838467 167838468 Use the --print-statistics and --network-structure switches for more detailed information: $ rwsetcat --print-statistics sample.set Network Summary minimumIP = 10.1.2.250 maximumIP = 10.1.3.4 11 hosts (/32s), 0.000000% of 2^32 1 occupied /8, 0.390625% of 2^8 1 occupied /16, 0.001526% of 2^16 2 occupied /24s, 0.000012% of 2^24 2 occupied /27s, 0.000001% of 2^27 $ rwsetcat --network-structure=TABCXS sample.set 10.1.2.224/27 | 6 hosts 10.1.2.0/24 | 6 hosts in 1 /27 10.1.3.0/27 | 5 hosts 10.1.3.0/24 | 5 hosts in 1 /27 10.1.0.0/16 | 11 hosts in 2 /24s and 2 /27s 10.0.0.0/8 | 11 hosts in 1 /16, 2 /24s, and 2 /27s TOTAL | 11 hosts in 1 /8, 1 /16, 2 /24s, and 2 /27s To see the IPs generated by B without creating an intermediate IPset file, have B send its output to the standard output, and have B read from stdin: $ rwfilter ... --pass=stdout | rwset --sip=stdout | rwsetcat 192.168.1.1 192.168.1.2 =head1 SEE ALSO B, B =cut $SiLK: rwsetcat.pod 8269 2007-08-03 18:54:48Z mthomas $ Local Variables: mode:text indent-tabs-mode:nil End: