Skip to content

Commit 7433301

Browse files
authored
Merge pull request #1 from Niroznak/Niroznak-patch-1
Update Scanner.py
2 parents 992b22f + a6ba00d commit 7433301

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

Scanner.py

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,17 @@
1616
2)UDP Scan
1717
3)Comprehensive Scan \n""")
1818
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')
19+
resp_dict={'1':['-v -sS','tcp'],'2':['-v -sU','udp'],'3':['-v -sS -sV -sC -A -O','tcp']}
20+
if resp not in resp_dict.keys():
21+
print("enter a valid option")
22+
else:
23+
print("nmap version: "sccaner.nmap_version())
24+
scanner.scan(ip_addr,"1-1024",resp_dict[resp][0]) #the # are port range to scan, the last part is the scan type
3025
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-
26+
if scanner.scaninfo()=='up':
27+
print("Scanner Status: ",scanner[ip_addr].state())
28+
print(scanner[ip_addr].all_protocols())
29+
print("Open Ports: ",scanner[ip_addr][resp_dict[resp][1]].keys()) #display all open ports
4430

4531

4632

0 commit comments

Comments
 (0)