forked from AlexisAhmed/Python3-NmapScanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScanner.py
50 lines (36 loc) · 1.46 KB
/
Scanner.py
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
40
41
42
#!/usr/bin/python3
import nmap
scanner = nmap.PortScanner()
print("Welcome, this is a simple nmap automation tool")
print("<----------------------------------------------------->")
ip_addr = input("Please enter the IP address you want 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 selected option: ", resp)
if resp == '1':
print("Nmap Version: ", scanner.nmap_version())
scanner.scan(ip_addr, '1-1024', '-v -sS')
print(scanner.scaninfo())
print("Ip Status: ", scanner[ip_addr].state())
print(scanner[ip_addr].all_protocols())
print("Open Ports: ", scanner[ip_addr]['tcp'].keys())
elif resp == '2':
print("Nmap Version: ", scanner.nmap_version())
scanner.scan(ip_addr, '1-1024', '-v -sU')
print(scanner.scaninfo())
print("Ip Status: ", scanner[ip_addr].state())
print(scanner[ip_addr].all_protocols())
print("Open Ports: ", scanner[ip_addr]['udp'].keys())
elif resp == '3':
print("Nmap Version: ", scanner.nmap_version())
scanner.scan(ip_addr, '1-1024', '-v -sS -sV -sC -A -O')
print(scanner.scaninfo())
print("Ip Status: ", scanner[ip_addr].state())
print(scanner[ip_addr].all_protocols())
print("Open Ports: ", scanner[ip_addr]['tcp'].keys())
elif resp >= '4':
print("Please enter a valid option")