Skip to content

Commit 395b002

Browse files
authored
Create Scanner.py
1 parent df3900b commit 395b002

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

Scanner.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/python3
2+
3+
import nmap
4+
5+
scanner = nmap.PortScanner()
6+
7+
print("Welcome, this is a simple nmap automation tool")
8+
print("<----------------------------------------------------->")
9+
10+
ip_addr = input("Please enter the IP address you want to scan: ")
11+
print("The IP you entered is: ", ip_addr)
12+
type(ip_addr)
13+
14+
resp = input("""\nPlease enter the type of scan you want to run
15+
1)SYN ACK Scan
16+
2)UDP Scan
17+
3)Comprehensive Scan \n""")
18+
print("You have selected option: ", resp)
19+
20+
if resp == '1':
21+
print("Nmap Version: ", scanner.nmap_version())
22+
scanner.scan(ip_addr, '1-1024', '-v -sS')
23+
print(scanner.scaninfo())
24+
print("Ip Status: ", scanner[ip_addr].state())
25+
print(scanner[ip_addr].all_protocols())
26+
print("Open Ports: ", scanner[ip_addr]['tcp'].keys())
27+
elif resp == '2':
28+
print("Nmap Version: ", scanner.nmap_version())
29+
scanner.scan(ip_addr, '1-1024', '-v -sU')
30+
print(scanner.scaninfo())
31+
print("Ip Status: ", scanner[ip_addr].state())
32+
print(scanner[ip_addr].all_protocols())
33+
print("Open Ports: ", scanner[ip_addr]['udp'].keys())
34+
elif resp == '3':
35+
print("Nmap Version: ", scanner.nmap_version())
36+
scanner.scan(ip_addr, '1-1024', '-v -sS -sV -sC -A -O')
37+
print(scanner.scaninfo())
38+
print("Ip Status: ", scanner[ip_addr].state())
39+
print(scanner[ip_addr].all_protocols())
40+
print("Open Ports: ", scanner[ip_addr]['tcp'].keys())
41+
elif resp >= '4':
42+
print("Please enter a valid option")
43+
44+
45+
46+
47+
48+
49+
50+

0 commit comments

Comments
 (0)