rodrigoramosrs/WafSight

GitHub: rodrigoramosrs/WafSight

一个高性能的 .NET WAF/CDN 检测库与 CLI 工具,通过多维特征分析帮助用户识别目标网站部署的 Web 应用防火墙和内容分发网络。

Stars: 1 | Forks: 0

![WafSight](https://static.pigsec.cn/wp-content/uploads/repos/cas/e9/e950723312cf6707f33289436880e487166d0cc7fd12bdb7b3de434ad1781ba3.png) # WafSight *高性能的 .NET WAF/CDN 检测库和 CLI* [![NuGet 版本](https://img.shields.io/nuget/v/WafSight?style=flat-square&logo=nuget&label=NuGet)](https://www.nuget.org/packages/WafSight) [![NuGet 下载量](https://img.shields.io/nuget/dt/WafSight?style=flat-square&logo=nuget&label=Downloads)](https://www.nuget.org/packages/WafSight) [![许可证](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](LICENSE) [![.NET](https://img.shields.io/badge/.NET-8.0-5C2D91?style=flat-square&logo=dotnet)](https://dotnet.microsoft.com) [![构建](https://img.shields.io/github/actions/workflow/status/rodrigoramosrs/wafsight/ci.yml?style=flat-square&logo=github&label=Build)](https://github.com/rodrigoramosrs/wafsight/actions) [![Stars](https://img.shields.io/github/stars/rodrigoramosrs/wafsight?style=flat-square&logo=github&label=Stars)](https://github.com/rodrigoramosrs/wafsight) [![平台](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey?style=flat-square)](https://github.com/rodrigoramosrs/wafsight) [![AOT](https://img.shields.io/badge/AOT-Compatible-success?style=flat-square)](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot) 通过分析 HTTP 标头、响应正文、Cookie、状态码、DNS 记录、时间、TLS 证书以及 payload 探测来检测 Web Application Firewalls (WAF) 和 Content Delivery Networks (CDN)。 如需完整文档,请访问 [rodrigoramosrs.github.io/WafSight](https://rodrigoramosrs.github.io/WafSight/)。 ## 功能 - **8 个内置 provider**:CloudFlare、AWS、Akamai、Fastly、Azure、Imperva、Sucuri、F5 - 通过 payload 探测(XSS、SQLi、LFI、XXE、RCE)进行**通用 WAF 检测** - 具有分级置信度级别的**加权证据评分** - 通过 CNAME、A、NS 和 TXT 记录进行 **DNS 分析** - 具有并发控制的**批量检测** - 具有重试和超时策略的**弹性 HTTP 客户端** - 支持 ASP.NET Core 集成的**依赖注入** - 具有可配置详细级别的 **CLI 工具** - 支持跨平台独立可执行文件的 **AOT 原生发布** ## 快速开始 ### 安装包 ``` dotnet add package WafSight ``` ### 作为库使用 ``` using WafSight; using Microsoft.Extensions.Logging; // With default logging using var client = new WafDetectorClient(); // With custom ILoggerFactory var loggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); builder.SetMinimumLevel(LogLevel.Information); }); using var client = new WafDetectorClient(loggerFactory); // Detect single URL var result = await client.DetectAsync("https://example.com"); if (result.HasWaf) { Console.WriteLine($"WAF: {result.Waf.Name} ({result.Waf.Confidence:P0})"); } if (result.HasCdn) { Console.WriteLine($"CDN: {result.Cdn.Name} ({result.Cdn.Confidence:P0})"); } // Batch detection var urls = new[] { "https://example.com", "https://cloudflare.com" }; var batchResults = await client.DetectBatchAsync(urls, maxConcurrency: 3); // List providers var providers = client.ListProviders(); ``` ### 使用 CLI ``` # 检测单个 URL (默认显示结果) WafSight detect https://example.com # 显示带有 verbosity 级别的详细日志 WafSight -V 1 detect https://example.com # Low: errors + basic status WafSight -V 2 detect https://example.com # Medium: + headers, DNS, scores WafSight -V 3 detect https://example.com # High: + payloads, evidence, timing # 从文件批量检测 WafSight batch urls.txt # 列出已注册的 providers WafSight providers # 显示帮助 WafSight --help ``` #### 详细级别 | 级别 | 描述 | |-------|-------------| | `0` 或 `None` | 仅错误和关键信息(默认) | | `1` 或 `Low` | 错误 + 基本检测结果 | | `2` 或 `Medium` | Low + 标头、DNS 记录、provider 得分 | | `3` 或 `High` | Medium + payload 探测、证据详情、时间 | ## 依赖注入 ``` using Microsoft.Extensions.DependencyInjection; services.AddWafDetector(options => { options.Timeout = TimeSpan.FromSeconds(15); options.EnableGenericDetection = true; options.EnableDnsAnalysis = true; }); // Inject IWafDetector where needed public class MyService { private readonly IWafDetector _detector; public MyService(IWafDetector detector) { _detector = detector; } } ``` ## 系统要求 - .NET 10.0 或更高版本 [![许可证: MIT](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](LICENSE) [![NuGet](https://img.shields.io/nuget/v/WafSight?style=flat-square)](https://www.nuget.org/packages/WafSight) [![GitHub Stars](https://img.shields.io/github/stars/rodrigoramosrs/wafsight?style=flat-square&label=Stars)](https://github.com/rodrigoramosrs/wafsight) ## 特别感谢 如果没有这些令人难以置信的开源项目提供的启发和知识,这个项目就不会存在: - [**waf-detector**](https://github.com/ammarion/waf-detector) — 由 Ammar Atef 用 Go 编写的快速高效的 WAF 检测工具。它的架构和 provider 模型极大地影响了 WafSight 的设计。 - [**wafw00f**](https://github.com/EnableSecurity/wafw00f) — EnableSecurity 开发的传奇 WAF 指纹识别工具。其基于签名的检测方法和广泛的 provider 数据库为整个生态系统树立了标准。 如果您觉得 WafSight 有用,也请考虑向这些项目表达您的感谢——在 GitHub 上给它们点 Star、提交 issue 或贡献代码。开源的繁荣离不开社区的支持。 向这些项目的维护者和贡献者致谢:感谢你们铺平了道路。
标签:C2日志可视化, CDN检测, 二进制模式, 多人体追踪, 实时处理, 密码管理, 指纹识别, 网络侦查