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.1.tar.gz (65.4 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.1-py3-none-any.whl (73.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: motim-0.2.1.tar.gz
  • Upload date:
  • Size: 65.4 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.1.tar.gz
Algorithm Hash digest
SHA256 5bd45a22fa8e5d27e239f932838cafa88e9aabb2499be4369a7e813047db7f51
MD5 58799800439e056fe5d51bb1658688c7
BLAKE2b-256 cc8b9e22a6641bd74c75c345f179168c14cd25693793c1004b14613a6b5476a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: motim-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 73.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 37013f8c37d9cd81faa3bd66bfa4227fa330cc58c63fe456a2035d58df0fc616
MD5 f544ed0cebd60a92a0395892daf38bc5
BLAKE2b-256 9be7fc064590872075ff2240e05ef645131b5c1133e1928b56c0da3fdae3ad85

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