$hosts) { foreach($hosts as $hostaddress => $servicesList) { $targets[$hostaddress] = true; foreach ($servicesList as $service) { $services[$service] = true; } } } $targets = array_keys($targets); $services = array_keys($services); exec("nmap -v -Pn -p ".join($services, ",")." --script smb-enum-shares.nse -oX 'scans/$site.xml' ".join($targets, " ")); } }; ?>