#!/usr/bin/perl

## read nmap XML files and produce a list of services and their counts

while (<>) {
# change "open" to "filtered" or "closed" if you are interested in those counts
    if (/port protocol=\"(\w+)\" portid=\"(\d+)\"><state state=\"open\"/) { 
	$sc{"$1-$2"}++;
    } 
}

foreach (keys %sc) {
    print "$_: $sc{$_}\n";
}
