mimic 可捕获任何 iOS 或 Web 应用的流量,并自动生成一个 Python 客户端库,让你像调用普通库一样调用该应用的 API。

Stars

1,183

7 天增长

0

Fork 数

77

开放 Issue

4

开源协议

MIT

最近更新

2026-07-15

为什么值得关注

它利用 mitmproxy、cURL 复制或 HAR 文件,免去逆向私有 API 或手动提取认证令牌的麻烦,并通过 AI 辅助生成类型化的 Python 客户端。

适合谁使用

  • 希望自动化或集成没有公开 API 的移动应用的开发者
  • 分析应用流量和认证流程的安全研究员
  • 需要针对实时应用后端编写端到端测试脚本的质量工程师
  • 希望抓取应用数据而无需编写自定义代理处理程序的数据科学家或爱好者

典型使用场景

  • 自动化约会应用(如 Hinge)的互动,如点赞资料或发送消息
  • 从任何移动应用中提取推荐、信息流或分析数据
  • 为缺乏官方 SDK 或 API 的应用构建自定义集成
  • 出于测试或调试目的重放并修改已认证的请求

项目优势

  • 自动从真实流量中捕获认证令牌、会话 ID 和 Cookie,并在后续调用中重用
  • 通过 Claude 生成可人工编辑的 Python 客户端,包含命名方法和请求体模板
  • 支持三种捕获后端(mitmproxy、cURL、HAR),覆盖 iOS 应用、Web 应用和浏览器开发者工具
  • 对于幂等请求,在遇到 401 时自动从 mitmweb 重新拉取令牌并重试

使用前须知

  • 证书固定(常见于银行应用、Instagram)会阻止流量捕获,但提供了基于 Frida 的绕过方案
  • DPoP/发送者约束令牌完全破坏了重放模型,且没有干净的解决方式
  • 代码生成依赖外部 AI 服务 Claude,可能引入延迟或需要 API 密钥

README 快速开始

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 -> :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
S

项目描述

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

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

Blaizzy
精选
Blaizzy GitHub avatar

nativ

Nativ is a native macOS app that lets you run AI models locally on Apple silicon, offering chat, model management, performance analytics, and an OpenAI/Anthropic-compatible API server.

AI 与机器学习AI 智能体
891
uzairansaruzi
精选
uzairansaruzi GitHub avatar

hermex

Hermex is a native SwiftUI iPhone app that lets you control a self-hosted Hermes AI agent directly from your phone, with no subscriptions, tracking, or third-party relay.

AI 与机器学习移动开发
839
hahhforest
精选
hahhforest GitHub avatar

pi-textbook

A hands-on course that walks through building a Pi-style coding agent from scratch across 15 checkpoints, starting from an offline agent trajectory.

AI 与机器学习大语言模型
332