diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..518bdfd52 --- /dev/null +++ b/.gitignore @@ -0,0 +1,51 @@ +__pycache__/ +*.py[cod] +*.pyo +*.pyd +*.so + +# Virtual environments +venv/ +env/ +hexstrike-env/ +hexstrike_env/ +.venv/ + +# IDE and editor files +.vscode/ +.idea/ +*.swp +*.swo +*.orig + +# OS files +.DS_Store +Thumbs.db +desktop.ini + +# Logs and local output +*.log +logs/ +*.tmp +tmp/ + +# Python packaging / build +build/ +dist/ +*.egg-info/ + +# Tool outputs and cache +.pytest_cache/ +.mypy_cache/ +.ruff_cache/ +.coverage +coverage.xml + +# Docker artifacts +.docker/ + +# Security tool outputs (generic) +output/ +results/ +reports/ + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..6276a5ef6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +# Use Kali Linux as the base image +FROM kalilinux/kali-rolling + +# Prevent interactive prompts +ENV DEBIAN_FRONTEND=noninteractive + +# Update and install Python, pip, and the security tools +RUN apt-get update && apt-get install -y --no-install-recommends \ + # --- ADDED FOR COMPILING PYTHON PACKAGES --- + build-essential \ + python3-dev \ + # ------------------------------------------- + python3 python3-pip python3-venv \ + git curl wget sudo gnupg2 ca-certificates \ + # Network & Recon + nmap masscan amass subfinder nuclei dnsenum \ + # Web App Security + gobuster dirb ffuf nikto sqlmap wpscan \ + # Password & Auth + hydra john hashcat \ + # Binary Analysis + gdb binwalk \ + # Browser requirements + chromium chromium-driver \ + && rm -rf /var/lib/apt/lists/* + +# Set the working directory +WORKDIR /app + +# Copy the repository files into the container +COPY . . + +# Install Python dependencies +RUN pip3 install --no-cache-dir -r requirements.txt --break-system-packages + +# Create a symlink for chromium so the AI agent finds it +RUN ln -s /usr/bin/chromium /usr/bin/google-chrome + +# Expose the MCP server port +EXPOSE 8888 + +# Command to run the server +CMD ["python3", "hexstrike_server.py", "--port", "8888"] \ No newline at end of file diff --git a/__pycache__/hexstrike_mcp.cpython-312.pyc b/__pycache__/hexstrike_mcp.cpython-312.pyc new file mode 100644 index 000000000..c03508277 Binary files /dev/null and b/__pycache__/hexstrike_mcp.cpython-312.pyc differ diff --git a/__pycache__/hexstrike_server.cpython-312.pyc b/__pycache__/hexstrike_server.cpython-312.pyc new file mode 100644 index 000000000..41100112d Binary files /dev/null and b/__pycache__/hexstrike_server.cpython-312.pyc differ diff --git a/hexstrike-ai-mcp.json b/hexstrike-ai-mcp.json index af8616d22..a52eb7a29 100644 --- a/hexstrike-ai-mcp.json +++ b/hexstrike-ai-mcp.json @@ -12,4 +12,4 @@ "alwaysAllow": [] } } -} \ No newline at end of file +} diff --git a/hexstrike_server.py b/hexstrike_server.py index baa5db420..ff4e0af26 100644 --- a/hexstrike_server.py +++ b/hexstrike_server.py @@ -9698,6 +9698,7 @@ def intelligent_smart_scan(): "execution_summary": {}, "combined_output": "" } + combined_output_parts = [] def execute_single_tool(tool_name, target, profile): """Execute a single tool and return results""" @@ -9736,8 +9737,9 @@ def execute_single_tool(tool_name, target, profile): if result.get('success') and result.get('stdout'): # Simple vulnerability detection based on common patterns output = result.get('stdout', '') + output_lower = output.lower() vuln_indicators = ['CRITICAL', 'HIGH', 'MEDIUM', 'VULNERABILITY', 'EXPLOIT', 'SQL injection', 'XSS', 'CSRF'] - vuln_count = sum(1 for indicator in vuln_indicators if indicator.lower() in output.lower()) + vuln_count = sum(1 for indicator in vuln_indicators if indicator.lower() in output_lower) return { "tool": tool_name, @@ -9791,9 +9793,11 @@ def execute_single_tool(tool_name, target, profile): # Combine outputs if tool_result.get("stdout"): - scan_results["combined_output"] += f"\n=== {tool_result['tool'].upper()} OUTPUT ===\n" - scan_results["combined_output"] += tool_result["stdout"] - scan_results["combined_output"] += "\n" + "="*50 + "\n" + combined_output_parts.append(f"\n=== {tool_result['tool'].upper()} OUTPUT ===\n") + combined_output_parts.append(tool_result["stdout"]) + combined_output_parts.append("\n" + "="*50 + "\n") + + scan_results["combined_output"] = "".join(combined_output_parts) # Create execution summary successful_tools = [t for t in scan_results["tools_executed"] if t.get("success")]