Version: 2.0.0
Base URL: http://<host>:<port>/api/v1
Default port: 5000
Interactive docs: http://<host>:<port>/api/v1/docs
OpenAPI spec: http://<host>:<port>/api/v1/openapi.json
# Via the unified launcher
./marble api --port 5000
# Via Python directly
python3 ml/api.py --port 5000 --host 0.0.0.0
# With debug mode
python3 ml/api.py --port 5000 --debugRequirements: pip install flask
Health check endpoint.
Response:
{"status": "ok", "timestamp": 1719480000.0}Version and algorithm count.
Response:
{"version": "2.0.0", "name": "Marble Framework REST API", "algorithms": 126}Full pipeline status including build state, validation/detection results, RL training, and novel generation results.
Response:
{
"version": "2.0.0",
"algorithms_count": 126,
"features_count": 106,
"validation_passed": true,
"detection_passed": true,
"rl_best_reward": 3.5,
"rl_episodes": 100,
"novel_best": {"name": "MBL_GEN_0032", "score": 112.0, "family": "BUMP"},
"mibster_built": true,
"mender_built": true,
"validator_built": true,
"timestamp": 1719480000.0
}List all registered algorithms.
Response:
[
{"name": "MBL_FORLOOP_XOR1", "family": "XOR", "direction": "forward", "key_size": "1BYTE"},
{"name": "MBL_CLASS_BUMP3", "family": "BUMP", "direction": "forward", "key_size": "8BYTE"},
{"name": "MBL_GEN_0032", "family": "BUMP", "direction": "backward", "key_size": "8BYTE"}
]Get details for a specific algorithm.
Parameters:
name(path, required) — Algorithm name, e.g.MBL_FORLOOP_XOR1
Response: Algorithm object or 404 if not found.
Search algorithms by keyword (matches name, family, direction, key_size).
Parameters:
q(query, required) — Search query
Example:
curl "http://localhost:5000/api/v1/algorithms/search?q=XOR"Run the mibster obfuscator on a project directory.
Request body:
{
"project_dir": "/path/to/project",
"output_dir": "/path/to/output",
"shared_dir": "/path/to/Shared",
"dry_run": false
}| Field | Type | Required | Description |
|---|---|---|---|
project_dir |
string | yes | Path to project directory with source files |
output_dir |
string | yes | Output directory for MarbleReceipt.txt |
shared_dir |
string | no | Path to Shared/ directory (default: built-in) |
dry_run |
boolean | no | Preview without modifying files (default: false) |
Example:
curl -X POST http://localhost:5000/api/v1/obfuscate \
-H "Content-Type: application/json" \
-d '{"project_dir":"/home/user/myproject","output_dir":"/tmp/output"}'Run the mender to restore obfuscated source files.
Request body:
{"project_dir": "/path/to/project"}Run the validator to check a compiled binary for plaintext strings.
Request body:
{
"receipt": "/path/to/MarbleReceipt.txt",
"binary": "/path/to/compiled_binary"
}Get extracted AST features from all algorithms (from extract_features.py).
Get the Z3 symbolic validation report.
Get the detection evasion (YARA) report.
Get RL training results and episode history.
Get novel algorithm generation and evaluation results.
Run AST feature extraction on all algorithms.
curl -X POST http://localhost:5000/api/v1/ml/extractRun the Z3 symbolic validation pipeline.
Run detection evasion check (YARA rules).
Generate new algorithms using template/LLM generation.
Request body (all optional):
{
"family": "XOR",
"count": 5,
"direction": "forward",
"key_size": "8BYTE"
}| Field | Type | Default | Options |
|---|---|---|---|
family |
string | "XOR" |
XOR, BUMP, RBUMP, RXOR |
count |
integer | 5 |
1–100 |
direction |
string | — | forward, backward |
key_size |
string | — | 1BYTE, 8BYTE, 16BYTE |
Generate novel algorithms via LoRA-trained model.
Request body (all optional):
{
"count": 10,
"temperature": 0.9,
"model_path": "models/rl_output"
}Run RL training loop.
Request body (all optional):
{
"episodes": 10,
"mode": "lightweight",
"population": 5,
"seed": 42
}| Field | Type | Default | Options |
|---|---|---|---|
episodes |
integer | 10 |
1–1000 |
mode |
string | "lightweight" |
lightweight, full |
population |
integer | 5 |
1–50 |
seed |
integer | 42 |
— |
Generate and inject an algorithm directly into the Marble framework source files.
Request body (all optional):
{
"family": "BUMP",
"direction": "backward",
"key_size": "8BYTE"
}Find and optionally remove structurally duplicate algorithms.
Request body (all optional):
{
"threshold": 0.05,
"remove": false
}Run entropy camouflage / build fingerprint randomization.
Request body:
{
"subcmd": "fingerprint",
"seed": 42,
"input": "obfuscated.cpp",
"output": "camouflaged.cpp"
}| Field | Type | Default | Options |
|---|---|---|---|
subcmd |
string | "fingerprint" |
fingerprint, full |
seed |
integer | — | Random seed |
input |
string | — | Input source file (for full mode) |
output |
string | — | Output file (for full mode) |
List all generated novel algorithms with validation scores.
Response:
[
{
"name": "MBL_GEN_0032",
"family": "BUMP",
"novel_mode": "position_dep",
"direction": "backward",
"score": 112.0,
"overall_passed": true
}
]Get full details of a novel algorithm including source code and validation report.
Parameters:
name(path, required) — Algorithm name, e.g.MBL_GEN_0032
List all TTL receipts.
Response:
[
{"name": "receipt_001.ttl", "size": 1024},
{"name": "receipt_002.ttl", "size": 2048}
]Remove expired receipts.
Response:
{"success": true, "message": "Cleaned up 3 expired receipts", "removed": 3}Returns the full OpenAPI 3.0 specification as JSON.
Returns an interactive HTML documentation page with all endpoints, parameters, and curl examples.
All errors return JSON with an error field:
{"error": "Algorithm 'MBL_FOO' not found"}| Status | Description |
|---|---|
| 200 | Success |
| 400 | Bad request (missing required parameters) |
| 404 | Resource not found |
| 500 | Internal server error |
import requests
BASE = "http://localhost:5000/api/v1"
# Get status
r = requests.get(f"{BASE}/status")
print(r.json())
# List algorithms
r = requests.get(f"{BASE}/algorithms")
for alg in r.json():
print(alg["name"], alg["family"])
# Obfuscate a project
r = requests.post(f"{BASE}/obfuscate", json={
"project_dir": "/home/user/myproject",
"output_dir": "/tmp/output"
})
print(r.json())
# Generate novel algorithms
r = requests.post(f"{BASE}/ml/novel-generate", json={
"count": 10,
"temperature": 0.9
})
print(r.json())
# Run RL training
r = requests.post(f"{BASE}/ml/rltrain", json={
"episodes": 50,
"mode": "lightweight"
})
print(r.json())The REST API (api.py) and the web dashboard (dashboard.py) are separate servers:
| Server | Port | Purpose |
|---|---|---|
api.py |
5000 | REST API for programmatic access |
dashboard.py |
8080 | Web UI for visual monitoring |
They can run simultaneously. The dashboard also has its own built-in API endpoints at /api/ for the UI buttons.