Skip to main content
Glama

MCP Kali Pentest

by Root1856
setup.shβ€’5.99 kB
#!/bin/bash # MCP Kali Pentest Setup Script # Automated setup for the penetration testing framework set -e echo "==========================================" echo " MCP Kali Pentest Setup" echo "==========================================" echo "" # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Check if running on Linux if [[ "$OSTYPE" != "linux-gnu"* ]]; then echo -e "${RED}Error: This script requires Linux${NC}" exit 1 fi # Check if running with sufficient privileges if [ "$EUID" -ne 0 ] && [ -z "$SUDO_USER" ]; then echo -e "${YELLOW}Warning: Some operations may require sudo privileges${NC}" fi echo -e "${GREEN}Step 1: Checking system requirements...${NC}" # Check Python version if command -v python3 &> /dev/null; then PYTHON_VERSION=$(python3 --version | awk '{print $2}') echo " βœ“ Python $PYTHON_VERSION found" else echo -e "${RED} βœ— Python 3 not found. Please install Python 3.9+${NC}" exit 1 fi # Check for required system tools echo "" echo -e "${GREEN}Step 2: Checking security tools...${NC}" TOOLS=( "nmap" "nikto" "sqlmap" "gobuster" "hydra" "john" "hashcat" "nuclei" "ffuf" ) MISSING_TOOLS=() for tool in "${TOOLS[@]}"; do if command -v "$tool" &> /dev/null; then echo " βœ“ $tool" else echo -e " ${YELLOW}βœ— $tool (not found)${NC}" MISSING_TOOLS+=("$tool") fi done if [ ${#MISSING_TOOLS[@]} -gt 0 ]; then echo "" echo -e "${YELLOW}Missing tools detected. Install them? (y/n)${NC}" read -r INSTALL_TOOLS if [[ "$INSTALL_TOOLS" == "y" ]]; then echo "Installing missing tools..." sudo apt update sudo apt install -y "${MISSING_TOOLS[@]}" fi fi # Create virtual environment echo "" echo -e "${GREEN}Step 3: Setting up Python virtual environment...${NC}" if [ ! -d "venv" ]; then python3 -m venv venv echo " βœ“ Virtual environment created" else echo " βœ“ Virtual environment already exists" fi # Activate virtual environment source venv/bin/activate # Install Python dependencies echo "" echo -e "${GREEN}Step 4: Installing Python dependencies...${NC}" pip install --upgrade pip pip install -r requirements.txt echo " βœ“ Python dependencies installed" # Create required directories echo "" echo -e "${GREEN}Step 5: Creating required directories...${NC}" DIRS=( "/var/log/mcpkali" "/var/lib/mcpkali" "/var/lib/mcpkali/reports" "/var/lib/mcpkali/sessions" ) for dir in "${DIRS[@]}"; do if [ ! -d "$dir" ]; then sudo mkdir -p "$dir" sudo chown -R $USER:$USER "$dir" echo " βœ“ Created $dir" else echo " βœ“ $dir already exists" fi done # Create config if it doesn't exist echo "" echo -e "${GREEN}Step 6: Setting up configuration...${NC}" if [ ! -f "config.local.json" ]; then cp config.json config.local.json echo " βœ“ Created config.local.json" echo -e " ${YELLOW}⚠ Please edit config.local.json with your LM Studio settings${NC}" else echo " βœ“ config.local.json already exists" fi # Set up wordlists echo "" echo -e "${GREEN}Step 7: Checking wordlists...${NC}" WORDLIST_DIR="/usr/share/wordlists" if [ -f "$WORDLIST_DIR/rockyou.txt.gz" ]; then if [ ! -f "$WORDLIST_DIR/rockyou.txt" ]; then echo " Extracting rockyou.txt..." sudo gunzip "$WORDLIST_DIR/rockyou.txt.gz" fi echo " βœ“ rockyou.txt available" fi if [ -d "$WORDLIST_DIR/dirb" ]; then echo " βœ“ dirb wordlists available" fi # Download nuclei templates echo "" echo -e "${GREEN}Step 8: Setting up Nuclei templates...${NC}" if command -v nuclei &> /dev/null; then nuclei -update-templates &> /dev/null || true echo " βœ“ Nuclei templates updated" fi # Set capabilities for tools that need raw sockets echo "" echo -e "${GREEN}Step 9: Setting up tool capabilities...${NC}" if command -v nmap &> /dev/null; then sudo setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip $(which nmap) 2>/dev/null || true echo " βœ“ Nmap capabilities set" fi # Create systemd service (optional) echo "" echo -e "${YELLOW}Would you like to create a systemd service? (y/n)${NC}" read -r CREATE_SERVICE if [[ "$CREATE_SERVICE" == "y" ]]; then SERVICE_FILE="/etc/systemd/system/mcpkali.service" sudo tee "$SERVICE_FILE" > /dev/null <<EOF [Unit] Description=MCP Kali Pentest Server After=network.target [Service] Type=simple User=$USER WorkingDirectory=$(pwd) ExecStart=$(pwd)/venv/bin/python $(pwd)/server.py Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target EOF sudo systemctl daemon-reload echo " βœ“ Systemd service created" echo "" echo " To start the service:" echo " sudo systemctl start mcpkali" echo " To enable on boot:" echo " sudo systemctl enable mcpkali" fi # Final instructions echo "" echo "==========================================" echo -e "${GREEN}Setup Complete!${NC}" echo "==========================================" echo "" echo "Next steps:" echo "" echo "1. Set up LM Studio:" echo " - Download from https://lmstudio.ai/" echo " - Load a model (Mistral 7B recommended)" echo " - Start the server (default: http://localhost:1234)" echo "" echo "2. Configure the server:" echo " - Edit config.local.json" echo " - Update LM Studio URL and model name" echo "" echo "3. Start the server:" echo " source venv/bin/activate" echo " python3 server.py" echo "" echo "4. Add to Claude Desktop (optional):" echo " Edit ~/.config/Claude/claude_desktop_config.json" echo " Add the mcpkali server configuration" echo "" echo -e "${YELLOW}⚠ IMPORTANT SECURITY NOTICE:${NC}" echo "This tool is for authorized security testing only." echo "Always obtain written permission before testing." echo "Configure rules_of_engagement in config.local.json" echo "" echo "For documentation, see README.md" echo "" echo -e "${GREEN}Happy (ethical) hacking!${NC}"

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Root1856/mcpkali'

If you have feedback or need assistance with the MCP directory API, please join our Discord server