-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathkali_mcp.py
More file actions
48 lines (40 loc) · 1.77 KB
/
Copy pathkali_mcp.py
File metadata and controls
48 lines (40 loc) · 1.77 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
from mcp.server.fastmcp import FastMCP
import subprocess
import os
mcp = FastMCP("ShieldCI-Arsenal")
def run_cmd(cmd):
"""Helper to run shell commands safely and return output."""
try:
result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
return f"STDOUT:\n{result.stdout}\n\nSTDERR:\n{result.stderr}"
except Exception as e:
return f"Execution Error: {str(e)}"
@mcp.tool()
def sqlmap_scan(url: str):
"""Deep SQL injection testing. Best for login forms and search bars."""
target = url.replace("127.0.0.1", "host.docker.internal")
return run_cmd(["sqlmap", "-u", target, "--batch", "--random-agent", "--level=1"])
@mcp.tool()
def nmap_scan(target: str):
"""Port scanner. Use this first to find what services are running."""
host = target.replace("127.0.0.1", "host.docker.internal")
return run_cmd(["nmap", "-sV", "-T4", host])
@mcp.tool()
def nikto_scan(url: str):
"""Web server vulnerability scanner. Finds outdated software and dangerous files."""
target = url.replace("127.0.0.1", "host.docker.internal")
return run_cmd(["nikto", "-h", target, "-Tuning", "1,2,3,b"])
@mcp.tool()
def gobuster_scan(url: str):
"""Directory brute-forcer. Finds hidden /admin, /config, or /.env files."""
target = url.replace("127.0.0.1", "host.docker.internal")
# Using a common small wordlist included in Kali
wordlist = "/usr/share/dirb/wordlists/common.txt"
return run_cmd(["gobuster", "dir", "-u", target, "-w", wordlist, "-q", "-z"])
@mcp.tool()
def check_headers(url: str):
"""Quick check for missing security headers like CSP or X-Frame-Options."""
target = url.replace("127.0.0.1", "host.docker.internal")
return run_cmd(["curl", "-I", "-s", target])
if __name__ == "__main__":
mcp.run()