Python SDK for CAT Session behavioral security API
Project description
cat-session-sdk
Python SDK for CAT Session — behavioral session verification without ML, training data, or retraining.
Install
pip install cat-session-sdk
Quick start
from cat_session_sdk import CATClient
cat = CATClient(api_key="your_key") # get key at session.artrofimov.xyz
score = cat.score(
entity_id="user_123",
endpoint="/api/payment",
status_code=200,
)
if score and score.alert:
print(score.which_channel)
# "behavioral drift detected" → session hijack, insider
# "population deviation detected" → credential stuffing, bot
Middleware (score every request)
from fastapi import FastAPI, Request
from cat_session_sdk import CATClient
import asyncio
app = FastAPI()
cat = CATClient(api_key="your_key")
@app.middleware("http")
async def cat_middleware(request: Request, call_next):
response = await call_next(request)
user_id = request.headers.get("x-user-id")
if user_id:
asyncio.create_task(cat.score(
entity_id=user_id,
endpoint=str(request.url.path),
status_code=response.status_code,
error=response.status_code >= 400,
))
return response
Enterprise log adapters
from cat_session_sdk import CATClient
from cat_session.adapters.okta import stream_okta_log
cat = CATClient(api_key="your_key")
for event in stream_okta_log("okta_export.json"):
score = cat.score(
entity_id=event.entity_id,
endpoint=event.endpoint,
status_code=event.status_code,
error=event.error,
timestamp_ms=event.timestamp_ms,
)
if score and score.alert:
print(f"{event.entity_id}: {score.which_channel}")
Adapters included: okta, cloudtrail, windows_evtx
SessionScore fields
| Field | Type | Description |
|---|---|---|
| score | float 0–1 | Session health. Below 0.55 triggers alert. |
| alert | bool | True if action required. |
| regime | str | normal · transition · breakdown · anomalous |
| which_channel | str | What fired the alert. |
| events_scored | int | Total events processed for this entity. |
Convenience properties: score.behavioral_rhythm, score.access_pattern, score.request_outcome, score.navigation_consistency
Get an API key
Free tier — 10,000 events/month, no credit card required. → session.artrofimov.xyz/session/signup
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cat_session_sdk-1.2.2-py3-none-any.whl.
File metadata
- Download URL: cat_session_sdk-1.2.2-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc056a273e460d4c1e8b56f31e5468bd2d1032b9d443385c8840c8fb6a89df29
|
|
| MD5 |
10ba8641e9b64030ba6c760472d8be03
|
|
| BLAKE2b-256 |
5e886a773873388223726bca0904d5e4bd8edf6a33dc27fd0521c04af870cc30
|