GitHub - littledivy/mimic: Intercept any app, then call it from Python like a library

Open original

mimic is a tool that intercepts mobile app API traffic, extracts authentication credentials, and uses Claude to generate Python client libraries you can call directly. You capture real requests from your phone, and it handles the auth reuse and multi-step call chaining automatically.

  • Captures app traffic via mitmproxy, extracts stable auth tokens (bearer tokens, session IDs, device IDs), then generates a working Python client without writing boilerplate
  • The generated client handles token rotation — on a 401 from an idempotent request, it re-pulls auth from the captured session and retries automatically
  • Works around certificate pinning with Frida-based unpinning, but can't bypass DPoP sender-constrained tokens since those require fresh signatures per request

Mimic is a tool that lets you turn any app's API into a Python library without writing the client code yourself. You run it against your phone's traffic, it captures the authentication credentials (bearer tokens, session IDs, cookies—whatever the app uses), and Claude generates a working Python client from the captured endpoints. The result is plain Python code you can edit like any other file, with named methods and support for the multi-step call chains that mobile APIs often require. Installation is straightforward: `uv tool install mimic-client`, then you set up mitmproxy as an HTTPS proxy on your phone, install its certificate, use the app normally, and mimic extracts everything it needs. The workflow is capture-extract-generate. You point your iPhone to your Mac's mitmproxy instance on port 8080, install the mitmproxy certificate and enable full trust in iOS settings (easy to miss), then use the app. Mimic reads mitmproxy's JSON flow data and shows you which API hosts it saw. You pick your target host, run `mimic gen`, and get a client file. The underlying Session class handles HTTP verbs, parses JSON responses, raises errors on failures, and can even auto-refresh expired tokens on retryable requests. Three capture methods exist: mitmproxy for iOS apps, copy-paste cURL from browser devtools, or HAR files from Chrome/Firefox network tabs—no proxy setup needed for the last two. Two auth schemes break the model. Certificate pinning (used by banking apps and Instagram) blocks the proxy from seeing traffic in the first place; mimic has a Frida-based bypass for this, but it's extra work. DPoP tokens are worse—each request gets signed with a fresh proof from a private key that never leaves the device, so captured requests won't replay at all, and there's no workaround. The tool is meant for your own accounts on services you use; it's not for accessing other people's data, and you're responsible for staying within each app's terms of service.

Ask about this article