mimic README

The project's README from github.com/littledivy/mimic. As one markdown file: README.md.

mimic

Intercept any app, then call it from Python like a library.

from hinge_client import Hinge

acc = Hinge()                 # reuses your captured session
recs = acc.get_recommendations()
acc.like(subject_id, comment="hi lol")

You don't write hinge_client.py. mimic captures your own app traffic and an AI generates the client from it.

How it works

Most apps authenticate every request with the same bundle of values: a bearer token, some device ids, a session id, cookies. They're stable across calls. Capture them once from a real request you made, and you can replay them on new requests to the same API.

capture traffic   ->   extract auth   ->   generate client
  (mitmproxy)         (mimic.Session)      (claude reads the
                                            captured endpoints)

The generated client is plain Python on top of mimic.App, and you edit it like any other file. It gives you named methods, body templates, and the multi-step call chaining mobile APIs tend to need (fetch a token in one call, spend it in the next).

Install

sh install.sh

Installs uv if you don't have it, then mimic in an isolated tool env. mitmproxy isn't a separate install; mimic launches it via uvx on first record. (Manual: uv tool install mimic-client.)

mimic doctor                    # confirm proxy + claude are ready

Use it (iPhone)

mimic record                    # starts the proxy, prints the iPhone steps

record fills in your Mac's LAN IP and walks you through it:

  1. iPhone -> Wi-Fi -> Configure Proxy -> Manual -> <your-mac-ip>:8080
  2. Safari -> http://mitm.it -> install the Apple profile
  3. Settings -> General -> About -> Certificate Trust Settings -> turn on full trust for mitmproxy. This step is easy to miss and nothing works without it.
  4. open the app, use it normally

Then:

mimic hosts                     # list captured hosts; pick your API host
mimic learn  prod-api.hingeaws.net    # see the endpoints mimic saw
mimic gen    prod-api.hingeaws.net    # generate hinge_client.py

Then from hinge_client import Hinge; Hinge().get_recommendations().

The library

Three ways to build a session by hand, if you don't want codegen:

from mimic import Session

Session.from_mitm("prod-api.hingeaws.net")        # pull auth from mitmweb
Session.from_curl(open("copied.txt").read())      # paste "Copy as cURL" from devtools
Session(base_url="https://x.com", headers={...})  # explicit

.get(path), .post(path, json=...), and the other common HTTP verb helpers return parsed JSON and raise requests.HTTPError for failed responses. If your token rotates, a 401 on an idempotent request triggers one re-pull from mitmweb and a retry. Non-idempotent requests are not retried unless you explicitly pass refresh=True.

Capture backends

Limitations

Two auth schemes get in the way, for different reasons:

If mimic hosts shows the app's API host, you're good.

Ethics

Use it on your own accounts and data. It replays your session; it is not a tool for accessing anyone else's. Respect each app's terms of service.

License

MIT, see LICENSE. Provided as-is, no warranty. Use on your own accounts and data; you are responsible for complying with each app's terms.

mimic (littledivy/mimic)

Searching Database…

2.8K ·GitHub
What is this?mimic intercepts traffic from any app (mobile or web) and turns it into a plain Python client you can call like a library — you capture one real request and an AI generates the named methods for you instead of you writing them by hand.
Is this a CLI tool, a Python library, or both?Both: the mimic CLI records traffic and generates a client file, and that generated file is plain Python built on mimic.App that you import and edit like any normal module.
How do I install mimic and start capturing traffic?The installer sets up uv if you don't have it and installs mimic into an isolated tool env (or run `uv tool install mimic-client` manually); mitmproxy is launched automatically via uvx the first time you record, so there's no separate mitmproxy install step.
Do I need to install mitmproxy myself before recording?No — mimic launches mitmproxy for you via uvx on first record, you just need to point your iPhone's proxy settings at your Mac and trust the mitmproxy certificate.
Does mimic work on apps that use certificate pinning or rotating DPoP tokens?Certificate pinning (banking apps, Instagram) blocks capture because the app rejects the mitmproxy cert, but mimic ships a Frida-based 'unpin' bypass for that. DPoP / sender-constrained tokens are a dead end: each request carries a fresh proof signed by a key that never leaves the device, so captured requests simply don't replay.
Can I capture traffic from web apps too, or only iOS?iOS apps go through mitmproxy by default, but for web apps you can skip the proxy entirely: copy a request as cURL from devtools into Session.fromcurl(), or export a HAR file from the browser's Network tab and run mimic against it.
Is it okay to point mimic at any app's traffic?mimic is meant for replaying your own session on your own account, not for accessing someone else's data, and you're expected to follow each app's terms of service.
What happens if my auth token rotates mid-session?A 401 on an idempotent request triggers one automatic re-pull from mitmweb and a retry. Non-idempotent requests (like POSTs) are only retried if you explicitly pass refresh=True.
Can I build a client by hand instead of using the AI codegen?Yes — mimic.App exposes .get(), .post() and other HTTP verb helpers that return parsed JSON and raise requests.HTTPError on failure, so you can assemble a session manually without generating any code.
What does `mimic unpin` do?It sets up a Frida-based bypass for apps that use certificate pinning, so the mitmproxy certificate can be trusted and traffic becomes visible for capture.
Why use mimic instead of reverse-engineering the API myself?Most mobile APIs reuse the same stable bundle (bearer token, device IDs, session ID) across calls; mimic captures that once from a real request and has an AI generate named methods and multi-step call chains, skipping the manual reverse-engineering work.
What are similar projects?captcha-api, httpx, frida, bettercap, httpx, badnotes, evilginx2, ipatool
Creator
littledivy
Size
0.1 MB
Stars
2.8K
Updated
CommitJul 26
Age
3mo
Commits · 90 Days