Many of the Nmap Scripting Engine (NSE) scripts are only applicable if there is a service running on a given port. Consider the usage of the
smb-check-vulns.nse script. This script will evaluate SMB services running on TCP port
445 for common service vulnerabilities. If this script were executed across an entire network, it would have to reaccomplish the task of determining whether port
445 is open and if the SMB service is accessible on each target system. This is a task that has probably already been accomplished during the scanning phase of the assessment. Bash scripting can be used to leverage existing Nmap greppable output files to run service-specific NSE scripts only against systems ...