-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenum-nmap.py
More file actions
executable file
·36 lines (27 loc) · 1.13 KB
/
enum-nmap.py
File metadata and controls
executable file
·36 lines (27 loc) · 1.13 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
import nmap
# Create an instance of the nmap.PortScanner class
scanner = nmap.PortScanner()
# Ask the user for the target host or network
target = input("Enter the target host or network: ")
# Ask the user for the nmap timing template
timing = input("Enter the nmap timing template (0-5): ")
# Ask the user for the scan type
scan_type = input("Enter the scan type (sT, sU, sS, sA, sW, sM): ")
# Ask the user for the output format
output_format = input("Enter the output format (normal, csv, xml, grepable, all, none): ")
# Ask the user for the verbosity level
verbosity = input("Enter the verbosity level (0-9, with 9 being the most verbose): ")
# Build the arguments string
arguments = f"-{scan_type} --timing {timing} -v{verbosity}"
if output_format != "none":
arguments += f" -o{output_format}"
# Perform a scan on the target with the specified options
print("Scanning...")
scanner.scan(target, arguments=arguments)
# Print the results of the scan
print("Hosts found:")
for host in scanner.all_hosts():
print(host)
print("Open ports:")
for port in scanner[host]['tcp']:
print(f"{port}: {scanner[host]['tcp'][port]['name']}")