-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnmap-scanner.py
More file actions
41 lines (30 loc) · 765 Bytes
/
nmap-scanner.py
File metadata and controls
41 lines (30 loc) · 765 Bytes
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
#!/usr/bin/python3
import nmap
scanner = nmap.PortScanner()
print("Welcome to nmap tool")
ip = input(
"Enter ip to scan: "
)
print("Scanning...", ip)
res = input("""
Enter scan type:
1 - SYN ACK
2 - UDP
3 - COMPREHENSIVE
""")
print("You selected: ", res)
def scan(s_methods, s_type):
print("Nmap Version", scanner.nmap_version())
scanner.scan(ip, '1-1024', s_methods)
print(scanner.scaninfo())
print("IP Status: ", scanner[ip].state())
print("Protocols: ", scanner[ip].all_protocols())
print("Open Ports: ", scanner[ip][s_type].keys())
if res == '1':
scan('-v sS','tcp')
elif res == '2':
scan('-v sU', 'udp')
elif res == '3':
scan('-v -sS -sV -sC -A -O', 'tcp')
else:
print('Wrong selection!')