Open Source 开源项目 19h ago Updated 19h ago 更新于 19小时前 58

[GitHub] bee-san/Ciphey [GitHub] bee-san/Ciphey

ciphey is a high-performance, Rust-based successor to the original Python Ciphey, offering a 700% speed increase through native multi-threading via Rayon and optimized algorithms. The tool integrates advanced AI components, including a BERT-based model for enhanced plaintext detection (improving accuracy by ~40%) and automated test generation from thousands of CTF challenges. Implementation utilizes A* search with dynamic heuristics, caching, and statistical prioritization to efficiently navigat ciphey 是经典解码工具 Ciphey 的 Rust 重写版本,旨在解决原版性能瓶颈并提升稳定性。 引入 A* 搜索算法结合启发式评估与缓存机制,解码速度提升约 700%,并支持多线程并行处理。 集成基于 BERT 的 `gibberish-or-not` 模型及可配置敏感度检测,显著降低误报率并提高明文识别准确率。 通过自动爬取和分析超过 15,000 个 CTF 挑战的 Writeups 构建测试集,大幅增强了对复杂编码路径的覆盖能力。

65
Hot 热度
70
Quality 质量
60
Impact 影响力

Analysis 深度分析

TL;DR

  • ciphey is a high-performance, Rust-based successor to the original Python Ciphey, offering a 700% speed increase through native multi-threading via Rayon and optimized algorithms.
  • The tool integrates advanced AI components, including a BERT-based model for enhanced plaintext detection (improving accuracy by ~40%) and automated test generation from thousands of CTF challenges.
  • Implementation utilizes A* search with dynamic heuristics, caching, and statistical prioritization to efficiently navigate complex decryption paths while pruning unnecessary branches.
  • Key architectural improvements include configurable sensitivity levels for gibberish detection, support for multi-level decryptions, and a robust library/CLI structure designed for extensibility.

Why It Matters

This release represents a significant shift in automated decryption tooling by leveraging modern systems programming (Rust) and machine learning to overcome the performance bottlenecks of previous iterations. For security researchers and CTF participants, the drastic reduction in processing time and improved accuracy in distinguishing plaintext from ciphertext allows for rapid analysis of heavily obfuscated data. The integration of AI-driven test coverage ensures the tool remains effective against evolving encoding challenges commonly found in cybersecurity competitions.

Technical Details

  • Performance & Concurrency: Built in Rust, utilizing the Rayon library for native multi-threading, which resolves previous single-threading limitations and enables parallel execution of decoder checks.
  • Search Algorithm: Employs A* search with a heuristic function based on cipher_identifier probabilities. It prioritizes fast decoders (like Base64) initially, caches results to prevent recalculation, and prunes the search tree to manage memory usage.
  • AI Integration: Uses a BERT-based model from the gibberish-or-not crate to detect plaintext, requiring a one-time 500MB model download. Additionally, AI was used to scrape 15,071 CTF writeups to automatically generate test cases, ensuring broad coverage of encoding types.
  • Decoder Support & Statistics: Supports 16+ decoders (including Vigenere, Caesar, Atbash, Braille) with plans to expand. It maintains a database of statistics to dynamically prioritize popular decoders and pairs (e.g., Base64->Base64) and includes a regex database of ~500 patterns for API keys and MAC addresses.
  • Configurability: Features adjustable sensitivity levels for gibberish detection (Low for classical ciphers, Medium for others) and customizable themes for accessibility, with default timeouts of 5 seconds (CLI) and 10 seconds (Discord bot).

Industry Insight

The transition to Rust and the inclusion of multi-threading suggest a broader industry trend toward optimizing legacy Python-based security tools for performance-critical applications. Practitioners should consider adopting ciphey for high-volume decoding tasks where latency is a constraint, particularly in automated CTF pipelines or large-scale data forensics. Furthermore, the use of AI not just for detection but for generating comprehensive test suites highlights a novel approach to maintaining software reliability in the face of diverse and evolving encryption standards.

TL;DR

  • ciphey 是经典解码工具 Ciphey 的 Rust 重写版本,旨在解决原版性能瓶颈并提升稳定性。
  • 引入 A* 搜索算法结合启发式评估与缓存机制,解码速度提升约 700%,并支持多线程并行处理。
  • 集成基于 BERT 的 gibberish-or-not 模型及可配置敏感度检测,显著降低误报率并提高明文识别准确率。
  • 通过自动爬取和分析超过 15,000 个 CTF 挑战的 Writeups 构建测试集,大幅增强了对复杂编码路径的覆盖能力。

为什么值得看

该项目展示了如何将传统启发式算法与现代 AI 模型(如 BERT)及高效系统编程(Rust)相结合,以解决长期存在的性能与准确性难题。对于安全研究人员和 CTF 玩家而言,它提供了一个更快、更可靠且具备自动化测试验证的工具链,代表了编码破解工具的技术演进方向。

技术解析

  • 核心架构与性能优化:使用 Rust 重写,原生支持 Rayon 多线程库。采用 A* 搜索算法,利用 cipher_identifier 计算启发式成本,优先执行快速解码器(如 Base64),并通过缓存和剪枝策略优化内存与计算资源。
  • 智能明文检测:默认启用基于 BERT 模型的 gibberish-or-not crate,需下载 500MB 模型文件,可将明文检测准确率提升约 40%。同时支持针对不同密码类型(如凯撒密码低敏感度、其他中等敏感度)配置灵敏度阈值。
  • 自动化测试与数据驱动:利用 AI 自动研究 15,071 个 CTF 挑战及其 Writeups,提取编码/解码场景生成测试用例。内置约 500 种常见 API Key、MAC 地址等正则表达式数据库,以及密码泄露检测功能。
  • 功能特性:目前支持 16 种解码器(持续增长),支持多级嵌套解码(如 Rot13->Base64->Rot13)。CLI 默认 5 秒超时,Discord Bot 默认 10 秒,防止无限循环。提供统计数据库记录解码表现,动态调整解码器优先级。

行业启示

  • AI 辅助软件工程:利用 LLM 进行大规模数据爬取、特征提取和测试用例生成,可以显著缩短开发周期并提高软件质量,特别是在安全工具领域。
  • 传统算法与现代 AI 的融合:在确定性任务(如解码)中,结合传统启发式搜索(A*)的高效性与深度学习模型(BERT)的高精度识别能力,是平衡速度与准确性的有效范式。
  • 工具生态的迭代标准:新一代工具不仅关注功能实现,更强调可观测性(统计数据库)、可维护性(文档测试)和用户体验(主题定制、Discord 集成),反映了开发者工具向平台化和服务化发展的趋势。

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Open Source 开源 Security 安全