-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscanner.py
More file actions
51 lines (40 loc) · 1.53 KB
/
Copy pathscanner.py
File metadata and controls
51 lines (40 loc) · 1.53 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
48
49
50
51
import subprocess
import datetime
def run_nmap(target):
"""Run Nmap scan on the target"""
try:
result = subprocess.getoutput(f"nmap -sV {target}")
return result
except Exception as e:
return f"Error running Nmap: {e}"
def run_nikto(target):
"""Run Nikto scan on the target"""
try:
result = subprocess.getoutput(f"nikto -h {target}")
return result
except Exception as e:
return f"Error running Nikto: {e}"
def save_report(target, nmap_result, nikto_result):
"""Save the scan results into a text report"""
filename = f"report_{target}_{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}.txt"
with open(filename, "w") as f:
f.write("==== Automated Vulnerability Scan Report ====\n")
f.write(f"Target: {target}\n")
f.write(f"Date: {datetime.datetime.now()}\n\n")
f.write("---- Nmap Results ----\n")
f.write(nmap_result + "\n\n")
f.write("---- Nikto Results ----\n")
f.write(nikto_result + "\n\n")
print(f"\n[+] Report saved as {filename}")
def main():
print("==== Automated Vulnerability Scanner (CLI Version) ====")
target = input("Enter Target IP/Domain: ").strip()
print("\n[+] Running Nmap Scan...")
nmap_result = run_nmap(target)
print(nmap_result)
print("\n[+] Running Nikto Scan...")
nikto_result = run_nikto(target)
print(nikto_result)
save_report(target, nmap_result, nikto_result)
if __name__ == "__main__":
main()