-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathNmap_Scanner.py
More file actions
22 lines (17 loc) · 777 Bytes
/
Nmap_Scanner.py
File metadata and controls
22 lines (17 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import nmap
def escanear_vulnerabilidades(ip):
scanner = nmap.PortScanner()
scanner.scan(ip, arguments='-p 1-65535 -T4 -A -v')
for host in scanner.all_hosts():
print('Host : %s (%s)' % (host, scanner[host].hostname()))
print('State : %s' % scanner[host].state())
for proto in scanner[host].all_protocols():
print('Protocolo : %s' % proto)
lport = scanner[host][proto].keys()
for port in lport:
print('Puerto : %s\tEstado : %s' % (port, scanner[host][proto][port]['state']))
print('Servicio : %s' % scanner[host][proto][port]['name'])
print('')
if __name__ == '__main__':
ip_a_escanear = '192.168.1.1'
escanear_vulnerabilidades(ip_a_escanear)