Nmap List only Open Ports from output

Nmap List only Open Ports from output


Ok,

Lets say you have the .nmap output from a Scan. Or you simply have the scan printed on the screen.

This is the regex I spent few minutes to write to list all open ports. I need this to then check if any of the unknown ports run a HTTP service.

# egrep '^[0-9]{1,5}'  output.nmap | grep -i open  | awk -F'/' '{print $1}' |  sort -g | uniq | sed -n -e 'H;${x;s/\n/,/g;s/^,//;p;}'

nmap -v -iL targetList -sC  --script=banner-plus  -p [listFromAbove]


Reference: https://github.com/hdm/scan-tools/blob/master/nse/banner-plus.nse to be installed in  /usr/share/nmap/scripts/banner-plus.nse


Even better... do this:

//$cat report.gnmap | perl ./gnmap.pl | cut -f 1,2 -d "," | tr "," ":" > list.txt
$cat report.gnmap | perl gnmap.pl | cut -f 1,2 -d "," | tr "," ":" > exit2.txt

$EyeWitness.py -f list.txt --web

Reference:
https://codeload.github.com/ChrisTruncer/EyeWitness/zip/master
https://codeload.github.com/ChrisTruncer/rdpy/zip/master
https://web.archive.org/web/20130313062417/http://www.cyberis.co.uk/downloads/gnmap.pl