-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython-nmap-scanner.py
More file actions
48 lines (41 loc) · 1.65 KB
/
Copy pathpython-nmap-scanner.py
File metadata and controls
48 lines (41 loc) · 1.65 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
40
41
42
43
44
45
46
47
#!/usr/bin/python3
import nmap
from yaml import scan
scanner = nmap.PortScanner()
print("<------------------------------------------>")
print("Welcome to Python-nmap-scan")
print("<------------------------------------------>")
print("<------------------------------------------>")
print("<------------------------------------------>")
host = input("Enter the IP to scan: ")
print("The IP you entered is: ", host)
type(host)
resp = input("""\nPlease enter the type of scan you want to perform
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(host,'1-1024','-sS -v')
print("Scanner info: ", scanner.scaninfo())
print("IP Status", scanner[host].state())
print("Protocol Observed",scanner[host].all_protocols(), "\n")
print("Open Ports: ", scanner[host]['tcp'].keys())
# print()
elif resp == 2:
print("Nmap Version", scanner.nmap_version())
scanner.scan(host,'1-1024','-sU -v')
print("Scanner info: ", scanner.scaninfo())
print("IP Status", scanner[host].state())
print("Protocol Observed",scanner[host].all_protocols(), "\n")
print("Open Ports: ", scanner[host]['udp'].keys())
elif resp == 3:
print("Nmap Version", scanner.nmap_version())
scanner.scan(host,'1-1024','-sS -sC -sV -O -v -A')
print("Scanner info: ", scanner.scaninfo())
print("IP Status", scanner[host].state())
print("Protocol Observed",scanner[host].all_protocols(), "\n")
print("Open Ports: ", scanner[host]['tcp'].keys())
else:
print("Please enter a valid choice")