-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject_two.py
More file actions
35 lines (27 loc) · 966 Bytes
/
Copy pathProject_two.py
File metadata and controls
35 lines (27 loc) · 966 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
import subprocess
def check_open_ports(link):
try:
print("\n [+] Checking for open ports...")
command = ["nmap", link, "--open"]
result = subprocess.run(command, capture_output=True, text=True)
print(result.stdout)
except subprocess.CalledProcessError as e:
print("Failed to scan")
def check_vulnerabilities(link):
try:
print("\n [+] Checking for outdated versions..")
command = ["nikto","-h", link]
result = subprocess.run(command, capture_output=True, text=True)
print(result.stdout)
except subprocess.CalledProcessError as e:
print("Failed to scan")
target = input("Enter the target URL: ")
ports = check_open_ports(target)
vuln = check_vulnerabilities(target)
print("\n [+] Done")
with open("results.txt", "w") as f:
f.write("Target: " + target + "\n")
f.write(ports)
f.write("\n\n")
f.write(vuln)
print("\n [+] Results saved to results.txt")