{"id":13490858,"url":"https://github.com/wuchangming/spy-debugger","last_synced_at":"2025-05-13T23:07:40.670Z","repository":{"id":39831751,"uuid":"49316177","full_name":"wuchangming/spy-debugger","owner":"wuchangming","description":"微信调试，各种WebView样式调试、手机浏览器的页面真机调试。便捷的远程调试手机页面、抓包工具，支持：HTTP/HTTPS，无需USB连接设备。","archived":false,"fork":false,"pushed_at":"2023-01-11T01:05:48.000Z","size":6969,"stargazers_count":7584,"open_issues_count":108,"forks_count":838,"subscribers_count":148,"default_branch":"master","last_synced_at":"2025-05-05T09:35:10.666Z","etag":null,"topics":["debug","spy-debugger","wechat","weinre"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wuchangming.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":"spy-debugger","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2016-01-09T08:01:32.000Z","updated_at":"2025-05-05T02:47:01.000Z","dependencies_parsed_at":"2023-02-08T21:15:47.313Z","dependency_job_id":null,"html_url":"https://github.com/wuchangming/spy-debugger","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuchangming%2Fspy-debugger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuchangming%2Fspy-debugger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuchangming%2Fspy-debugger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuchangming%2Fspy-debugger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wuchangming","download_url":"https://codeload.github.com/wuchangming/spy-debugger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252591057,"owners_count":21773017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debug","spy-debugger","wechat","weinre"],"created_at":"2024-07-31T19:00:51.579Z","updated_at":"2025-05-13T23:07:35.649Z","avatar_url":"https://github.com/wuchangming.png","language":"JavaScript","readme":"关于spy-debugger\n==========\n一站式页面调试、抓包工具。远程调试任何手机浏览器页面，任何手机移动端webview（如：微信，HybridApp等）。支持HTTP/HTTPS，无需USB连接设备。  \n\n[![npm](https://img.shields.io/npm/v/spy-debugger.svg)](https://www.npmjs.com/package/spy-debugger)\n[![npm](https://img.shields.io/npm/dt/spy-debugger.svg)](https://www.npmjs.com/package/spy-debugger)\n[![Build Status](https://travis-ci.org/wuchangming/spy-debugger.svg?branch=master)](https://travis-ci.org/wuchangming/spy-debugger)  \n\nLanguage: [English](README_EN.md)\n\n特性\n------------\n\u003e  \n1、页面调试＋抓包  \n2、[操作简单](#三分钟上手)，无需USB连接设备   \n3、**支持HTTPS**。  \n4、`spy-debugger`内部集成了[`weinre`](http://people.apache.org/~pmuellr/weinre/docs/latest/)、[`node-mitmproxy`](https://github.com/wuchangming/node-mitmproxy)、[`AnyProxy`](https://github.com/alibaba/anyproxy)。  \n5、自动忽略原生App发起的https请求，只拦截webview发起的https请求。对使用了SSL pinning技术的原生App不造成任何影响。【PS：由于 `iOS 15` 调整代理协议，`iOS 15` 已无法检测请求是否浏览器发起】  \n6、可以配合其它代理工具一起使用(默认使用AnyProxy) [(设置外部代理)](#设置外部代理默认使用anyproxy)  \n\n\n使用案例\n------------\n#### 页面编辑模式\n\u003e  \n启动命令：`spy-debugger -w true`  \n\u003cimg src=\"demo/img/spy-debugger-w.gif\" width=\"300px\" /\u003e\n\n#### weiner页面调试界面\n\u003e  \n\u003cimg src=\"demo/img/demo.png\" width=\"600px\" /\u003e\n\n#### anyproxy抓包界面\n\u003e  \n\u003cimg src=\"demo/img/AnyProxy.png\" width=\"600px\" /\u003e\n\n\n\n\n安装\n------------\nWindows 下\n```\n    npm install spy-debugger -g\n```\n\nMac 下\n```\n    sudo npm install spy-debugger -g\n```\n\n## 三分钟上手\n\u003e  \n第一步：手机和PC保持在同一网络下（比如同时连到一个Wi-Fi下）\n\u003e  \n第二步：命令行输入`spy-debugger`，按命令行提示用浏览器打开相应地址。\n\u003e  \n第三步：设置手机的HTTP代理，代理IP地址设置为PC的IP地址，端口为`spy-debugger`的启动端口(默认端口：9888)。\n- Android设置代理步骤：`设置 - WLAN - 长按选中网络 - 修改网络 - 高级 - 代理设置 - 手动`  \n- iOS设置代理步骤：`设置 - 无线局域网 - 选中网络 - HTTP代理手动`  \n\u003e  \n第四步：手机安装证书。**注：手机必须先设置完代理后再通过(非微信)手机浏览器访问`http://s.xxx`[`(地址二维码)`](demo/img/QRCodeForCert.png)安装证书**（手机首次调试需要安装证书，已安装了证书的手机无需重复安装)。[iOS新安装的证书需要手动打开证书信任](https://github.com/wuchangming/spy-debugger/issues/42)\n\u003e  \n第五步：用手机浏览器访问你要调试的页面即可。\n\n自定义选项\n------------\n#### 端口\n\u003e  \n(默认端口：9888)\n```\nspy-debugger -p 8888\n```\n\n#### 设置外部代理（默认使用AnyProxy）\n\u003e  \n```\nspy-debugger -e http://127.0.0.1:8888\n```\nspy-debugger内置AnyProxy提供抓包功能，但是也可通过设置外部代理和其它抓包代理工具一起使用，如：Charles、Fiddler。\n\n#### 设置页面内容为可编辑模式\n\u003e  \n该功能使页面内容修改更加直观方便。\n(默认： false)\n```\nspy-debugger -w true\n```\n内部实现原理：在需要调试的页面内注入代码：`document.body.contentEditable=true`。暂不支持使用了iscroll框架的页面。\n\n#### 是否允许weinre监控iframe加载的页面\n\u003e  \n(默认： false)\n```\nspy-debugger -i true\n```\n\n#### 是否只拦截浏览器发起的https请求 【PS：由于 `iOS 15` 调整代理协议，已无法检测请求是否浏览器发起】\n\u003e  \n(默认： false)\n```\nspy-debugger -b true\n```\n有些浏览器发出的connect请求没有正确的携带userAgent，这个判断有时候会出错，如**UC浏览器**。这个时候需要设置为false。大多数情况建议启用默认配置：true，由于目前大量App应用自身（非WebView）发出的请求会使用到SSL pinning技术，自定义的证书将不能通过app的证书校验。\n\n#### 是否允许HTTP缓存\n\u003e  \n(默认： false)\n```\nspy-debugger -c true\n```\n\n更多\n------------\n- 修复`weinre`在`node.js` V7版本会崩溃的bug\n\n- 对`weinre`在页面`document ready`事件前，无法打印console.log日志进行了增强修复。\n\n- 增强`weinre`打印未捕获异常(Uncaught Exceptions)功能。\n\n- `spy-debugger`原理是集成了`weinre`，简化了`weinre`需要给每个调试的页面添加js代码。`spy-debugger`原理是拦截所有html页面请求注入`weinre`所需要的js代码。让页面调试更加方便。\n","funding_links":["https://opencollective.com/spy-debugger"],"categories":["JavaScript","7. 调试","Uncategorized","JavaScript (485)","优质仓库"],"sub_categories":["7.2 web调试","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwuchangming%2Fspy-debugger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwuchangming%2Fspy-debugger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwuchangming%2Fspy-debugger/lists"}