Skip to content

Instantly share code, notes, and snippets.

@bdpuk
Created January 21, 2013 16:49
Show Gist options
  • Save bdpuk/4587372 to your computer and use it in GitHub Desktop.
Save bdpuk/4587372 to your computer and use it in GitHub Desktop.
NMap XML -> CSV with xmlstarlet
cat nmap-output.xml | grep -v "mac" | xmlstarlet sel -T -t -m "//state[@state='open']" -m ../../.. -v address/@addr -m hostnames/hostname -i @name -o ' (' -v @name -o ')' -b -b -b -o "," -m .. -v @portid -o ',' -v @protocol -o "," -m service -v @name -i "@tunnel='ssl'" -o 's' -b -o "," -v @product -o ' ' -v @version -v @extrainfo -b -n -| sed 's_^\([^\t ]*\)\( ([^)]*)\)\?\t\([^\t ]*\)_\1.\3\2_' | sort -n -t. > nmap-output.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment