Environment:0x4m4 Hexstrike ai Flask Server
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Web_Server, API |
| Last Updated | 2026-10-10 00:00 GMT |
Overview
Flask 2.3+ web server environment hosting the HexStrike API with 100+ security tool endpoints, process management, and real-time monitoring.
Description
This environment provides the Flask web framework that serves as the core API server for HexStrike AI. The Flask app exposes 100+ REST endpoints that execute security tools, manage background processes, and return structured JSON results. The server binds to a configurable host and port (default 127.0.0.1:8888) via the HEXSTRIKE_PORT and HEXSTRIKE_HOST environment variables. It also writes logs to hexstrike.log with a fallback to console-only logging on permission errors.
Usage
Use this environment for running the HexStrike Flask server (hexstrike_server.py). Required by the Flask_Tool_Endpoint implementation and all tool execution workflows. The MCP client connects to this server over HTTP.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux (Ubuntu/Debian preferred) | Kali Linux recommended for security tools |
| Hardware | 2+ CPU cores, 4GB RAM | Handles concurrent tool execution via ThreadPoolExecutor |
| Disk | 5GB SSD | For logs, caches, and temporary tool outputs |
| Network | TCP port 8888 (default) | Configurable via HEXSTRIKE_PORT env var |
Dependencies
System Packages
- `python3` >= 3.8
Python Packages
- `flask` >= 2.3.0, < 4.0.0
- `psutil` >= 5.9.0, < 6.0.0
- `requests` >= 2.31.0, < 3.0.0
Credentials
The following environment variables can be set to configure the server:
- `HEXSTRIKE_PORT`: API server port (default 8888)
- `HEXSTRIKE_HOST`: API server bind address (default 127.0.0.1)
- `DEBUG_MODE`: Enable debug mode ("1", "true", "yes", "y" to enable; default "0")
Quick Install
pip install flask>=2.3.0,<4.0.0 psutil>=5.9.0,<6.0.0 requests>=2.31.0,<3.0.0
# Start the server
python3 hexstrike_server.py
Code Evidence
Flask app initialization from `hexstrike_server.py:94-95`:
app = Flask(__name__)
app.config['JSON_SORT_KEYS'] = False
Environment variable configuration from `hexstrike_server.py:98-99`:
API_PORT = int(os.environ.get('HEXSTRIKE_PORT', 8888))
API_HOST = os.environ.get('HEXSTRIKE_HOST', '127.0.0.1')
Debug mode from `hexstrike_server.py:6663`:
DEBUG_MODE = os.environ.get("DEBUG_MODE", "0").lower() in ("1", "true", "yes", "y")
Logging with permission fallback from `hexstrike_server.py:73-90`:
try:
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[
logging.StreamHandler(sys.stdout),
logging.FileHandler('hexstrike.log')
]
)
except PermissionError:
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[logging.StreamHandler(sys.stdout)]
)
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `Address already in use: port 8888` | Another process on port 8888 | Set `HEXSTRIKE_PORT` to a different port |
| `PermissionError` on hexstrike.log | No write permission in CWD | Run from a writable directory |
| `ImportError: No module named 'flask'` | Flask not installed | `pip install flask>=2.3.0` |
Compatibility Notes
- Flask 2.3+: Required for current JSON sorting config and blueprint features.
- Flask 3.x: Supported (upper bound < 4.0.0).
- Binding to 0.0.0.0: Set HEXSTRIKE_HOST=0.0.0.0 for network-accessible server; ensure firewall rules are configured.
- Production deployment: Use a WSGI server (gunicorn/uwsgi) for production; the built-in Flask server is for development.