Xip is a command line tool designed to extract IP addresses and address ranges from text files. This can be very useful for all manner of network related operations including analyzing log files and extracting IP addresses from emails.
The program will identify IP addresses on their own (e.g. 10.2.3.4), IP address ranges separated with a dash character (e.g. 10.2.3.4-10.2.3.50 or 10.2.3.4-50) and CIDR format ranges (e.g. 10.2.3.0/24). The output is de-duped and sorted with addresses consolidated into ranges by default.
The program will identify IP addresses on their own (e.g. 10.2.3.4), IP address ranges separated with a dash character (e.g. 10.2.3.4-10.2.3.50 or 10.2.3.4-50) and CIDR format ranges (e.g. 10.2.3.0/24). The output is de-duped and sorted with addresses consolidated into ranges by default.
How to use it
Operation of the program is quite straightforward and the syntax is shown below. This syntax will be shown when you simply type Xip or Xip -?. Explanations of the various options are shown here.
-?
- Shows the program syntax
- Do not treat IP addresses like 10.2.3.0/24 as CIDR format. In this example the program would only identify the address 10.2.3.0
- Outputs the results as a list of individual IP addresses rather than consolidating IP ranges.
- Outputs all IP addresses/ranges on 1 line, separated by commas. The default behavior is to output each IP or range on a separate line.
- Tells the program to not merge adjoining IP address ranges when outputting the results. e.g. if the input consisted of the IP addresses 10.1.2.3-10.1.2.4, 10.1.2.5, 10.1.2.6, 10.1.2.7 the output would be 10.1.2.3-10.1.2.4 10.1.2.5, 10.1.2.6 10.1.2.7 instead of the normalized 10.1.2.3-10.1.2.7.
- Sends the output to the given file, overwriting any existing contents.
- Sends the output to the given file, appending to any existing contents.
- Do not treat IP addresses like 10.2.3.4-10.2.3.55 as an IP range. In this example the program would only identify the two IP addresses 10.2.3.4 and 10.2.3.55
The processing of CIDR format addresses is interpreted by taking the number of network bits (the number after the '/' character) and creating a range starting from the IP part of the address (the number before the '/' character) and ending at the maximum IP address defined by the network bitmask. For example, the CIDR range format 10.20.30.40/24 would result in an output IP address range of 10.20.30.40-10.20.30.255.
Command line syntax
Xip 1.00 - Robin Keir - 2005 - http://keir.net
Xip [-?cilmoOrv] [...]
-? - Shows this help text
-c - Don't parse CIDR ranges
-i - Output as individual IPs instead of ranges
-l - Output everything on one line
-m - Don't merge adjoining ranges
-o - Output file (overwrite)
-O - Output file (append)
-r - Don't parse ranges
-v - Verbose mode
Any number of filenames can be specified and wildcards can be used to specify multiple files. Input can be directed from stdin or from a pipe
with the usual '<' and '|' syntax.
Examples:
Xip -vi log.txt -o ips.txt
Xip -l *.log | myportscanner.exe
echo 10.1.2.3-30 | Xip -i
Version 1.00
- Initial release