Skip to main content
Glama

MCP Pentest

install-tools.sh•17.5 kB
#!/bin/bash # MCP Pentest - Tool Installation Script # This script installs required pentesting tools set -e echo "šŸš€ Installing MCP Pentest dependencies..." # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Function to print colored output print_status() { echo -e "${GREEN}[INFO]${NC} $1" } print_warning() { echo -e "${YELLOW}[WARNING]${NC} $1" } print_error() { echo -e "${RED}[ERROR]${NC} $1" } # Check if running as root for some installations check_sudo() { if [[ $EUID -eq 0 ]]; then print_warning "Running as root. Some tools may not install correctly." fi } # Install system packages install_system_packages() { print_status "Installing system packages..." if command -v apt-get &> /dev/null; then # Debian/Ubuntu sudo apt-get update sudo apt-get install -y nmap nikto sqlmap curl wget git print_status "Installed: nmap, nikto, sqlmap" elif command -v yum &> /dev/null; then # RHEL/CentOS sudo yum install -y nmap nikto sqlmap curl wget git print_status "Installed: nmap, nikto, sqlmap" elif command -v pacman &> /dev/null; then # Arch Linux sudo pacman -S --noconfirm nmap nikto sqlmap curl wget git print_status "Installed: nmap, nikto, sqlmap" elif command -v brew &> /dev/null; then # macOS brew install nmap nikto sqlmap print_status "Installed: nmap, nikto, sqlmap" else print_error "Unsupported package manager. Please install nmap, nikto, and sqlmap manually." exit 1 fi } # Install Go (if not present) install_go() { if command -v go &> /dev/null; then print_status "Go is already installed: $(go version)" return fi print_status "Installing Go..." # Download and install Go GO_VERSION="1.21.0" OS=$(uname -s | tr '[:upper:]' '[:lower:]') ARCH=$(uname -m) case $ARCH in x86_64) ARCH="amd64" ;; aarch64|arm64) ARCH="arm64" ;; armv7l) ARCH="armv6l" ;; esac GO_TARBALL="go${GO_VERSION}.${OS}-${ARCH}.tar.gz" wget "https://golang.org/dl/${GO_TARBALL}" sudo tar -C /usr/local -xzf "${GO_TARBALL}" rm "${GO_TARBALL}" # Add Go to PATH echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc export PATH=$PATH:/usr/local/go/bin print_status "Go installed successfully" } # Install Nuclei install_nuclei() { print_status "Installing Nuclei..." if command -v nuclei &> /dev/null; then print_status "Nuclei is already installed: $(nuclei -version)" return fi # Install Nuclei using Go go install -v github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest # Add Go bin to PATH if not already there if [[ ":$PATH:" != *":$HOME/go/bin:"* ]]; then echo 'export PATH=$PATH:$HOME/go/bin' >> ~/.bashrc export PATH=$PATH:$HOME/go/bin fi # Update Nuclei templates nuclei -update-templates -silent print_status "Nuclei installed and templates updated" } # Install additional security tools install_additional_tools() { print_status "Installing additional security tools..." # Install subfinder for subdomain enumeration if ! command -v subfinder &> /dev/null; then go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest print_status "Installed: subfinder" fi # Install httpx for HTTP probing if ! command -v httpx &> /dev/null; then go install -v github.com/projectdiscovery/httpx/cmd/httpx@latest print_status "Installed: httpx" fi # Install ffuf for web fuzzing if ! command -v ffuf &> /dev/null; then go install github.com/ffuf/ffuf@latest print_status "Installed: ffuf" fi # Install Katana for parameter extraction if ! command -v katana &> /dev/null; then go install github.com/projectdiscovery/katana/cmd/katana@latest print_status "Installed: katana" fi # Install gobuster for directory enumeration if ! command -v gobuster &> /dev/null; then go install github.com/OJ/gobuster/v3@latest print_status "Installed: gobuster" fi # Install feroxbuster for directory enumeration if ! command -v feroxbuster &> /dev/null; then if command -v cargo &> /dev/null; then cargo install feroxbuster print_status "Installed: feroxbuster" else print_warning "Rust/Cargo not found, skipping feroxbuster" fi fi # Install dirsearch (Python-based) if ! command -v dirsearch &> /dev/null; then if command -v pip3 &> /dev/null; then pip3 install dirsearch print_status "Installed: dirsearch" else print_warning "pip3 not found, skipping dirsearch" fi fi # Install wfuzz for fuzzing if ! command -v wfuzz &> /dev/null; then if command -v pip3 &> /dev/null; then pip3 install wfuzz print_status "Installed: wfuzz" else print_warning "pip3 not found, skipping wfuzz" fi fi } # Install service-specific testing tools install_service_specific_tools() { print_status "Installing service-specific testing tools..." # Install CrackMapExec for SMB/WinRM/SSH/LDAP testing if ! command -v crackmapexec &> /dev/null; then if command -v pip3 &> /dev/null; then pip3 install crackmapexec print_status "Installed: crackmapexec" else print_warning "pip3 not found, skipping crackmapexec" fi fi # Install enum4linux for SMB enumeration if ! command -v enum4linux &> /dev/null; then if command -v apt-get &> /dev/null; then sudo apt-get install -y enum4linux elif command -v yum &> /dev/null; then sudo yum install -y enum4linux elif command -v pacman &> /dev/null; then sudo pacman -S --noconfirm enum4linux else print_warning "Package manager not supported for enum4linux" fi print_status "Installed: enum4linux" fi # Install smbclient for SMB testing if ! command -v smbclient &> /dev/null; then if command -v apt-get &> /dev/null; then sudo apt-get install -y smbclient elif command -v yum &> /dev/null; then sudo yum install -y samba-client elif command -v pacman &> /dev/null; then sudo pacman -S --noconfirm smbclient fi print_status "Installed: smbclient" fi # Install rpcclient for RPC enumeration if ! command -v rpcclient &> /dev/null; then if command -v apt-get &> /dev/null; then sudo apt-get install -y samba-common-bin elif command -v yum &> /dev/null; then sudo yum install -y samba-client elif command -v pacman &> /dev/null; then sudo pacman -S --noconfirm samba fi print_status "Installed: rpcclient" fi # Install hydra for brute force attacks if ! command -v hydra &> /dev/null; then if command -v apt-get &> /dev/null; then sudo apt-get install -y hydra elif command -v yum &> /dev/null; then sudo yum install -y hydra elif command -v pacman &> /dev/null; then sudo pacman -S --noconfirm hydra elif command -v brew &> /dev/null; then brew install hydra fi print_status "Installed: hydra" fi # Install medusa for brute force attacks if ! command -v medusa &> /dev/null; then if command -v apt-get &> /dev/null; then sudo apt-get install -y medusa elif command -v yum &> /dev/null; then sudo yum install -y medusa elif command -v pacman &> /dev/null; then sudo pacman -S --noconfirm medusa fi print_status "Installed: medusa" fi # Install ssh-audit for SSH configuration assessment if ! command -v ssh-audit &> /dev/null; then if command -v pip3 &> /dev/null; then pip3 install ssh-audit print_status "Installed: ssh-audit" else print_warning "pip3 not found, skipping ssh-audit" fi fi # Install SNMP tools if ! command -v snmpwalk &> /dev/null; then if command -v apt-get &> /dev/null; then sudo apt-get install -y snmp snmp-mibs-downloader elif command -v yum &> /dev/null; then sudo yum install -y net-snmp net-snmp-utils elif command -v pacman &> /dev/null; then sudo pacman -S --noconfirm net-snmp fi print_status "Installed: SNMP tools" fi # Install onesixtyone for SNMP scanning if ! command -v onesixtyone &> /dev/null; then if command -v apt-get &> /dev/null; then sudo apt-get install -y onesixtyone elif command -v yum &> /dev/null; then sudo yum install -y onesixtyone elif command -v pacman &> /dev/null; then sudo pacman -S --noconfirm onesixtyone fi print_status "Installed: onesixtyone" fi # Install ldap-utils for LDAP testing if ! command -v ldapsearch &> /dev/null; then if command -v apt-get &> /dev/null; then sudo apt-get install -y ldap-utils elif command -v yum &> /dev/null; then sudo yum install -y openldap-clients elif command -v pacman &> /dev/null; then sudo pacman -S --noconfirm openldap fi print_status "Installed: LDAP utils" fi # Install impacket for Windows exploitation if ! python3 -c "import impacket" &> /dev/null; then if command -v pip3 &> /dev/null; then pip3 install impacket print_status "Installed: impacket" else print_warning "pip3 not found, skipping impacket" fi fi # Install bloodhound for Active Directory assessment if ! command -v bloodhound-python &> /dev/null; then if command -v pip3 &> /dev/null; then pip3 install bloodhound print_status "Installed: bloodhound" else print_warning "pip3 not found, skipping bloodhound" fi fi } # Install Metasploit (optional) install_metasploit() { print_status "Installing Metasploit Framework..." if command -v msfconsole &> /dev/null; then print_status "Metasploit is already installed" return fi # Download and install Metasploit curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall chmod 755 msfinstall sudo ./msfinstall rm msfinstall print_status "Metasploit Framework installed" } # Create directories for wordlists and configs setup_directories() { print_status "Setting up directories..." mkdir -p ~/.config/mcp-pentest mkdir -p ~/.local/share/mcp-pentest/wordlists mkdir -p ~/.local/share/mcp-pentest/reports print_status "Directories created" } # Download common wordlists download_wordlists() { print_status "Downloading common wordlists..." WORDLIST_DIR="$HOME/.local/share/mcp-pentest/wordlists" # SecLists common wordlists if [ ! -d "$WORDLIST_DIR/SecLists" ]; then git clone https://github.com/danielmiessler/SecLists.git "$WORDLIST_DIR/SecLists" fi # Common subdomain wordlist if [ ! -f "$WORDLIST_DIR/subdomains.txt" ]; then wget -O "$WORDLIST_DIR/subdomains.txt" \ "https://raw.githubusercontent.com/danielmiessler/SecLists/master/Discovery/DNS/subdomains-top1million-5000.txt" fi # Common directory wordlist if [ ! -f "$WORDLIST_DIR/directories.txt" ]; then wget -O "$WORDLIST_DIR/directories.txt" \ "https://raw.githubusercontent.com/danielmiessler/SecLists/master/Discovery/Web-Content/common.txt" fi print_status "Wordlists downloaded" } # Verify installations verify_installations() { print_status "Verifying installations..." tools=("nmap" "nikto" "sqlmap" "nuclei") for tool in "${tools[@]}"; do if command -v "$tool" &> /dev/null; then print_status "āœ“ $tool is installed" else print_error "āœ— $tool is NOT installed" fi done # Check additional tools additional_tools=("subfinder" "httpx" "ffuf" "katana" "gobuster" "feroxbuster" "dirsearch" "wfuzz") echo print_status "Additional Tools:" for tool in "${additional_tools[@]}"; do if command -v "$tool" &> /dev/null; then print_status "āœ“ $tool is installed" else print_warning "ā—‹ $tool is not installed" fi done # Check service-specific tools service_tools=("crackmapexec" "enum4linux" "smbclient" "rpcclient" "hydra" "medusa" "ssh-audit" "snmpwalk" "onesixtyone" "ldapsearch") echo print_status "Service-Specific Tools:" for tool in "${service_tools[@]}"; do if command -v "$tool" &> /dev/null; then print_status "āœ“ $tool is installed" else print_warning "ā—‹ $tool is not installed" fi done # Check Python packages python_packages=("impacket" "bloodhound") echo print_status "Python Packages:" for package in "${python_packages[@]}"; do if python3 -c "import $package" &> /dev/null; then print_status "āœ“ $package is installed" else print_warning "ā—‹ $package is not installed" fi done # Check Metasploit echo print_status "Exploitation Frameworks:" if command -v msfconsole &> /dev/null; then print_status "āœ“ Metasploit Framework is installed" else print_warning "ā—‹ Metasploit Framework is not installed" fi } # Main installation process main() { echo "šŸ”§ MCP Pentest Tool Installation" echo "================================" echo check_sudo # Ask user what to install echo "What would you like to install?" echo "1) Essential tools only (nmap, nikto, sqlmap, nuclei)" echo "2) Essential + additional tools (subfinder, httpx, ffuf, etc.)" echo "3) Essential + service-specific tools (crackmapexec, enum4linux, hydra, etc.)" echo "4) Complete installation (all tools including Metasploit)" echo "5) Custom selection" read -p "Enter your choice (1-5): " choice case $choice in 1) install_system_packages install_go install_nuclei setup_directories download_wordlists ;; 2) install_system_packages install_go install_nuclei install_additional_tools setup_directories download_wordlists ;; 3) install_system_packages install_go install_nuclei install_service_specific_tools setup_directories download_wordlists ;; 4) install_system_packages install_go install_nuclei install_additional_tools install_service_specific_tools install_metasploit setup_directories download_wordlists ;; 5) echo "Custom installation options:" read -p "Install system packages (nmap, nikto, sqlmap)? [Y/n]: " install_sys read -p "Install Go? [Y/n]: " install_go_choice read -p "Install Nuclei? [Y/n]: " install_nuclei_choice read -p "Install additional tools (subfinder, httpx, ffuf)? [Y/n]: " install_additional read -p "Install service-specific tools (crackmapexec, enum4linux)? [Y/n]: " install_service read -p "Install Metasploit? [Y/n]: " install_msf read -p "Setup directories and wordlists? [Y/n]: " setup_dirs [[ $install_sys =~ ^[Yy]$ ]] && install_system_packages [[ $install_go_choice =~ ^[Yy]$ ]] && install_go [[ $install_nuclei_choice =~ ^[Yy]$ ]] && install_nuclei [[ $install_additional =~ ^[Yy]$ ]] && install_additional_tools [[ $install_service =~ ^[Yy]$ ]] && install_service_specific_tools [[ $install_msf =~ ^[Yy]$ ]] && install_metasploit [[ $setup_dirs =~ ^[Yy]$ ]] && setup_directories && download_wordlists ;; *) print_error "Invalid choice" exit 1 ;; esac verify_installations echo print_status "Installation completed!" print_status "Please restart your shell or run 'source ~/.bashrc' to update PATH" echo echo "šŸŽÆ Next steps:" echo "1. Run 'npm install' to install Node.js dependencies" echo "2. Run 'npm run build' to build the project" echo "3. Configure your MCP client to use this server" echo print_warning "Remember: Only use these tools on systems you own or have explicit permission to test!" } # Run main function main "$@"

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/adriyansyah-mf/mcp-pentest'

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