claude-ipcheck 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. claude_ipcheck-0.2.0/LICENSE +201 -0
  2. claude_ipcheck-0.2.0/PKG-INFO +131 -0
  3. claude_ipcheck-0.2.0/README.md +107 -0
  4. claude_ipcheck-0.2.0/pyproject.toml +43 -0
  5. claude_ipcheck-0.2.0/setup.cfg +4 -0
  6. claude_ipcheck-0.2.0/src/claude_ipcheck.egg-info/PKG-INFO +131 -0
  7. claude_ipcheck-0.2.0/src/claude_ipcheck.egg-info/SOURCES.txt +40 -0
  8. claude_ipcheck-0.2.0/src/claude_ipcheck.egg-info/dependency_links.txt +1 -0
  9. claude_ipcheck-0.2.0/src/claude_ipcheck.egg-info/entry_points.txt +2 -0
  10. claude_ipcheck-0.2.0/src/claude_ipcheck.egg-info/top_level.txt +1 -0
  11. claude_ipcheck-0.2.0/src/ipcheck/__init__.py +3 -0
  12. claude_ipcheck-0.2.0/src/ipcheck/__main__.py +3 -0
  13. claude_ipcheck-0.2.0/src/ipcheck/checks/__init__.py +1 -0
  14. claude_ipcheck-0.2.0/src/ipcheck/checks/claude.py +80 -0
  15. claude_ipcheck-0.2.0/src/ipcheck/checks/claude_route.py +76 -0
  16. claude_ipcheck-0.2.0/src/ipcheck/checks/cloudflare.py +25 -0
  17. claude_ipcheck-0.2.0/src/ipcheck/checks/direct.py +47 -0
  18. claude_ipcheck-0.2.0/src/ipcheck/checks/dns.py +16 -0
  19. claude_ipcheck-0.2.0/src/ipcheck/checks/ipv6.py +100 -0
  20. claude_ipcheck-0.2.0/src/ipcheck/checks/local.py +88 -0
  21. claude_ipcheck-0.2.0/src/ipcheck/checks/locations.py +61 -0
  22. claude_ipcheck-0.2.0/src/ipcheck/checks/network.py +190 -0
  23. claude_ipcheck-0.2.0/src/ipcheck/checks/proxy.py +29 -0
  24. claude_ipcheck-0.2.0/src/ipcheck/checks/region.py +104 -0
  25. claude_ipcheck-0.2.0/src/ipcheck/checks/reputation.py +40 -0
  26. claude_ipcheck-0.2.0/src/ipcheck/checks/route.py +89 -0
  27. claude_ipcheck-0.2.0/src/ipcheck/checks/timezone.py +103 -0
  28. claude_ipcheck-0.2.0/src/ipcheck/cli.py +50 -0
  29. claude_ipcheck-0.2.0/src/ipcheck/core/__init__.py +1 -0
  30. claude_ipcheck-0.2.0/src/ipcheck/core/models.py +53 -0
  31. claude_ipcheck-0.2.0/src/ipcheck/core/privacy.py +31 -0
  32. claude_ipcheck-0.2.0/src/ipcheck/core/runner.py +117 -0
  33. claude_ipcheck-0.2.0/src/ipcheck/core/summary.py +281 -0
  34. claude_ipcheck-0.2.0/src/ipcheck/data/claude_regions.json +28 -0
  35. claude_ipcheck-0.2.0/src/ipcheck/output/__init__.py +1 -0
  36. claude_ipcheck-0.2.0/src/ipcheck/output/progress.py +83 -0
  37. claude_ipcheck-0.2.0/src/ipcheck/output/render.py +693 -0
  38. claude_ipcheck-0.2.0/src/ipcheck/platforms/__init__.py +1 -0
  39. claude_ipcheck-0.2.0/src/ipcheck/platforms/system.py +91 -0
  40. claude_ipcheck-0.2.0/src/ipcheck/platforms/tunnel.py +113 -0
  41. claude_ipcheck-0.2.0/src/ipcheck/providers/__init__.py +1 -0
  42. claude_ipcheck-0.2.0/src/ipcheck/providers/http.py +100 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: claude-ipcheck
3
+ Version: 0.2.0
4
+ Summary: Evidence-based Claude AI IP risk, proxy, DNS and timezone diagnostics
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/MrLeihe/ipcheck
7
+ Project-URL: Repository, https://github.com/MrLeihe/ipcheck
8
+ Project-URL: Issues, https://github.com/MrLeihe/ipcheck/issues
9
+ Keywords: claude,anthropic,ip,proxy,dns,timezone,diagnostics,cli
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: MacOS
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: System :: Networking
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Dynamic: license-file
24
+
25
+ # ipcheck
26
+
27
+ 命令行 Claude AI IP 风险检测工具。观测普通检测服务、Cloudflare 与 Claude 官方域名的出口,采集本机代理、DNS、时区与 Claude 端点配置,输出带证据的风险因子和调整建议。
28
+
29
+ 浏览器指纹、WebRTC、DNS 泄露属于浏览器侧检测,本工具不重复实现,请访问 <https://ip.net.coffee/claude/>。
30
+
31
+ ## 安装
32
+
33
+ - Python 3.11+;运行时没有第三方依赖。
34
+ - 首版重点验证 macOS;Linux 有部分配置适配,Windows 未覆盖项会单独标注。
35
+
36
+ 从 PyPI 安装(推荐用 pipx 隔离环境):
37
+
38
+ ```bash
39
+ pipx install claude-ipcheck
40
+ ```
41
+
42
+ 用 pip 安装到当前环境:
43
+
44
+ ```bash
45
+ python -m pip install claude-ipcheck
46
+ ```
47
+
48
+ 安装后直接执行:
49
+
50
+ ```bash
51
+ ipcheck --help
52
+ ipcheck --json
53
+ ```
54
+
55
+ 从源码开发:
56
+
57
+ ```bash
58
+ git clone https://github.com/MrLeihe/ipcheck.git
59
+ cd ipcheck
60
+ python3 -m venv .venv
61
+ source .venv/bin/activate
62
+ python -m pip install -e . --no-build-isolation
63
+ ./ipcheck --help
64
+ ```
65
+
66
+ 分发包名为 `claude-ipcheck`,安装后的命令为 `ipcheck`。
67
+
68
+ ## 命令
69
+
70
+ ```bash
71
+ ipcheck # 终端报告
72
+ ipcheck --details # 展开每项检测的证据与脱敏原始数据
73
+ ipcheck --json # 脱敏 JSON
74
+ ipcheck --local # 仅本地配置摘要,不请求外部检测服务
75
+ ipcheck --full # 网络 + 显式本地检查
76
+ ipcheck --reputation # 查询 Claude 出口类型与信誉(默认开启)
77
+ ipcheck --no-reputation # 关闭第三方类型与信誉查询
78
+ ipcheck --timeout 6 # 每次网络请求的超时秒数,范围 1–15
79
+ ipcheck --output report.json # 保存 JSON,仅创建新文件,不覆盖原文件
80
+ ```
81
+
82
+ ## 终端报告
83
+
84
+ 默认报告分三部分:结论置顶、分区主体、固定页脚。
85
+
86
+ 1. **综合结论**:结论文案与待确认项数量、类别。
87
+ 2. **Claude 出口**:网页/API 共用出口时合并为一块;分别列出 IP、国家/地区、城市、运营商、ASN、Claude 支持地区、出口时区与响应耗时。
88
+ 3. **安全检测**:IP 类型(住宅/机房/商业/移动)、信誉评分、代理标记、VPN/Tor/爬虫标记、公开举报记录。
89
+ 4. **出口对比**:本机直连、代理出口、Cloudflare 出口与一致性说明。
90
+ 5. **本机配置**:环境变量代理、系统代理、TUN/VPN、本地 DNS、IPv6 配置与出口提示。
91
+ 6. **时区一致性**:系统、CLI 与 Claude 出口时区,以及一致性判断。
92
+ 7. **Claude API 配置**:当前进程环境变量与用户 settings 中的端点。
93
+ 8. **检测建议**:按优先级(高/中/低)排序的结构化建议。
94
+
95
+ 颜色只在交互终端启用:绿色表示已确认正常,黄色表示需核对或建议,红色表示高风险或冲突,灰色表示已跳过或未验证。退出码、`NO_COLOR` 与 `TERM=dumb` 的规则保持不变。窄于 56 列时自动退化为单列。
96
+
97
+ `--details` 使用同一份报告,追加每项的来源、证据与脱敏 `data`。`--json` 输出完整脱敏报告。
98
+
99
+ 退出码与 `summary.level` 一致:`0` = `clear`,`1` = `attention`,`2` = `incomplete` 或操作失败,`130` = 用户中止。这些不是平台账号安全等级。
100
+
101
+ ## 检测与隐私边界
102
+
103
+ - 本机直连公网 IP 默认通过 `https://4.ipw.cn/` 与 `https://myip.ipip.net/` 交叉查询,明确禁用系统和环境 HTTP 代理,不修改设置;两项服务会看到该次直连的公网来源 IP。它仍受 TUN/VPN、透明网关和运营商 NAT 影响,不能保证是绕过一切代理的运营商原始 IP。单源成功标记未完成交叉验证,来源不一致保留两者,全部失败不使用代理出口替代。`--local` 不执行此查询。
104
+ - 默认网络检查访问 ipify、icanhazip、AWS Check IP、`www.cloudflare.com/cdn-cgi/trace`、ipwho.is,以及 `api.anthropic.com/cdn-cgi/trace` 和 `claude.ai/cdn-cgi/trace`。三个 trace 接口只接收匿名 HTTPS GET,不调用模型,不发送 API Key、Cookie 或登录凭证。各服务会看到对应请求的出口 IP;ipwho.is 会收到指定的观测 IP。
105
+ - 默认将 Claude 网页/API 探测到的 IP 发送至 proxycheck.io 与 StopForumSpam 查询类型、信誉和举报记录,相同 IP 复用结果;可用 `--no-reputation` 关闭。关闭后结论标记为不完整,并给出单独建议,不再逐路重复提示。
106
+ - Claude 支持地区来自 Anthropic 公布的 [Supported Regions Policy](https://www.anthropic.com/supported-countries),按出口 IP 的国家代码比对,数据文件记录政策生效日期与核对日期。已列国家的属地与依赖地区按政策视为支持,通过母国代码判定;`XX`、`T1` 等非国家占位码保留为未知。未列出的国家或地区不受支持;这是服务可用范围,不是账号风险评级。
107
+ - 响应耗时是 DNS、TLS 与首字节的总耗时,受代理和多条网络路径影响,不代表 Claude 服务可用性或 SLA。
108
+ - 出口对比只比较各路径各自观测到的结果。直连与代理路径不同属于预期;只有 Claude 网页与官方 API 互相不一致时才提示核对域名分流,不推断泄露。
109
+ - 所有外部查询使用 HTTPS、响应大小限制和超时。出口观测遵循当前进程/系统可识别的代理配置,不保证与其他应用或运行中会话的路径相同。
110
+ - IP 归属查询默认遵循代理;失败后仅对 ipwho.is 的指定公网 IP 查询尝试直连,并在报告记录 `lookup_route`。回退查询的仍是原先观测 IP,不替换出口观测、不修改分流规则。
111
+ - Claude 探测固定官方 API/网页域名,用以识别当前进程的域名分流。自定义中转、进程/用户代理规则或已登录客户端可能采用其他路径;trace 被阻止或缺字段时保留为未知。Cloudflare `colo` 是服务节点位置,不用来推断用户出口时区。
112
+ - IPv6 分开显示“本机 IPv6 配置”“本机 IPv6 地址”“IPv6 出口探测”。macOS 配置通过 IPv4 默认路由定位网络服务,再读取 `networksetup -getinfo`;只对该服务明确返回 Off 时显示“已关闭”。接口检查只保留计数和接口名,不输出原始 IP/MAC。
113
+ - IPv6 出口探测并发查询 `api6.ipify.org` 与 `ipv6.icanhazip.com`,任一来源返回有效公网 IPv6 即记录可达及地址。探测遵循当前系统/进程代理;本机即使关闭 IPv6,仍可能经 IPv4 连接代理,由代理访问 IPv6 目标。探测失败不证明本机已关闭,成功也不等于泄露。检测到 IPv6 出口时只提示确认代理是否同时覆盖 IPv4 与 IPv6。
114
+ - “Claude API 配置”检查当前进程环境和用户配置;未找到地址时显示“未发现覆盖,默认使用官方 API”,默认行为不代表已确认运行中客户端的实际地址;自定义地址显示域名和“自定义 API,需确认服务商”;不覆盖项目级、受管配置或运行中进程。只输出主机,不输出 URL 凭据、路径或查询参数。
115
+ - DNS 只读取系统配置的解析器地址,不是实际递归解析路径;本工具不做主动 DNS 泄露测试。
116
+ - 系统代理仅在 macOS 读取启用类型;TUN/VPN 按系统 VPN 连接与常见隧道接口路由识别,已开启不代表覆盖所有流量。
117
+ - `--local` 只返回变量名、行号、配置存在性和身份比对数量。不会输出配置原文、邮箱、UUID、API Key 或 Token,不访问钥匙串明文、Cookie 内容和会话文本。
118
+ - JSON 包含 IP 等网络环境信息;分享前仍应根据用途检查这些信息。
119
+ - 报告不保证账号安全、不预测封号,不自动修改代理、删除配置或重置身份。
120
+
121
+ ## 验证
122
+
123
+ ```bash
124
+ PYTHONPATH=src python3 -m unittest discover -s tests -v
125
+ ```
126
+
127
+ 测试只使用人工构造数据及本机临时目录,不调用外部检测服务。
128
+
129
+ 设计见 [架构](https://github.com/MrLeihe/ipcheck/blob/main/docs/architecture.md)、[检测说明](https://github.com/MrLeihe/ipcheck/blob/main/docs/checks.md);报告格式为 [report.schema.json](https://github.com/MrLeihe/ipcheck/blob/main/schemas/report.schema.json)(协议 1.1)。
130
+
131
+ 交互终端显示检测进度、正在执行的项目和累计耗时,完成或中断后清除进度区。`--json`、`--output`、重定向和管道模式不显示动态进度。
@@ -0,0 +1,107 @@
1
+ # ipcheck
2
+
3
+ 命令行 Claude AI IP 风险检测工具。观测普通检测服务、Cloudflare 与 Claude 官方域名的出口,采集本机代理、DNS、时区与 Claude 端点配置,输出带证据的风险因子和调整建议。
4
+
5
+ 浏览器指纹、WebRTC、DNS 泄露属于浏览器侧检测,本工具不重复实现,请访问 <https://ip.net.coffee/claude/>。
6
+
7
+ ## 安装
8
+
9
+ - Python 3.11+;运行时没有第三方依赖。
10
+ - 首版重点验证 macOS;Linux 有部分配置适配,Windows 未覆盖项会单独标注。
11
+
12
+ 从 PyPI 安装(推荐用 pipx 隔离环境):
13
+
14
+ ```bash
15
+ pipx install claude-ipcheck
16
+ ```
17
+
18
+ 用 pip 安装到当前环境:
19
+
20
+ ```bash
21
+ python -m pip install claude-ipcheck
22
+ ```
23
+
24
+ 安装后直接执行:
25
+
26
+ ```bash
27
+ ipcheck --help
28
+ ipcheck --json
29
+ ```
30
+
31
+ 从源码开发:
32
+
33
+ ```bash
34
+ git clone https://github.com/MrLeihe/ipcheck.git
35
+ cd ipcheck
36
+ python3 -m venv .venv
37
+ source .venv/bin/activate
38
+ python -m pip install -e . --no-build-isolation
39
+ ./ipcheck --help
40
+ ```
41
+
42
+ 分发包名为 `claude-ipcheck`,安装后的命令为 `ipcheck`。
43
+
44
+ ## 命令
45
+
46
+ ```bash
47
+ ipcheck # 终端报告
48
+ ipcheck --details # 展开每项检测的证据与脱敏原始数据
49
+ ipcheck --json # 脱敏 JSON
50
+ ipcheck --local # 仅本地配置摘要,不请求外部检测服务
51
+ ipcheck --full # 网络 + 显式本地检查
52
+ ipcheck --reputation # 查询 Claude 出口类型与信誉(默认开启)
53
+ ipcheck --no-reputation # 关闭第三方类型与信誉查询
54
+ ipcheck --timeout 6 # 每次网络请求的超时秒数,范围 1–15
55
+ ipcheck --output report.json # 保存 JSON,仅创建新文件,不覆盖原文件
56
+ ```
57
+
58
+ ## 终端报告
59
+
60
+ 默认报告分三部分:结论置顶、分区主体、固定页脚。
61
+
62
+ 1. **综合结论**:结论文案与待确认项数量、类别。
63
+ 2. **Claude 出口**:网页/API 共用出口时合并为一块;分别列出 IP、国家/地区、城市、运营商、ASN、Claude 支持地区、出口时区与响应耗时。
64
+ 3. **安全检测**:IP 类型(住宅/机房/商业/移动)、信誉评分、代理标记、VPN/Tor/爬虫标记、公开举报记录。
65
+ 4. **出口对比**:本机直连、代理出口、Cloudflare 出口与一致性说明。
66
+ 5. **本机配置**:环境变量代理、系统代理、TUN/VPN、本地 DNS、IPv6 配置与出口提示。
67
+ 6. **时区一致性**:系统、CLI 与 Claude 出口时区,以及一致性判断。
68
+ 7. **Claude API 配置**:当前进程环境变量与用户 settings 中的端点。
69
+ 8. **检测建议**:按优先级(高/中/低)排序的结构化建议。
70
+
71
+ 颜色只在交互终端启用:绿色表示已确认正常,黄色表示需核对或建议,红色表示高风险或冲突,灰色表示已跳过或未验证。退出码、`NO_COLOR` 与 `TERM=dumb` 的规则保持不变。窄于 56 列时自动退化为单列。
72
+
73
+ `--details` 使用同一份报告,追加每项的来源、证据与脱敏 `data`。`--json` 输出完整脱敏报告。
74
+
75
+ 退出码与 `summary.level` 一致:`0` = `clear`,`1` = `attention`,`2` = `incomplete` 或操作失败,`130` = 用户中止。这些不是平台账号安全等级。
76
+
77
+ ## 检测与隐私边界
78
+
79
+ - 本机直连公网 IP 默认通过 `https://4.ipw.cn/` 与 `https://myip.ipip.net/` 交叉查询,明确禁用系统和环境 HTTP 代理,不修改设置;两项服务会看到该次直连的公网来源 IP。它仍受 TUN/VPN、透明网关和运营商 NAT 影响,不能保证是绕过一切代理的运营商原始 IP。单源成功标记未完成交叉验证,来源不一致保留两者,全部失败不使用代理出口替代。`--local` 不执行此查询。
80
+ - 默认网络检查访问 ipify、icanhazip、AWS Check IP、`www.cloudflare.com/cdn-cgi/trace`、ipwho.is,以及 `api.anthropic.com/cdn-cgi/trace` 和 `claude.ai/cdn-cgi/trace`。三个 trace 接口只接收匿名 HTTPS GET,不调用模型,不发送 API Key、Cookie 或登录凭证。各服务会看到对应请求的出口 IP;ipwho.is 会收到指定的观测 IP。
81
+ - 默认将 Claude 网页/API 探测到的 IP 发送至 proxycheck.io 与 StopForumSpam 查询类型、信誉和举报记录,相同 IP 复用结果;可用 `--no-reputation` 关闭。关闭后结论标记为不完整,并给出单独建议,不再逐路重复提示。
82
+ - Claude 支持地区来自 Anthropic 公布的 [Supported Regions Policy](https://www.anthropic.com/supported-countries),按出口 IP 的国家代码比对,数据文件记录政策生效日期与核对日期。已列国家的属地与依赖地区按政策视为支持,通过母国代码判定;`XX`、`T1` 等非国家占位码保留为未知。未列出的国家或地区不受支持;这是服务可用范围,不是账号风险评级。
83
+ - 响应耗时是 DNS、TLS 与首字节的总耗时,受代理和多条网络路径影响,不代表 Claude 服务可用性或 SLA。
84
+ - 出口对比只比较各路径各自观测到的结果。直连与代理路径不同属于预期;只有 Claude 网页与官方 API 互相不一致时才提示核对域名分流,不推断泄露。
85
+ - 所有外部查询使用 HTTPS、响应大小限制和超时。出口观测遵循当前进程/系统可识别的代理配置,不保证与其他应用或运行中会话的路径相同。
86
+ - IP 归属查询默认遵循代理;失败后仅对 ipwho.is 的指定公网 IP 查询尝试直连,并在报告记录 `lookup_route`。回退查询的仍是原先观测 IP,不替换出口观测、不修改分流规则。
87
+ - Claude 探测固定官方 API/网页域名,用以识别当前进程的域名分流。自定义中转、进程/用户代理规则或已登录客户端可能采用其他路径;trace 被阻止或缺字段时保留为未知。Cloudflare `colo` 是服务节点位置,不用来推断用户出口时区。
88
+ - IPv6 分开显示“本机 IPv6 配置”“本机 IPv6 地址”“IPv6 出口探测”。macOS 配置通过 IPv4 默认路由定位网络服务,再读取 `networksetup -getinfo`;只对该服务明确返回 Off 时显示“已关闭”。接口检查只保留计数和接口名,不输出原始 IP/MAC。
89
+ - IPv6 出口探测并发查询 `api6.ipify.org` 与 `ipv6.icanhazip.com`,任一来源返回有效公网 IPv6 即记录可达及地址。探测遵循当前系统/进程代理;本机即使关闭 IPv6,仍可能经 IPv4 连接代理,由代理访问 IPv6 目标。探测失败不证明本机已关闭,成功也不等于泄露。检测到 IPv6 出口时只提示确认代理是否同时覆盖 IPv4 与 IPv6。
90
+ - “Claude API 配置”检查当前进程环境和用户配置;未找到地址时显示“未发现覆盖,默认使用官方 API”,默认行为不代表已确认运行中客户端的实际地址;自定义地址显示域名和“自定义 API,需确认服务商”;不覆盖项目级、受管配置或运行中进程。只输出主机,不输出 URL 凭据、路径或查询参数。
91
+ - DNS 只读取系统配置的解析器地址,不是实际递归解析路径;本工具不做主动 DNS 泄露测试。
92
+ - 系统代理仅在 macOS 读取启用类型;TUN/VPN 按系统 VPN 连接与常见隧道接口路由识别,已开启不代表覆盖所有流量。
93
+ - `--local` 只返回变量名、行号、配置存在性和身份比对数量。不会输出配置原文、邮箱、UUID、API Key 或 Token,不访问钥匙串明文、Cookie 内容和会话文本。
94
+ - JSON 包含 IP 等网络环境信息;分享前仍应根据用途检查这些信息。
95
+ - 报告不保证账号安全、不预测封号,不自动修改代理、删除配置或重置身份。
96
+
97
+ ## 验证
98
+
99
+ ```bash
100
+ PYTHONPATH=src python3 -m unittest discover -s tests -v
101
+ ```
102
+
103
+ 测试只使用人工构造数据及本机临时目录,不调用外部检测服务。
104
+
105
+ 设计见 [架构](https://github.com/MrLeihe/ipcheck/blob/main/docs/architecture.md)、[检测说明](https://github.com/MrLeihe/ipcheck/blob/main/docs/checks.md);报告格式为 [report.schema.json](https://github.com/MrLeihe/ipcheck/blob/main/schemas/report.schema.json)(协议 1.1)。
106
+
107
+ 交互终端显示检测进度、正在执行的项目和累计耗时,完成或中断后清除进度区。`--json`、`--output`、重定向和管道模式不显示动态进度。
@@ -0,0 +1,43 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "claude-ipcheck"
7
+ version = "0.2.0"
8
+ description = "Evidence-based Claude AI IP risk, proxy, DNS and timezone diagnostics"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE"]
13
+ dependencies = []
14
+ keywords = ["claude", "anthropic", "ip", "proxy", "dns", "timezone", "diagnostics", "cli"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ "Operating System :: MacOS",
20
+ "Operating System :: POSIX :: Linux",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: System :: Networking",
26
+ ]
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/MrLeihe/ipcheck"
30
+ Repository = "https://github.com/MrLeihe/ipcheck"
31
+ Issues = "https://github.com/MrLeihe/ipcheck/issues"
32
+
33
+ [project.scripts]
34
+ ipcheck = "ipcheck.cli:main"
35
+
36
+ [tool.setuptools.packages.find]
37
+ where = ["src"]
38
+
39
+ [tool.setuptools.package-data]
40
+ ipcheck = ["data/*.json"]
41
+
42
+ [tool.pytest.ini_options]
43
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: claude-ipcheck
3
+ Version: 0.2.0
4
+ Summary: Evidence-based Claude AI IP risk, proxy, DNS and timezone diagnostics
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/MrLeihe/ipcheck
7
+ Project-URL: Repository, https://github.com/MrLeihe/ipcheck
8
+ Project-URL: Issues, https://github.com/MrLeihe/ipcheck/issues
9
+ Keywords: claude,anthropic,ip,proxy,dns,timezone,diagnostics,cli
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: MacOS
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: System :: Networking
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Dynamic: license-file
24
+
25
+ # ipcheck
26
+
27
+ 命令行 Claude AI IP 风险检测工具。观测普通检测服务、Cloudflare 与 Claude 官方域名的出口,采集本机代理、DNS、时区与 Claude 端点配置,输出带证据的风险因子和调整建议。
28
+
29
+ 浏览器指纹、WebRTC、DNS 泄露属于浏览器侧检测,本工具不重复实现,请访问 <https://ip.net.coffee/claude/>。
30
+
31
+ ## 安装
32
+
33
+ - Python 3.11+;运行时没有第三方依赖。
34
+ - 首版重点验证 macOS;Linux 有部分配置适配,Windows 未覆盖项会单独标注。
35
+
36
+ 从 PyPI 安装(推荐用 pipx 隔离环境):
37
+
38
+ ```bash
39
+ pipx install claude-ipcheck
40
+ ```
41
+
42
+ 用 pip 安装到当前环境:
43
+
44
+ ```bash
45
+ python -m pip install claude-ipcheck
46
+ ```
47
+
48
+ 安装后直接执行:
49
+
50
+ ```bash
51
+ ipcheck --help
52
+ ipcheck --json
53
+ ```
54
+
55
+ 从源码开发:
56
+
57
+ ```bash
58
+ git clone https://github.com/MrLeihe/ipcheck.git
59
+ cd ipcheck
60
+ python3 -m venv .venv
61
+ source .venv/bin/activate
62
+ python -m pip install -e . --no-build-isolation
63
+ ./ipcheck --help
64
+ ```
65
+
66
+ 分发包名为 `claude-ipcheck`,安装后的命令为 `ipcheck`。
67
+
68
+ ## 命令
69
+
70
+ ```bash
71
+ ipcheck # 终端报告
72
+ ipcheck --details # 展开每项检测的证据与脱敏原始数据
73
+ ipcheck --json # 脱敏 JSON
74
+ ipcheck --local # 仅本地配置摘要,不请求外部检测服务
75
+ ipcheck --full # 网络 + 显式本地检查
76
+ ipcheck --reputation # 查询 Claude 出口类型与信誉(默认开启)
77
+ ipcheck --no-reputation # 关闭第三方类型与信誉查询
78
+ ipcheck --timeout 6 # 每次网络请求的超时秒数,范围 1–15
79
+ ipcheck --output report.json # 保存 JSON,仅创建新文件,不覆盖原文件
80
+ ```
81
+
82
+ ## 终端报告
83
+
84
+ 默认报告分三部分:结论置顶、分区主体、固定页脚。
85
+
86
+ 1. **综合结论**:结论文案与待确认项数量、类别。
87
+ 2. **Claude 出口**:网页/API 共用出口时合并为一块;分别列出 IP、国家/地区、城市、运营商、ASN、Claude 支持地区、出口时区与响应耗时。
88
+ 3. **安全检测**:IP 类型(住宅/机房/商业/移动)、信誉评分、代理标记、VPN/Tor/爬虫标记、公开举报记录。
89
+ 4. **出口对比**:本机直连、代理出口、Cloudflare 出口与一致性说明。
90
+ 5. **本机配置**:环境变量代理、系统代理、TUN/VPN、本地 DNS、IPv6 配置与出口提示。
91
+ 6. **时区一致性**:系统、CLI 与 Claude 出口时区,以及一致性判断。
92
+ 7. **Claude API 配置**:当前进程环境变量与用户 settings 中的端点。
93
+ 8. **检测建议**:按优先级(高/中/低)排序的结构化建议。
94
+
95
+ 颜色只在交互终端启用:绿色表示已确认正常,黄色表示需核对或建议,红色表示高风险或冲突,灰色表示已跳过或未验证。退出码、`NO_COLOR` 与 `TERM=dumb` 的规则保持不变。窄于 56 列时自动退化为单列。
96
+
97
+ `--details` 使用同一份报告,追加每项的来源、证据与脱敏 `data`。`--json` 输出完整脱敏报告。
98
+
99
+ 退出码与 `summary.level` 一致:`0` = `clear`,`1` = `attention`,`2` = `incomplete` 或操作失败,`130` = 用户中止。这些不是平台账号安全等级。
100
+
101
+ ## 检测与隐私边界
102
+
103
+ - 本机直连公网 IP 默认通过 `https://4.ipw.cn/` 与 `https://myip.ipip.net/` 交叉查询,明确禁用系统和环境 HTTP 代理,不修改设置;两项服务会看到该次直连的公网来源 IP。它仍受 TUN/VPN、透明网关和运营商 NAT 影响,不能保证是绕过一切代理的运营商原始 IP。单源成功标记未完成交叉验证,来源不一致保留两者,全部失败不使用代理出口替代。`--local` 不执行此查询。
104
+ - 默认网络检查访问 ipify、icanhazip、AWS Check IP、`www.cloudflare.com/cdn-cgi/trace`、ipwho.is,以及 `api.anthropic.com/cdn-cgi/trace` 和 `claude.ai/cdn-cgi/trace`。三个 trace 接口只接收匿名 HTTPS GET,不调用模型,不发送 API Key、Cookie 或登录凭证。各服务会看到对应请求的出口 IP;ipwho.is 会收到指定的观测 IP。
105
+ - 默认将 Claude 网页/API 探测到的 IP 发送至 proxycheck.io 与 StopForumSpam 查询类型、信誉和举报记录,相同 IP 复用结果;可用 `--no-reputation` 关闭。关闭后结论标记为不完整,并给出单独建议,不再逐路重复提示。
106
+ - Claude 支持地区来自 Anthropic 公布的 [Supported Regions Policy](https://www.anthropic.com/supported-countries),按出口 IP 的国家代码比对,数据文件记录政策生效日期与核对日期。已列国家的属地与依赖地区按政策视为支持,通过母国代码判定;`XX`、`T1` 等非国家占位码保留为未知。未列出的国家或地区不受支持;这是服务可用范围,不是账号风险评级。
107
+ - 响应耗时是 DNS、TLS 与首字节的总耗时,受代理和多条网络路径影响,不代表 Claude 服务可用性或 SLA。
108
+ - 出口对比只比较各路径各自观测到的结果。直连与代理路径不同属于预期;只有 Claude 网页与官方 API 互相不一致时才提示核对域名分流,不推断泄露。
109
+ - 所有外部查询使用 HTTPS、响应大小限制和超时。出口观测遵循当前进程/系统可识别的代理配置,不保证与其他应用或运行中会话的路径相同。
110
+ - IP 归属查询默认遵循代理;失败后仅对 ipwho.is 的指定公网 IP 查询尝试直连,并在报告记录 `lookup_route`。回退查询的仍是原先观测 IP,不替换出口观测、不修改分流规则。
111
+ - Claude 探测固定官方 API/网页域名,用以识别当前进程的域名分流。自定义中转、进程/用户代理规则或已登录客户端可能采用其他路径;trace 被阻止或缺字段时保留为未知。Cloudflare `colo` 是服务节点位置,不用来推断用户出口时区。
112
+ - IPv6 分开显示“本机 IPv6 配置”“本机 IPv6 地址”“IPv6 出口探测”。macOS 配置通过 IPv4 默认路由定位网络服务,再读取 `networksetup -getinfo`;只对该服务明确返回 Off 时显示“已关闭”。接口检查只保留计数和接口名,不输出原始 IP/MAC。
113
+ - IPv6 出口探测并发查询 `api6.ipify.org` 与 `ipv6.icanhazip.com`,任一来源返回有效公网 IPv6 即记录可达及地址。探测遵循当前系统/进程代理;本机即使关闭 IPv6,仍可能经 IPv4 连接代理,由代理访问 IPv6 目标。探测失败不证明本机已关闭,成功也不等于泄露。检测到 IPv6 出口时只提示确认代理是否同时覆盖 IPv4 与 IPv6。
114
+ - “Claude API 配置”检查当前进程环境和用户配置;未找到地址时显示“未发现覆盖,默认使用官方 API”,默认行为不代表已确认运行中客户端的实际地址;自定义地址显示域名和“自定义 API,需确认服务商”;不覆盖项目级、受管配置或运行中进程。只输出主机,不输出 URL 凭据、路径或查询参数。
115
+ - DNS 只读取系统配置的解析器地址,不是实际递归解析路径;本工具不做主动 DNS 泄露测试。
116
+ - 系统代理仅在 macOS 读取启用类型;TUN/VPN 按系统 VPN 连接与常见隧道接口路由识别,已开启不代表覆盖所有流量。
117
+ - `--local` 只返回变量名、行号、配置存在性和身份比对数量。不会输出配置原文、邮箱、UUID、API Key 或 Token,不访问钥匙串明文、Cookie 内容和会话文本。
118
+ - JSON 包含 IP 等网络环境信息;分享前仍应根据用途检查这些信息。
119
+ - 报告不保证账号安全、不预测封号,不自动修改代理、删除配置或重置身份。
120
+
121
+ ## 验证
122
+
123
+ ```bash
124
+ PYTHONPATH=src python3 -m unittest discover -s tests -v
125
+ ```
126
+
127
+ 测试只使用人工构造数据及本机临时目录,不调用外部检测服务。
128
+
129
+ 设计见 [架构](https://github.com/MrLeihe/ipcheck/blob/main/docs/architecture.md)、[检测说明](https://github.com/MrLeihe/ipcheck/blob/main/docs/checks.md);报告格式为 [report.schema.json](https://github.com/MrLeihe/ipcheck/blob/main/schemas/report.schema.json)(协议 1.1)。
130
+
131
+ 交互终端显示检测进度、正在执行的项目和累计耗时,完成或中断后清除进度区。`--json`、`--output`、重定向和管道模式不显示动态进度。