Skip to main content

MOTIM (Model Over Traffic — Intercept & Manage) - Proxy for capturing, querying, and replaying API traffic

Project description

motim

Model Over Traffic — Intercept & Manage

Browse any website. motim captures every request. Now your AI agent can replay them — auth included.

pip install motim
motim init          # trust CA cert, create config
motim start         # proxy on localhost:8080
# browse normally...
motim search --host api.notion.com
motim replay 42     # exact same request, same cookies, same tokens

What it does

motim runs a local MITM proxy that records full HTTP(S) exchanges — method, URL, headers, cookies, request body, response body — into a local SQLite database (~/.motim/motim.sqlite3).

Then you search, inspect, replay, mutate, diff, and probe those exchanges from the CLI or Python. Auth just works because motim captured the real headers your browser sent.

Who it's for

  • AI agents that need to call authenticated APIs without manual credential wiring
  • Security researchers probing endpoints, diffing responses, finding hidden parameters
  • Developers reverse-engineering undocumented APIs or debugging request flows
  • CTF players replaying complex auth flows

Usage

Search and inspect

motim search --host api.example.com --status 200 --method POST
motim show 42                    # full request + response
motim cat 42                     # just the response body (pipe to jq)
motim cat 42 --request           # just the request body
motim export 42                  # as a runnable curl command
motim endpoints --service notion # discovered endpoint patterns

Replay and mutate

motim replay 42                                          # as-is
motim replay 42 --set-header "x-foo=bar"                 # add/override headers
motim replay 42 --drop-header "authorization"            # strip headers
motim replay 42 --patch-json '{"page_size": 50}'         # patch JSON body
motim replay 42 --transport curl --impersonate chrome    # browser TLS fingerprint

Probe (automated mutation testing)

motim probe 42 \
  --patch-json '{"admin": true}' \
  --patch-json '{"role": "superuser"}' \
  --drop-header "x-csrf-token" \
  --json

Replays a baseline, then each mutation. Diffs every result against the baseline.

Timeline

motim around 42 --window 60      # exchanges ±60s from exchange 42
motim session 42 --gap 120       # session slice (gap-based splitting)
motim diff 42 43                 # diff two exchanges
motim replay-seq 10 11 12 13     # replay a sequence in order

JS endpoint extraction

motim linkfinder --host app.example.com --regex '^/api/'
motim js-endpoints --service example

Extracts API routes from captured JavaScript bundles — finds endpoints before you click the UI path that triggers them.

Everything else

motim services                # list captured services
motim export-yaml notion      # YAML summary export
motim rebuild-index           # rebuild derived indexes
motim doctor                  # health check
motim config show             # view config

Python library

from motim import get, Client, ExchangeDB

# One-liner
r = get("api_notion_com", "/v1/users/me")

# Client
client = Client("notion")
r = client.get("/v1/users/me")

# Direct DB access
with ExchangeDB("~/.motim/motim.sqlite3") as db:
    results = db.search_exchanges(host="api.notion.com", limit=10)

Agent integration

motim ships a skill file so AI agents know how to use it. All commands support --json for machine-readable output.

motim init                  # installs to ~/.claude/skills/motim/ (Claude Code)
motim agents-md             # writes AGENTS.md for Codex, opencode, etc.

Setup

motim init does everything: creates ~/.motim/, generates a mitmproxy CA cert, trusts it in your system keychain, and installs the agent skill.

After motim start, point your browser at localhost:8080. Use SwitchyOmega or set it system-wide.

Config lives at ~/.motim/config.yaml — header profiles, timeouts, domain filters. Run motim config show to see it.

Development

git clone https://github.com/vaibhavk97/motim.git
cd motim
pip install -e ".[dev]"
pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

motim-0.2.0.tar.gz (76.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

motim-0.2.0-py3-none-any.whl (76.2 kB view details)

Uploaded Python 3

File details

Details for the file motim-0.2.0.tar.gz.

File metadata

  • Download URL: motim-0.2.0.tar.gz
  • Upload date:
  • Size: 76.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for motim-0.2.0.tar.gz
Algorithm Hash digest
SHA256 198033c3431e9f966477ebc753d29bd3fd0b3be93ca104810a6694cb12da0e01
MD5 d3f0abfa61fe02f35f003823b8c15f91
BLAKE2b-256 8ebe57df3188f573cbdbf2bee779d4cc750f01226055f767aa0cc418a909d3f0

See more details on using hashes here.

File details

Details for the file motim-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: motim-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 76.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for motim-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e29d29925772a8306a40647279ef6e81116589436cd6b530164f7950c2550f3
MD5 bc52c902cfcfebc19e1d420b345b60db
BLAKE2b-256 a19defd9f32665cbad58bb60aed9ffec41fc3ed249d702a82dc9b9890fa1e47e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page