Security Ripcord


NMap Parser for XML Output Files

March 21st, 2006 cutaway Posted in NMap, PDC, Tools No Comments » 3,719 views

Paul at PaulDotCom.com put out a call for scripts using the perl module NMap Parser. This is one that I had and cleaned up a little bit.

Basically this script will search all of the XML files in a particular directory and then output the open TCP ports that were detected. I know that you can see this in a regular scan output but this takes input from all XML files in the directory and then outputs them in an easy to read HTML format. See below for the header notes that describe the script’s functions in more detail.

Download nmap_xot.zip as well as the sample output and tell me what you think about it. I have a thick skin so let me know what you think.

#######################################################
# Name: nmap_xot.pl
# Version: 1.0
# Author: Don C. Weber
# Company: Cutaway Security
# Date: 03/13/2006
# Usage: nmap_xot.pl [-h -d -i <input directory> -o ]
# Purpose: Parse the NMap XML output for open TCP ports
# and display them in a human readable format.
# Currently the ports are color coded for easy
# of use and grouping. Also generates a list of
# targets according to port types (i.e Web,
# Telnet, MS, etc.)
#
# Notes: File must be in the same directory as the
# XML files being parsed. The file will
# output the resulting HTML file to the
# same directory. The -d option is used for
# debugging.
#
# Notes:
# -d Debugging mode will output information not
# necessarily required
#
# -i The input directory should contain the XML
# files that need to be parsed. The value of
# this input will also be used as the output
# directory. This defaults to the local
# directory.
#
# -o The name of the file to output the results.
# Default is open_ports_nmap_.html
#
# -h Sometimes everybody needs a little help.
#
# ToDo (no order):
# 1. Print the host lists to text files for
# new target lists that can be used by
# other tools.
#
# 2. Sort the HTML table according to IP
# addresses. (attempted to do this
# without very much luck). The reason
# for the problem is that the incoming
# XML files may include the same IP with
# different results.
#
# 3. Update the color codings. Move from the
# switch statement to a hash of values.
#
# 4. Move to style sheet.
#
######################################################