Cloud, plugins and external integrations
API, RPC, External Portal, and Access Security
KittySploit is not limited to kittyconsole. Programmatic interfaces enable
CI/CD automation, SIEM integration, and AI assistants through MCP. This chapter documents API surface import, REST/XML-RPC exposure, and deployment hardening.
External Ecosystem Overview
Sources Framework Destinations
--------- --------- ------------
openapi.json ----+
graphql.json ----+ +-------------+
traffic.har -----+----> | KittySploit | ----+
| | Framework | |
| +------+------+ +----> kittyapi (REST :5000)
| | |
| api_import +----> kittyrpc (XML-RPC :8888)
| | |
+-- modules/ | +----> kittymcp_server (MCP)
generated/ |
v
api_security.py
(RBAC, tokens, limits)
api_import Command
api_import transforms an API description or traffic capture into KittySploit
modules (scanners, fuzzers) via ApiModuleGenerator.
Syntax
api_import <source_file> [options]
api_import openapi.json
api_import swagger.yaml --type openapi --name internal_api
api_import graphql-introspection.json --type graphql --name internal_graphql
api_import kittyproxy_traffic.har --type traffic --kind scanner
api_import capture.har --type traffic --kind scanner,fuzzer --force
api_import spec.json --preview
Input Types (--type)
openapi | OpenAPI / Swagger JSON or YAML |
graphql | GraphQL introspection JSON |
traffic | HAR, KittyProxy JSON, HTTP request list |
Options
--name--- friendly name for the generated module pack.--kind---scanner,fuzzer, orscanner,fuzzer(default).--module-dir--- output directory for modules (defaultmodules/generated/api).--artifact-dir--- manifests, fixtures, tests (defaultartifacts/api_module_packs).--preview--- normalized inventory without writing files.--force--- overwrite existing files.
Recommended Workflow
- Collect the OpenAPI spec (developer documentation,
http GET /openapi.json) or export traffic via KittyProxy. api_import spec.json --preview--- validate endpoints, verbs, parameters.api_import spec.json --name client_acme_api --force.syncthensearch generated/api--- index the new modules.use <generated_module>; configurerhost, tokens ;run.- Suggested unit tests in output: python -m unittest discover -s artifacts/api_module_packs/<pack>/tests
OpenAPI Example
api_import ./exports/petstore-openapi.json \
--type openapi --name petstore --kind scanner,fuzzer
search petstore
show options
set rhost api.target.local
set ssl true
run
The generated module name depends on the OpenAPI operation IDs and is created under
modules/generated/api/.
GraphQL Example
api_import ./dumps/graphql-introspection.json \
--type graphql --name corp_gql --kind scanner
api_import ./dumps/graphql-introspection.json --preview
The generator normalizes queries and mutations into HTTP test points.
HAR Traffic Example
# From KittyProxy or browser export
api_import ./captures/session-audit.har \
--type traffic --kind scanner --name replay_har
api_import ./captures/kittyproxy-export.json \
--type traffic --force
HAR entries preserve method, URL, headers, and body for replaying targeted probes.
Generated Tree Structure
modules/generated/api/---.pyfiles importable viause.artifacts/api_module_packs/<name>/--- JSON manifest, fixtures,tests/directory.
Version these artifacts in Git for reproducible API audits.
REST Server --- interfaces/api_server.py
ApiServer exposes a unified Flask API: health, authentication, modules, sessions,
pipelines, events, workspaces, registry (optional server mode).
Starting via kittyapi.py
export KITTYSPLOIT_API_KEY="long-random-key"
python kittyapi.py -H 127.0.0.1 -p 5000 -k "KITTYSPLOIT_API_KEY"
python kittyapi.py -H 0.0.0.0 -p 8443 -k "KITTYSPLOIT_API_KEY" -d
-H / --host--- listen interface (default127.0.0.1).-p / --port--- port (default5000).-k / --api-key--- bootstrap key (orKITTYSPLOIT_API_KEYvariable).-m / --master-key--- database encryption unlock.-d / --debug--- Flask debug mode.
Starting from the Main Console
kittysploit --api --api-host 127.0.0.1 --api-port 5000 --api-key "$KITTYSPLOIT_API_KEY"
Identical behavior: the process remains attached to the HTTP server.
Main Endpoints
| Route | Method | Role |
|---|---|---|
/api/health/live | GET | Liveness |
/api/health/ready | GET | Detailed readiness |
/api/openapi.json | GET | Server OpenAPI specification |
/api/docs | GET | Interactive documentation |
/api/auth/token | POST | Bootstrap key → access token exchange |
/api/auth/refresh | POST | Token renewal |
/api/auth/revoke | POST | Revocation |
/api/auth/me | GET | Current principal |
/api/metrics | GET | Metrics (role-dependent) |
/api/modules | GET | Module list |
/api/modules/<path> | GET | Module metadata |
/api/modules/<path>/run | POST | Module execution |
/api/sessions | GET | Active sessions |
/api/sessions/<id> | GET/DELETE | Detail / deletion |
/api/workspaces | GET | Workspace list |
/api/workspaces/<name> | POST | Workspace switch |
Pipeline, events, resources, and registry routes are available if the kernel runtime is loaded.
HTTP Authentication
# 1. Obtain an access token (curl example)
curl -s -X POST http://127.0.0.1:5000/api/auth/token \
-H "Content-Type: application/json" \
-d '{"api_key":"'"KITTYSPLOIT_API_KEY"'"}'
# 2. Authenticated call
curl -s http://127.0.0.1:5000/api/modules \
-H "Authorization: Bearer <access_token>"
# Alternative: direct bootstrap key (depending on configuration)
curl -s http://127.0.0.1:5000/api/health \
-H "X-API-Key: KITTYSPLOIT_API_KEY"
Module Execution via REST
curl -s -X POST http://127.0.0.1:5000/api/modules/auxiliary/scanner/portscan/tcp/run \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"options":{"rhosts":"127.0.0.1","ports":"22,80","threads":"10"}}'
Consult /api/openapi.json for the exact JSON body schema.
CORS
Environment variable KITTYSPLOIT_API_CORS_ORIGINS:
export KITTYSPLOIT_API_CORS_ORIGINS="https://dashboard.client.com"
# or disabled if empty; "*" for explicit wildcard (not recommended in prod)
RPC Server --- interfaces/rpc_server.py
RpcServer exposes an XML-RPC interface for legacy clients, Python scripts, and the internal
MCP layer.
Starting via kittyrpc.py
export KITTYSPLOIT_API_KEY="long-random-key"
python kittyrpc.py -H 127.0.0.1 -p 8888 -k "KITTYSPLOIT_API_KEY"
python kittyrpc.py -H 127.0.0.1 -p 8888 -k "KITTYSPLOIT_API_KEY" -d
Starting from the Console
kittysploit --rpc --rpc-host 127.0.0.1 --rpc-port 8888 --api-key "$KITTYSPLOIT_API_KEY"
RPC Authentication
Each POST request must include:
X-API-Key: <key>
# or
Authorization: Bearer <access_token>
Without a valid key, the handler returns 401 Unauthorized. The server refuses to start if
api_key is empty.
Minimal Python Client
import xmlrpc.client
proxy = xmlrpc.client.ServerProxy(
"http://127.0.0.1:8888",
headers=[("X-API-Key", "your_key")],
allow_none=True,
)
print(proxy.system.listMethods())
# Framework methods: execute_command, list_modules, run_module, etc.
Exact names depend on registration in RpcServer.register_functions();
inspect with system.listMethods().
REST vs RPC --- When to Choose
| Streaming, metrics, rich auth | Bridge to MCP (kittymcp_server) |
| HTTP dashboards | Python xmlrpc.client automation |
Shared Security --- interfaces/api_security.py
api_security.py centralizes authentication, RBAC roles, rate limiting, and token
rotation for ApiServer, RpcServer, and MCP.
Roles and Permissions
operator | viewer + modules:run, commands:execute,
pipelines:write, workspaces:switch, mcp:execute |
admin | * (all permissions) |
Main Components
RotatingTokenManager--- issues access/refresh tokens from the bootstrap key.RequestAuthenticator--- validates Bearer orX-API-Key, resolvesAuthContext.ApiRateLimiter--- sliding windows per tier (public,auth,read,mutate,admin).secrets_equal--- constant-time secret comparison.parse_cors_origins--- parsesKITTYSPLOIT_API_CORS_ORIGINS.
Rate Limiting Tiers (Defaults)
| Tier | Quota | Typical Usage |
|---|---|---|
auth | 20 / 60 s | /api/auth/token |
read | 120 / 60 s | GET modules, sessions |
mutate | 40 / 60 s | POST run, DELETE session |
admin | 15 / 60 s | Sensitive operations |
Token Lifetimes
- Access token: 15 minutes (
DEFAULT_ACCESS_TTL_SECONDS). - Refresh token: 24 hours (
DEFAULT_REFRESH_TTL_SECONDS).
Useful Environment Variables
export KITTYSPLOIT_API_KEY="bootstrap-secret-min-32-chars"
export KITTYSPLOIT_API_CORS_ORIGINS="https://ops.example.com"
# Default roles for bootstrap principal (depending on deployment)
export KITTYSPLOIT_API_ROLES="operator"
Best Practices
- Generate the bootstrap key with
openssl rand -hex 32. - Never commit
KITTYSPLOIT_API_KEYto Git. - Prefer short access token + refresh rather than the bootstrap key on every request.
- Bind
-H 127.0.0.1and place a TLS reverse proxy (nginx, Caddy) if exposing on WAN. - Audit
/api/auth/meafter deployment to verify effective roles.
Error Responses
401 Unauthorized--- invalid or expired key or token.403 Forbidden--- insufficient RBAC permission for the route.429 Too Many Requests--- rate limit exceeded; exponential backoff on client side.
Link with MCP (Model Context Protocol)
MCP reuses the same security model as API and RPC interfaces:
Architecture
[Cursor / IDE / AI Assistant]
|
| MCP (stdio or SSE)
v
kittymcp_server.py
|
| Internal RpcServer (ephemeral port)
v
KittySploit Framework
|
+--> same RBAC / api_security as external RPC
kittymcp_server.py instantiates a local RpcServer to expose MCP tools.
Examples: ks_plan_natural_request, ks_run_module, etc.
Starting MCP (Reminder)
python kittymcp_server.py --host 127.0.0.1 --port 8765 \
--dangerous-consent
Variables:
export KITTYSPLOIT_MASTER_KEY="..."
export KITTYMCP_DANGEROUS_CONSENT=1
Recommended Secure Flow
- MCP plans (
ks_plan_natural_request) ---mcp:readrole. - Human validates target and module.
- MCP executes (
ks_run_module) ---mcp:execute/modules:runrole. - Audit (
ks_mcp_audit).
REST API vs MCP Differences
- REST --- generic integration, CI, orchestrators.
- MCP --- AI assistants, natural language, structured tools for LLMs.
- Both rely on
api_security.pyfor effective permissions.
Use kittymcp_client.py and kittymcp_server.py for MCP client and server configuration.
Integrated Scenario --- Complete API Pipeline
workspace create acme-api-q2 ; workspace use acme-api-q2.scope add api.acme.test.api_import ./specs/acme-openapi.json --name acme --preview.api_import ./specs/acme-openapi.json --name acme --force.sync now.- Terminal 2:
export KITTYSPLOIT_API_KEY=... ; python kittyapi.py -p 5000. - CI: POST
/api/modules/.../runon generated scanners. - Console:
host add api.acme.test ; vuln add ....
CI Scenario --- HAR Import + RPC
- KittyProxy export after manual crawl:
session.har. api_import session.har --type traffic --kind fuzzer --name ci_replay.python kittyrpc.py -k "\$KITTYSPLOIT_API_KEY"as user systemd service.- GitLab pipeline calls
xmlrpcrun_modulewith timeout. - Artifacts: RPC logs +
artifacts/api_module_packs/ci_replay/tests.
Deployment Hardening
Production Checklist
- Bootstrap key: 32 random bytes or more.
- Listen on localhost only or behind VPN.
- TLS terminated by reverse proxy; no
-kon clients. - Minimal role (
viewerfor monitoring,operatorfor run). - Periodic rotation of
KITTYSPLOIT_API_KEY+auth/revoke. - Centralized logs for
401/403/429. - Workspace separation per client before exporting or sharing results.
Anti-patterns
kittyapi.py -H 0.0.0.0without firewall or TLS.- Same API key between dev and production.
--dangerous-consentMCP on laptop without mandate.- Export of out-of-scope data from the workspace.
Access Interface Comparison
| Interface | File / cmd | Use Case |
|---|---|---|
| REST | kittyapi.py | Dashboards, webhooks, OpenAPI |
| XML-RPC | kittyrpc.py | Scripts, MCP, legacy |
| MCP | kittymcp_server.py | AI assistants, IDE |
| API Import | api_import | Module generation |
Cross-Troubleshooting
- ApiServer requires non-empty api_key --- export
KITTYSPLOIT_API_KEYor-k. - Port 5000/8888 in use --- change
-p;ss -tlnp | grep 5000. - Generated module not found ---
sync now; verify--module-dir. - RPC 401 from MCP --- align key between MCP and
kittyrpc. - CORS blocked --- configure
KITTYSPLOIT_API_CORS_ORIGINS.
Related Capabilities
- KittyProxy feeds
api_import --type traffic. - HTTP and GraphQL scanners complement generated modules.
- MCP, collaboration, and plugins expose the same workspace data to other tools.
campaignand reporting commands consume validated findings.httpvalidates endpoints before import.