-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsecurity.py
More file actions
22 lines (19 loc) · 827 Bytes
/
security.py
File metadata and controls
22 lines (19 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import subprocess
NMAP_PATH = r"C:\Program Files (x86)\Nmap\nmap.exe"
GOBUSTER_PATH = r"C:\Users\YourUsername\gobuster\gobuster.exe"
def run_nmap(target):
try:
result = subprocess.check_output([NMAP_PATH, "-Pn", target], stderr=subprocess.STDOUT, text=True)
return result
except subprocess.CalledProcessError as e:
return f"nmap error: {e.output}"
except FileNotFoundError:
return "nmap command not found!"
def run_gobuster(target):
try:
result = subprocess.check_output([GOBUSTER_PATH, "dir", "-u", f"http://{target}", "-w", "wordlist.txt"], stderr=subprocess.STDOUT, text=True)
return result
except subprocess.CalledProcessError as e:
return f"gobuster error: {e.output}"
except FileNotFoundError:
return "gobuster command not found!"