#!/usr/bin/env python
import sys
import subprocess
import xml.etree.ElementTree as ET

def acquire_input_and_run_nmap():
	host = sys.argv[1]
	command = ("nmap -oX - -A -Pn %s" % host)
	p = subprocess.run(command, shell=True, stdout=subprocess.PIPE)
	root = ET.fromstring(p.stdout)
	return root

def process_nmap_port_services(root):
	info = []
	for service in root.iter('service'):
		output = service.get('product')
		info.append(output)
	info = [x for x in info if x != None]
	print(info)
	return info

def searchsploit_search(cleanservices):
	for cleanservices in cleanservices:
		command = ("searchsploit %s" % cleanservices)
		subprocess.run(command, shell=True)
		
def main():
	root = acquire_input_and_run_nmap()
	services = process_nmap_port_services(root)
	cleanservices = [x for x in services if x != None]
	searchsploit_search(cleanservices)
	
if __name__ == "__main__":
	main()

@@ -126,19 +126,126 @@
 t = 
-sys.argv%5B1%5D
+input(%22What is the hostname or IP address?  %22)%0A%09ports = input(%22What port(s) do you want to scan? ex. 80 or 1-65535  %22)
 %0A%09co
@@ -276,18 +276,33 @@
 -Pn 
+%25s -p 
 %25s%22 %25 
+(
 host
+, ports)
 )%0A%09p
@@ -558,58 +558,255 @@
 t)%0A%09
-info = %5Bx for x in info if x != None%5D%0A%09print(info)
+return info%0A%0Adef clean_output(info):%0A%09info = %5Bx for x in info if x != None%5D # Takes out None types%0A%09print(%22%5CnThese services have been found %25s%5Cn%22 %25 info)%0A%09info = (%5Bs.strip('httpd') for s in info%5D) # Takes out httpd because it limits search results
 %0A%09re
@@ -893,16 +893,76 @@
 rvices:%0A
+%09%09print(%22%5CnSEARCHING FOR THE %25s SERVICE%5Cn%22 %25 cleanservices)%0A
 %09%09comman
@@ -1054,16 +1054,102 @@
 main():%0A
+%09print(%22%5CnMake sure the searchsploit program is up-to-date. i.e. searchsploit -u %5Cn%22)%0A
 %09root = 
@@ -1243,42 +1243,30 @@
 s = 
-%5Bx for x in services if x != None%5D
+clean_output(services)
 %0A%09se

Update nmapexdbsearch.py