Eli Fulkerson .com HomeProjectsXips
 

xips

"xips" (for eXpand IPS) is a console program that parses stdin for ip addresses and "summarized" ip addresses and outputs them individually, suitable for use with xargs. For instance:

echo 172.20.141.0/24 | xips | xargs -n 1 tcping -n 1

Alternatively, with the "-s" or "--summarize" flag, xips will take the same input and attempt to summarize those ip addressess into IP ranges, suitable for use in (for instance) Cisco ASA configuration files. By default it will make (ipv4) subnets no smaller than /24, but that is adjustable via -m.

I am using the same ip address range syntax as in ips. (which is an IP address range aware grep-like tool)

Usage:


Syntax: your_command | xips [-4] [-6] [-v]

Eats STDIN, expands IP addresses.
Options:
 -4     : expand IPv4 addresses only
 -6     : expand IPv6 addresses only
 -s     : summarize, rather than expand
 -m X   : summarize to a max depth of /X (also --max-depth X)
 -c     : output /cidr notation rather than subnet mask
 -v     : Display version information
 --max-depth-ipv4 X : summarize to a max cidr of X for IPv4 only
 --max-depth-ipv6 X : summarize to a max cidr of X for IPv6 only

IP/Range Syntax:
 192.168.1.1
 192.168.1.1-192.168.1.255
 192.168.1.1/24
 192.168.1.1/C
 '192.168.1.1 255.255.255.0'
 192.168.1.5-15

Action shots:


$echo 192.168.100.5-10 | xips
192.168.100.5
192.168.100.6
192.168.100.7
192.168.100.8
192.168.100.9
192.168.100.10

$cat example.txt
192.168.0.1
192.168.0.2
192.168.0.3
10.0.10.0
10.0.10.1
10.0.10.2
10.0.10.3
10.0.10.4
10.0.10.5
10.0.10.200
172.20.5.6
172.20.5.6

$cat example.txt | xips -s
10.0.10.0 255.255.255.0
172.20.5.0 255.255.255.0
192.168.0.0 255.255.255.0

$cat example.txt | xips -s -m 30
10.0.10.0 255.255.255.248
10.0.10.200 255.255.255.252
172.20.5.4 255.255.255.252
192.168.0.0 255.255.255.252

$echo "192.168.20.1-5" | xips | xargs -n 1 tcping -n 1

Probing 192.168.20.1:80/tcp - Port is open - time=0.782ms

Ping statistics for 192.168.20.1:80
     1 probes sent.
     1 successful, 0 failed.
Approximate trip times in milli-seconds:
     Minimum = 0.782ms, Maximum = 0.782ms, Average = 0.782ms

Probing 192.168.20.2:80/tcp - Port is open - time=0.813ms

Ping statistics for 192.168.20.2:80
     1 probes sent.
     1 successful, 0 failed.
Approximate trip times in milli-seconds:
     Minimum = 0.813ms, Maximum = 0.813ms, Average = 0.813ms

Probing 192.168.20.3:80/tcp - No response - time=2001.949ms

Ping statistics for 192.168.20.3:80
     1 probes sent.
     0 successful, 1 failed.
Was unable to connect, cannot provide trip statistics.

Probing 192.168.20.4:80/tcp - No response - time=2001.538ms

Ping statistics for 192.168.20.4:80
     1 probes sent.
     0 successful, 1 failed.
Was unable to connect, cannot provide trip statistics.

Probing 192.168.20.5:80/tcp - Port is open - time=1.107ms

Ping statistics for 192.168.20.5:80
     1 probes sent.
     1 successful, 0 failed.
Approximate trip times in milli-seconds:
     Minimum = 1.107ms, Maximum = 1.107ms, Average = 1.107ms


Downloads:


Listing directory https://download.elifulkerson.com/files/xips/0.2:
Makefile January 06 2018 22:05:39 71 makefile script, ASCII text cygwin-dlls-for-xips.zip January 06 2018 22:05:47 1586300 Zip archive data, at least v2.0 to extract cygwin-dlls-for-xips.zip.asc January 06 2018 22:10:49 801 GnuPG signature cygwin-dlls-for-xips.zip.md5 January 06 2018 22:10:49 59 MD5 checksum cygwin-dlls-for-xips.zip.sha1 January 06 2018 22:10:49 67 SHA1 checksum cygwin-dlls-for-xips.zip.sha256 January 06 2018 22:10:49 91 SHA256 checksum cygwin-dlls-for-xips.zip.sha512 January 06 2018 22:10:49 155 SHA512 checksum xips.cpp January 06 2018 22:05:39 37453 C++ source, ASCII text, with CRLF line terminators xips.cpp.asc January 06 2018 22:10:56 801 GnuPG signature xips.cpp.md5 January 06 2018 22:10:56 43 MD5 checksum xips.cpp.sha1 January 06 2018 22:10:56 51 SHA1 checksum xips.cpp.sha256 January 06 2018 22:10:56 75 SHA256 checksum xips.cpp.sha512 January 06 2018 22:10:56 139 SHA512 checksum xips.exe January 06 2018 22:05:39 215780 PE32+ executable (console) x86-64, for MS Windows xips.exe.asc January 06 2018 22:11:01 801 GnuPG signature xips.exe.md5 January 06 2018 22:11:01 43 MD5 checksum xips.exe.sha1 January 06 2018 22:11:01 51 SHA1 checksum xips.exe.sha256 January 06 2018 22:11:01 75 SHA256 checksum xips.exe.sha512 January 06 2018 22:11:01 139 SHA512 checksumBrowse the download server

To compile: g++ -std=c++11 -o xips xips.cpp

Updates:

Update: Jan 5 2018, v0.1. Initial release.

Uppdate: Jan 6 2018, v0.2. Fix so it compiles properly with -std=c++11. Added .exe version for windows folks (you will need the cygwin dlls).

License:

GPLv3

See Also:

ips - an ip address aware "grep" analog which xips' parsing logic is based on