pschanely/CrossHair

GitHub: pschanely/CrossHair

一个用于 Python 的分析工具,通过符号执行与 SMT 求解器模糊化测试与类型系统的边界。

Stars: 1272 | Forks: 77

# CrossHair [![加入 Discord 聊天](https://img.shields.io/discord/1346219754519789719?logo=discord&logoColor=white)](https://discord.gg/rUeTaYTWbb) [![查看状态](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/8328c80bec212008.svg)](https://github.com/pschanely/CrossHair/actions?query=workflow%3ACheck+event%3Apush) [![下载次数](https://static.pepy.tech/badge/crosshair-tool/week)](https://pepy.tech/project/crosshair-tool) 一个用于 Python 的分析工具,模糊化了测试与 类型系统之间的界限。 如果你拥有一个带有 [类型注解](https://www.python.org/dev/peps/pep-0484/) 的函数,并添加了一个 契约 [(受支持的语法)](https://crosshair.readthedocs.io/en/latest/kinds_of_contracts.html), CrossHair 会尝试为你找到反例: ![演示验证 Python 函数的动画 GIF](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/5485d9b954212032.gif) CrossHair 的工作原理是通过反复使用符号化输入调用你的函数。 它使用一个 [SMT 求解器](一种定理证明器)来探索可行的 执行路径并为你找到反例。 这不是一个新概念;Python 的方法最早在 [这篇论文] 中被描述。 然而,据我所知,CrossHair 是最完整的实现: 它可以对内置类型、用户定义的类以及标准库的大部分内容使用符号推理。 现在就可以在 [crosshair-web.org] 浏览器中试用 CrossHair! CrossHair 提供了 [IDE 集成](适用于 [VS Code]、[PyCharm] 等)。 此外,CrossHair 不仅能检查契约,还能 [生成单元测试](https://crosshair.readthedocs.io/en/latest/cover.html) 以及 [查找函数间的行为差异](https://crosshair.readthedocs.io/en/latest/diff_behavior.html)。 想帮忙吗? 订阅 [email](http://eepurl.com/hGTLRH) 或 [RSS](https://pschanely.github.io/feed.xml) 更新。 给仓库加个 ⭐️。 还有 [其他帮助方式](https://crosshair.readthedocs.io/en/latest/how_can_i_help.html) 。 ## [文档](https://crosshair.readthedocs.io/en/latest) * [简介](https://crosshair.readthedocs.io/en/latest/introduction.html) * [快速开始](https://crosshair.readthedocs.io/en/latest/get_started.html) * [详解:契约](https://crosshair.readthedocs.io/en/latest/contracts.html) * [详解:cover](https://crosshair.readthedocs.io/en/latest/cover.html) * [详解:diffbehavior](https://crosshair.readthedocs.io/en/latest/diff_behavior.html) * [契约类型](https://crosshair.readthedocs.io/en/latest/kinds_of_contracts.html) * [对类的提示](https://crosshair.readthedocs.io/en/latest/hints_for_your_classes.html) * [IDE 集成](https://crosshair.readthedocs.io/en/latest/ide_integrations.html) * [案例研究](https://crosshair.readthedocs.io/en/latest/case_studies.html) * [限制](https://crosshair.readthedocs.io/en/latest/limitations.html) * [插件](https://crosshair.readthedocs.io/en/latest/plugins.html) * [工作原理](https://crosshair.readthedocs.io/en/latest/how_does_it_work.html) * [如何帮忙](https://crosshair.readthedocs.io/en/latest/how_can_i_help.html) * [相关研究](https://crosshair.readthedocs.io/en/latest/related_work.html) * [贡献指南](https://crosshair.readthedocs.io/en/latest/contributing.html) * [更新日志](https://crosshair.readthedocs.io/en/latest/changelog.html)
标签:PyCharm插件, Python分析工具, Python静态分析, SEO关键词: CrossHair, SMT求解器, VSCode插件, Web演示, 二进制发布, 代码验证, 单元测试生成, 可配置连接, 合约验证, 契约式设计, 定理证明, 开源工具, 测试模糊, 程序分析, 符号执行, 类型安全, 类型注解, 类型系统, 行为差异检测, 覆盖率工具, 软件验证, 逆向工具