localhost
8078-8082
Te dice que puertos están abiertos, que tipo de servicio corre. Se guardan logs de los scanneres en un archivo en la misma carpeta del script y también da salida en CSV.
Código
import nmap import socket import datetime import sys import os now = datetime.datetime.now() netmap = nmap.PortScanner() remoteServer = input('Enter host:\n') try: remoteServerIP = socket.gethostbyname(remoteServer) portRange = input('Enter port range using - as separator:\n') print ('-' * 60) print ('Please wait, scanning remote host', remoteServerIP) print ('-' * 60) t1 = datetime.datetime.now() netmap.scan(remoteServerIP, portRange) except KeyboardInterrupt: print ("Ctrl+C pressed") sys.exit() except socket.gaierror: print ("Couldn't resolve hostname") sys.exit() except socket.error: print ("Couldn't connect to server") sys.exit() with open ("pScan.log", "a") as out: for host in netmap.all_hosts(): print('Host : ' + host + '(' + netmap[host].hostname() + ')') out.write('Host : ' + host + '(' + netmap[host].hostname() + ')\n') print('State : %s' % netmap[host].state()) out.write('State : %s' % netmap[host].state()+"\n") for proto in netmap[host].all_protocols(): print('----------') out.write('----------\n') print('Protocol : %s' % proto) out.write('Protocol : %s' % proto+"\n") lport = sorted(netmap[host][proto]) for port in lport: print('Port : %s\nState : %s' % (port, netmap[host][proto][port]['state'])) out.write('Port : ' + str(port) + '\nState : ' + str(netmap[host][proto][port]['state'])+"\n") print('Name : '+netmap[host][proto][port]['name']) out.write('Name : '+netmap[host][proto][port]['name']+"\n") temp2 = str(now.year) + "/" + str(now.month) + "/" + str(now.day) + " " + str(now.hour) + ":" + str(now.minute) + ":" + str(now.second) print("Date : " + temp2 + "\n\n") out.write("Date : " + temp2 + "\n\n") t2 = datetime.datetime.now() total = t2 - t1 print ("Scanning completed in ", str(total)) out.write("\nScanning completed in "+ str(total)+"\n") print('\n\nCSV:\n'+netmap.csv()) out.write('\n\nCSV:\n'+netmap.csv()+"\n")