#!/bin/bash
# ===============================================
# Villager AI + NoctisAI + HexStrike Ecosystem
# ===============================================
#
# This script starts the complete ecosystem:
# - Villager AI (Orchestration)
# - NoctisAI (Malware Development & Threat Intelligence)
# - HexStrike AI (150+ Security Tools)
#
# Usage: ./start_ecosystem.sh
#
# ===============================================
# Change to the script's directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_ROOT"
echo "πππ‘οΈ Villager AI + NoctisAI + HexStrike Ecosystem"
echo "=================================================="
echo ""
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
print_villager() {
echo -e "${GREEN}[VILLAGER]${NC} $1"
}
print_noctis() {
echo -e "${PURPLE}[NOCTIS]${NC} $1"
}
print_hexstrike() {
echo -e "${CYAN}[HEXSTRIKE]${NC} $1"
}
# Function to check if port is in use
check_port() {
local port=$1
if netstat -tlnp 2>/dev/null | grep -q ":$port "; then
return 0 # Port is in use
else
return 1 # Port is free
fi
}
# Function to start Villager AI
start_villager_ai() {
print_villager "Starting Villager AI..."
if [ -d "/home/yenn/Villager-AI" ]; then
cd /home/yenn/Villager-AI
if [ -f "scripts/start_villager_proper.sh" ]; then
./scripts/start_villager_proper.sh > /dev/null 2>&1 &
VILLAGER_PID=$!
print_success "Villager AI started (PID: $VILLAGER_PID)"
else
print_error "Villager AI startup script not found"
fi
cd "$PROJECT_ROOT"
else
print_warning "Villager AI not found at /home/yenn/Villager-AI"
fi
}
# Function to start NoctisAI
start_noctis_ai() {
print_noctis "Starting NoctisAI..."
if [ -f "scripts/start_noctis.sh" ]; then
./scripts/start_noctis.sh > /dev/null 2>&1 &
NOCTIS_PID=$!
print_success "NoctisAI started (PID: $NOCTIS_PID)"
else
print_error "NoctisAI startup script not found"
fi
}
# Function to start HexStrike AI
start_hexstrike_ai() {
print_hexstrike "Starting HexStrike AI..."
if [ -d "/home/yenn/hexstrike-ai" ]; then
cd /home/yenn/hexstrike-ai
if [ -f "start_hexstrike.sh" ]; then
./start_hexstrike.sh > /dev/null 2>&1 &
HEXSTRIKE_PID=$!
print_success "HexStrike AI started (PID: $HEXSTRIKE_PID)"
else
print_error "HexStrike AI startup script not found"
fi
cd "$PROJECT_ROOT"
else
print_warning "HexStrike AI not found at /home/yenn/hexstrike-ai"
fi
}
# Function to wait for services to be ready
wait_for_services() {
print_status "Waiting for all services to be ready..."
# Wait for Villager AI
if check_port 37695; then
print_success "Villager AI is ready (Port 37695)"
else
print_warning "Villager AI not responding on port 37695"
fi
# Wait for NoctisAI
if check_port 8081; then
print_success "NoctisAI is ready (Port 8081)"
else
print_warning "NoctisAI not responding on port 8081"
fi
# Wait for HexStrike AI
if check_port 8000; then
print_success "HexStrike AI is ready (Port 8000)"
else
print_warning "HexStrike AI not responding on port 8000"
fi
}
# Function to display ecosystem status
display_ecosystem_status() {
echo ""
echo "πππ‘οΈ Ecosystem Status"
echo "======================"
echo ""
# Villager AI status
if check_port 37695; then
print_success "Villager AI: Running (Port 37695)"
print_villager " β’ Task orchestration and AI-driven operations"
print_villager " β’ Agent scheduling and coordination"
print_villager " β’ Complex multi-step security assessments"
else
print_error "Villager AI: Not running"
fi
echo ""
# NoctisAI status
if check_port 8081; then
print_success "NoctisAI: Running (Port 8081)"
print_noctis " β’ Malware development (Python, C/C++, Rust, Assembly)"
print_noctis " β’ Threat intelligence (IOC analysis, MITRE ATT&CK)"
print_noctis " β’ OSINT & reconnaissance (Domain intel, social engineering)"
print_noctis " β’ Forensic analysis (Memory, disk, network forensics)"
print_noctis " β’ TheSilencer integration (Enhanced C/C++ malware framework)"
else
print_error "NoctisAI: Not running"
fi
echo ""
# HexStrike AI status
if check_port 8000; then
print_success "HexStrike AI: Running (Port 8000)"
print_hexstrike " β’ 150+ security tools for rapid testing"
print_hexstrike " β’ Network scanning (Nmap, Masscan, Rustscan)"
print_hexstrike " β’ Web testing (Gobuster, Dirb, Nikto, SQLMap)"
print_hexstrike " β’ Password attacks (Hydra, John the Ripper, Hashcat)"
print_hexstrike " β’ Payload generation (MSFVenom, custom exploits)"
else
print_error "HexStrike AI: Not running"
fi
echo ""
echo "π Service URLs:"
echo " β’ Villager AI: http://localhost:37695"
echo " β’ NoctisAI: http://localhost:8081"
echo " β’ HexStrike AI: http://localhost:8000"
echo ""
echo "π― Intelligent Tool Selection:"
echo " β’ Simple tasks β HexStrike AI (fast execution)"
echo " β’ Malware development β NoctisAI (specialized tools)"
echo " β’ Complex operations β Villager AI (AI orchestration)"
echo " β’ Combined approach β All three working together"
echo ""
echo "π MCP Configuration:"
echo " Add the following to your MCP configuration:"
echo ""
cat << 'EOF'
{
"mcpServers": {
"villager-proper": {
"command": "/path/to/Villager-AI/villager-venv-new/bin/python3",
"args": ["/path/to/Villager-AI/src/villager_ai/mcp/villager_proper_mcp.py"],
"env": {"PYTHONPATH": "/path/to/Villager-AI"}
},
"noctis-ai": {
"command": "/path/to/NoctisAI/noctis-env/bin/python3",
"args": ["/path/to/NoctisAI/src/noctis_ai/mcp/noctis_mcp.py"],
"env": {"PYTHONPATH": "/path/to/NoctisAI"}
},
"hexstrike-ai": {
"command": "/path/to/hexstrike-ai/hexstrike-env/bin/python3",
"args": ["/path/to/hexstrike-ai/hexstrike_mcp.py"]
}
}
}
EOF
echo ""
echo "π§ Troubleshooting:"
echo " β’ Check Villager AI: tail -f /home/yenn/Villager-AI/logs/villager_server.log"
echo " β’ Check NoctisAI: tail -f logs/noctis_mcp.log"
echo " β’ Check HexStrike AI: tail -f /home/yenn/hexstrike-ai/hexstrike_mcp.log"
echo " β’ Restart ecosystem: ./scripts/start_ecosystem.sh"
echo " β’ Stop ecosystem: ./scripts/stop_ecosystem.sh"
echo ""
}
# Function to stop all services
stop_ecosystem() {
print_status "Stopping ecosystem services..."
# Stop NoctisAI
if [ -f "scripts/start_noctis.sh" ]; then
./scripts/start_noctis.sh stop
fi
# Stop Villager AI
if [ -d "/home/yenn/Villager-AI" ]; then
cd /home/yenn/Villager-AI
if [ -f "scripts/start_villager_proper.sh" ]; then
pkill -f "villager_proper_mcp.py" || true
pkill -f "villager_server" || true
fi
cd "$PROJECT_ROOT"
fi
# Stop HexStrike AI
if [ -d "/home/yenn/hexstrike-ai" ]; then
cd /home/yenn/hexstrike-ai
pkill -f "hexstrike_mcp.py" || true
cd "$PROJECT_ROOT"
fi
print_success "All ecosystem services stopped"
}
# Main execution
main() {
# Check if stop command was given
if [ "$1" = "stop" ]; then
stop_ecosystem
exit 0
fi
print_status "Starting complete cybersecurity ecosystem..."
echo ""
# Start all services
start_villager_ai
start_noctis_ai
start_hexstrike_ai
# Wait for services to be ready
wait_for_services
# Display ecosystem status
display_ecosystem_status
print_success "πππ‘οΈ Complete cybersecurity ecosystem is ready!")
print_status "You can now use all three MCP servers in Cursor for comprehensive security operations!"
}
# Run main function
main "$@"