-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnmap_scanner.py
More file actions
39 lines (36 loc) · 1.64 KB
/
nmap_scanner.py
File metadata and controls
39 lines (36 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import nmap
scanner = nmap.PortScanner()
print("Hi, here's a simple nmap automation tool")
print("<--------------------------------------->")
ip_addr = input("Please etnter the IP address you would like to scan:")
print("The IP you entered is: ", ip_addr)
type(ip_addr)
resp = input("""\nPlease enter the type of scan you want to run:
1) SYN ACK Scan
2)UDP Scan
3)Comprehensive Scan \n
""")
print("You have selection option: ", resp)
if resp == '1':
print("Nmap Verions: ", scanner.nmap_version())
scanner.scan(ip_addr, '1-1024', '-v -sS') #we want to verbose the output, and -sS means syn ack
print(scanner.scaninfo())
print("IP Status: ", scanner[ip_addr].state)
print(scanner[ip_addr].all_protocols())
print("Open ports", scanner[ip_addr]['tcp'].keys()) ## this will return all the active ports
elif resp == '2':
print("Nmap Verions: ", scanner.nmap_version())
scanner.scan(ip_addr, '1-1024', '-v -sU') #we want to verbose the output, and -sS means syn ack
print(scanner.scaninfo())
print("IP Status: ", scanner[ip_addr].state)
print(scanner[ip_addr].all_protocols())
print("Open ports", scanner[ip_addr]['udp'].keys()) ## this will return all the active ports
elif resp == '3':
print("Nmap Verions: ", scanner.nmap_version())
scanner.scan(ip_addr, '1-1024', '-v -sS -sV -sC -A -O') #we want to verbose the output, and -sS means syn ack
print(scanner.scaninfo())
print("IP Status: ", scanner[ip_addr].state)
print(scanner[ip_addr].all_protocols())
print("Open ports", scanner[ip_addr]['tcp'].keys()) ## this will return all the active ports
else:
print("Please enter a valid option")