def nmap(*args): args = args[0] if len(args)<1: return cmd = ["nmap", "-sS"] address = args[0] if args[1] !="": address += "/"+args[1] cmd.append(address) nmap_response = subprocess.Popen(cmd, stdout=subprocess.PIPE).stdout.read() spi.add_report(nmap_response)
def ping(*args): print "Starting ping procedure" args = args[0] if len(args) < 2: print "less than 2 args" print args return cmd = ["ping"] if args[1] != "": cmd.append("-c " + args[1]) if args[2] != "": cmd.append("-i " + args[2]) cmd.append(args[0]) ping_response = subprocess.Popen(cmd, stdout=subprocess.PIPE).stdout.read() print "ping finished, adding report" spi.add_report(ping_response)