Skip to content

Latest commit

 

History

105 Commits

Folders and files

Repository files navigation

CXSecurity Crawler

Go Tests codecov Example Tests

一个用于爬取 CXSecurity 网站漏洞数据的工具。可以作为命令行工具使用,也可以作为Go库集成到其他项目中,还提供HTTP API服务。

功能概览

mindmap
  root((CXSecurity))
    使用方式
      命令行工具
      Golang API
      HTTP API
    功能模块
      漏洞列表
        获取列表
        获取详情
      CVE信息
        获取详情
        相关漏洞
      作者信息
        基本信息
        漏洞列表
      搜索功能
        关键词搜索
        分页功能
        排序功能
    数据输出
      JSON格式
      自定义字段
      静默模式
Loading

目录

功能特性

  • 漏洞数据获取
    • 爬取漏洞列表和详情页面
    • 支持CVE详情查询
    • 获取作者信息和历史漏洞
    • 关键词搜索功能
  • 多种使用方式
    • 命令行工具
    • Golang API库
    • HTTP API服务
  • 数据处理
    • JSON格式输出
    • 自定义输出字段
    • 分页和排序支持
  • 其他特性
    • 完善的错误处理
    • 自动重试机制
    • 详细的使用文档

安装说明

从源码编译

# 克隆仓库
git clone https://github.com/scagogogo/cxsecurity-skills.git
cd cxsecurity-skills

# 编译
go build -o cxsecurity

# 运行测试
go test ./...

使用go get安装

go get github.com/scagogogo/cxsecurity-skills

命令行使用

漏洞列表命令

获取漏洞列表或详细信息:

# 获取漏洞列表(默认第1页)
./cxsecurity exploit

# 获取指定漏洞详情
./cxsecurity exploit -i WLB-2024040035 -o result.json

# 指定输出字段
./cxsecurity exploit -i 2024040035 -f "title,url,date"

# 静默模式运行
./cxsecurity exploit -i WLB-2024040035 -s

参数说明:

  • -i, --id: 漏洞ID,可选前缀"WLB-"
  • -o, --output: 输出文件路径
  • -f, --fields: 输出字段,用逗号分隔
  • -s, --silent: 静默模式

CVE详情命令

获取CVE详细信息:

# 获取CVE详情
./cxsecurity cve -i CVE-2024-12345

# 指定输出字段
./cxsecurity cve -i CVE-2024-12345 -f "description,references"

# 自定义输出文件
./cxsecurity cve -i CVE-2024-12345 -o cve_detail.json

参数说明:

  • -i, --id: CVE编号(必需)
  • -o, --output: 输出文件路径
  • -f, --fields: 输出字段,用逗号分隔

作者信息命令

获取作者信息和历史漏洞:

# 获取作者信息
./cxsecurity author -i m4xth0r

# 输出到文件
./cxsecurity author -i m4xth0r -o author_info.json

# 静默模式
./cxsecurity author -i m4xth0r -s

参数说明:

  • -i, --id: 作者ID(必需)
  • -o, --output: 输出文件路径
  • -s, --silent: 静默模式

搜索命令

搜索漏洞信息:

# 基本搜索
./cxsecurity search -k "sql injection"

# 高级搜索选项
./cxsecurity search -k "RCE" -p 2 -n 30 -s DESC

# 禁用交互式分页
./cxsecurity search -k "XSS" --no-paging

参数说明:

  • -k, --keyword: 搜索关键词(必需)
  • -p, --page: 页码,默认1
  • -n, --perpage: 每页结果数(10或30)
  • -s, --sort: 排序方式(ASC或DESC)
  • --no-paging: 禁用交互式分页

分类列表命令

按分类爬取漏洞列表,支持全站、仅Bugs、仅Tricks、仅Dorks、仅CVE、仅CWE等分类。

# 爬取全部漏洞列表
./cxcrawler category --type wlb

# 爬取仅 Bugs 分类
./cxcrawler category --type bugs --output bugs.json

# 爬取仅含 CVE 的列表
./cxcrawler category --type cvelist

# 爬取仅 Exploits 分类(支持分页)
./cxcrawler category --type exploit --page 2

参数说明:

  • -t, --type: 分类,可选值:wlb(全部)/bugs/tricks/dorks/cvelist/cwelist/exploit,默认 wlb
  • -p, --page: 页码(仅 exploit 生效),默认 1
  • -o, --output: 结果保存路径(JSON格式)

CWE列表命令

爬取指定 CWE 分类下的所有漏洞,例如 CWE-79(跨站脚本)。

# 爬取 CWE-79 下的漏洞
./cxcrawler cwe --id CWE-79

# 也支持简写(自动补全 CWE- 前缀)
./cxcrawler cwe --id 79 --output cwe79.json

参数说明:

  • -i, --id: CWE 编号(必填),如 CWE-79 或 79
  • -o, --output: 结果保存路径(JSON格式)

研究员排行榜命令

爬取研究员 TOP1000 排行榜,按已报告漏洞数量降序排列。

# 爬取排行榜第 1 页
./cxcrawler ranking --page 1

# 保存结果
./cxcrawler ranking --page 1 --output ranking.json

参数说明:

  • -p, --page: 页码(每页约100名研究员),默认 1
  • -o, --output: 结果保存路径(JSON格式)

RSS订阅命令

爬取 cxsecurity.com 的 RSS 订阅源。

# 爬取全部 RSS 订阅
./cxcrawler rss --type all

# 爬取仅 Exploits 的 RSS
./cxcrawler rss --type exploit --output exploit.json

参数说明:

  • -t, --type: 分类,可选值:all/exploit/dorks/vulnerabilities,默认 all
  • -o, --output: 结果保存路径(JSON格式)

CVEMAP命令

爬取 CVEMAP 全站 CVE 列表,每页25条,共约3000项,可作为遍历全站CVE的入口。

# 爬取 CVEMAP 第 1 页
./cxcrawler cvemap --page 1

# 爬取第 2 页并保存
./cxcrawler cvemap --page 2 --output cvemap2.json

参数说明:

  • -p, --page: 页码(每页25条),默认 1
  • -o, --output: 结果保存路径(JSON格式)

CWE字典命令

爬取 CWE 字典,约60个CWE条目含编号与标题描述。

# 爬取 CWE 字典
./cxcrawler cwe-dict

# 保存结果
./cxcrawler cwe-dict --output cwe_dict.json

参数说明:

  • -o, --output: 结果保存路径(JSON格式)

Golang API

HTTP客户端

创建和配置HTTP客户端:

import "github.com/scagogogo/cxsecurity-skills/pkg/crawler"

// 默认配置
client := crawler.NewClient()

// 自定义配置
client := crawler.NewClient(
    crawler.WithTimeout(10 * time.Second),
    crawler.WithRetry(3, 500 * time.Millisecond),
    crawler.WithHeader("User-Agent", "Custom-UA"),
)

漏洞列表API

获取漏洞列表和详情:

import (
    "github.com/scagogogo/cxsecurity-skills/pkg/crawler"
    "github.com/scagogogo/cxsecurity-skills/pkg/model"
)

// 创建解析器和客户端
listParser := crawler.NewListParser()
client := crawler.NewClient()

// 获取漏洞列表
content, err := client.GetPage("/exploit/85")
vulnList, err := listParser.Parse(content)

// 使用结果
for _, vuln := range vulnList.Items {
    fmt.Printf("标题: %s\n", vuln.Title)
    fmt.Printf("日期: %s\n", vuln.Date.Format("2006-01-02"))
}

CVE详情API

获取CVE详细信息:

// 创建CVE解析器
cveParser := crawler.NewCveParser()

// 获取CVE详情
content, err := client.GetPage("/cve/CVE-2024-12345")
cveDetail, err := cveParser.Parse(content)

// 使用结果
fmt.Printf("CVE: %s\n", cveDetail.CveID)
fmt.Printf("CVSS: %.1f\n", cveDetail.CvssBaseScore)

作者信息API

获取作者信息:

// 创建作者信息解析器
authorParser := crawler.NewAuthorParser()

// 获取作者信息
content, err := client.GetPage("/author/m4xth0r")
authorInfo, err := authorParser.Parse(content)

// 使用结果
fmt.Printf("作者: %s\n", authorInfo.Name)
fmt.Printf("漏洞数: %d\n", authorInfo.ReportedCount)

搜索API

搜索漏洞信息:

// 创建搜索器
searcher := crawler.NewSearcher()

// 基本搜索
result, err := searcher.Search("sql injection", 1, 10)

// 高级搜索
result, err := searcher.SearchAdvanced(&SearchOptions{
    Keyword:   "RCE",
    Page:      2,
    PerPage:   30,
    SortOrder: "DESC",
})

分类列表API

爬取指定分类的漏洞列表,复用统一的列表解析器。

c := crawler.NewCrawler()
// 爬取 /bugs/ 分类
list, err := c.CrawlCategory(crawler.CategoryBugs, 1, "")
// 爬取 /cvelist/ 分类并保存
list, err = c.CrawlCategory(crawler.CategoryCveList, 1, "cve_list.json")

可选分类常量:CategoryFull(/wlb/)、CategoryBugs、CategoryTricks、CategoryExploit、CategoryDorks、CategoryCveList、CategoryCweList

CWE列表API

爬取指定 CWE 编号下的漏洞列表,自动规范化 CWE ID。

c := crawler.NewCrawler()
// 爬取 CWE-79 下的漏洞列表(传 "79" 会自动补全为 "CWE-79")
list, err := c.CrawlCweList("CWE-79", "cwe79.json")
fmt.Printf("CWE-79 下共 %d 条漏洞\n", len(list.Items))

研究员排行榜API

爬取 TOP1000 研究员排行榜。

c := crawler.NewCrawler()
ranking, err := c.CrawlRanking(1, "ranking.json")
if len(ranking.Researchers) > 0 {
    top := ranking.Researchers[0]
    fmt.Printf("第1名: %s (%s) %d个漏洞\n", top.Name, top.Country, top.Count)
}

RSS订阅API

爬取 RSS 订阅源(XML 解析)。

c := crawler.NewCrawler()
feed, err := c.CrawlRss(crawler.RssAll, "rss.json")
for _, item := range feed.Items {
    fmt.Printf("%s — %s — %s\n", item.GUID, item.Title, item.Creator)
}

可选 RSS 分类常量:RssAll、RssExploit、RssDorks、RssVulnerabilities

CVEMAP API

爬取 CVEMAP 全站 CVE 列表,可作为遍历全站 CVE 的入口。

c := crawler.NewCrawler()
// 爬取 CVEMAP 第 1 页(每页25条,共3000项)
list, err := c.CrawlCveMap(1, "cvemap.json")
fmt.Printf("总 %d 项 / %d 页,当页 %d 个\n", list.TotalItems, list.TotalPages, len(list.Items))
for _, item := range list.Items {
    fmt.Println(item.CveID) // 如 CVE-2024-50066
}

CWE 字典 API

爬取 CWE 字典,含编号与标题描述。

c := crawler.NewCrawler()
dict, err := c.CrawlCweDict("cwe_dict.json")
for _, e := range dict.Entries {
    fmt.Printf("%s — %s\n", e.CweID, e.Title) // 如 CWE-79 — Cross-site Scripting
}

Bogus 假漏洞列表 API

爬取 cxsecurity.com 的 Fake Notes 假漏洞列表,复用 CrawlCategory 与 CategoryBogus 分类常量,按页码翻页。

c := crawler.NewCrawler()
// 爬取 bogus 假漏洞第 1 页
list, err := c.CrawlCategory(crawler.CategoryBogus, 1, "bogus.json")
fmt.Printf("第 %d 页,共 %d 条\n", list.CurrentPage, len(list.Items))

CVE 产品字典 API

爬取 CVE 受影响产品字典,按字母 A-Z 分页。每个产品条目含名称与详情链接。

c := crawler.NewCrawler()
page, err := c.CrawlCveProducts("A", "cveproducts_A.json")
fmt.Printf("字母 %s,共 %d 条产品\n", page.Letter, len(page.Entries))
for _, e := range page.Entries {
    fmt.Println(e.Name, e.URL) // 如 "A+ store e-commerce" -> https://cxsecurity.com/cveproduct/8832/...
}

CVE 厂商字典 API

爬取 CVE 厂商字典,按字母 A-Z 分页。

c := crawler.NewCrawler()
page, err := c.CrawlCveVendors("A", "cvevendors_A.json")
fmt.Printf("字母 %s,共 %d 条厂商\n", page.Letter, len(page.Entries))

HTTP API

服务启动

# 启动API服务器
./cxsecurity api

# 指定端口和Token
./cxsecurity api -p 8080 -t your-api-token

认证方式

所有API请求需要包含认证Token,支持两种方式:

  1. 请求头:
X-API-Token: your-api-token
  1. URL参数:
?token=your-api-token

接口列表

1. 搜索接口

GET /api/search?keyword=sql+injection&page=1&per_page=10&sort_order=DESC

请求参数:

  • keyword: 搜索关键词(必需)
  • page: 页码,默认1
  • per_page: 每页结果数,可选10或30
  • sort_order: 排序方式,可选ASC或DESC

响应示例:

{
  "code": 0,
  "message": "success",
  "data": {
    "items": [
      {
        "id": "WLB-2024040035",
        "title": "SQL Injection Example",
        "date": "2024-04-15",
        "risk": "High",
        "tags": ["SQL", "Web", "Remote"],
        "author": "researcher",
        "author_id": "researcher123"
      }
    ],
    "total": 150,
    "page": 1,
    "total_page": 15
  }
}

2. 漏洞详情接口

GET /api/vulnerability/{id}

请求参数:

  • id: 漏洞ID(必需)

响应示例:

{
  "code": 0,
  "message": "success",
  "data": {
    "id": "WLB-2024040035",
    "title": "SQL Injection Example",
    "date": "2024-04-15",
    "risk": "High",
    "description": "详细描述...",
    "solution": "解决方案..."
  }
}

3. CVE详情接口

GET /api/cve/{id}

请求参数:

  • id: CVE编号(必需)

响应示例:

{
  "code": 0,
  "message": "success",
  "data": {
    "id": "CVE-2024-12345",
    "title": "CVE标题",
    "description": "CVE描述",
    "cvss": 8.8,
    "references": [
      "https://example.com/ref1",
      "https://example.com/ref2"
    ]
  }
}

4. 作者信息接口

GET /api/author/{id}

请求参数:

  • id: 作者ID(必需)

响应示例:

{
  "code": 0,
  "message": "success",
  "data": {
    "id": "researcher123",
    "name": "Security Researcher",
    "country": "US",
    "reported_count": 156,
    "vulnerabilities": [
      {
        "id": "WLB-2024040035",
        "title": "漏洞标题",
        "date": "2024-04-15"
      }
    ]
  }
}

5. 分类列表接口

GET /api/category?type=bugs&page=1

请求参数:

  • type: 分类,可选值:wlb/bugs/tricks/dorks/cvelist/cwelist/exploit,默认 wlb
  • page: 页码(仅 exploit 生效),默认 1

响应示例:

{
  "success": true,
  "data": {
    "items": [
      {
        "id": "WLB-2026070004",
        "title": "XenForo XSS CVE Scanner",
        "risk_level": "Low",
        "author": "Xasthur"
      }
    ],
    "current_page": 1,
    "total_pages": 1
  }
}

6. CWE列表接口

GET /api/cwe?id=CWE-79

请求参数:

  • id: CWE 编号(必需),如 CWE-79 或 79

响应示例:

{
  "success": true,
  "data": {
    "items": [
      {
        "title": "XenForo XSS CVE Scanner",
        "risk_level": "Low",
        "cve": "CVE-2026-35055"
      }
    ],
    "current_page": 1,
    "total_pages": 1
  }
}

7. 研究员排行榜接口

GET /api/ranking?page=1

请求参数:

  • page: 页码(每页约100名),默认 1

响应示例:

{
  "success": true,
  "data": {
    "current_page": 1,
    "total_pages": 1,
    "researchers": [
      {
        "rank": 1,
        "name": "KingSkrupellos",
        "country": "gb",
        "author_url": "https://cxsecurity.com/author/KingSkrupellos/1/",
        "count": 968
      }
    ]
  }
}

8. RSS订阅接口

GET /api/rss?type=all

请求参数:

  • type: 分类,可选值:all/exploit/dorks/vulnerabilities,默认 all

响应示例:

{
  "success": true,
  "data": {
    "title": "CXSECURITY Database RSS Feed - CXSecurity.com",
    "link": "https://cxsecurity.com/wlb/",
    "items": [
      {
        "title": "XenForo XSS CVE Scanner",
        "link": "https://cxsecurity.com/issue/WLB-2026070004",
        "guid": "WLB-2026070004",
        "creator": "Xasthur"
      }
    ]
  }
}

9. CVEMAP接口

GET /api/cvemap?page=1

请求参数:

  • page: 页码(每页25条),默认 1

响应示例:

{
  "success": true,
  "data": {
    "items": [
      {"cve_id": "CVE-2024-50066", "url": "https://cxsecurity.com/cveshow/CVE-2024-50066/"}
    ],
    "current_page": 1,
    "total_pages": 120,
    "total_items": 3000,
    "per_page": 25
  }
}

10. CWE字典接口

GET /api/cwe-dict

无请求参数。

响应示例:

{
  "success": true,
  "data": {
    "entries": [
      {"cwe_id": "CWE-89", "title": "Improper Neutralization of Special Elements (SQL Injection)"}
    ]
  }
}

示例代码

完整的示例代码请查看 examples 目录:

三层架构

本项目提供三种使用方式,覆盖不同场景:

  1. Go SDK API(pkg/crawler):程序化集成,13 个接口均真实抓取 cxsecurity.com(非 mock)。
  2. 命令行客户端(cmd/,基于 Cobra):cxcrawler 二进制,开箱即用,表格输出 + JSON 落盘。
  3. AI Agent Skills(skills/cxsecurity/):渐进式披露的 Markdown 文档,供 AI Agent 调用。
    • 入口:skills/cxsecurity/SKILL.md
    • CLI 参考:skills/cxsecurity/reference/cli-reference.md
    • SDK 参考:skills/cxsecurity/reference/sdk-reference.md
    • 快速验证:bash skills/cxsecurity/scripts/cxsec-quickstart.sh

开发贡献

欢迎提交问题或贡献代码:

  1. Fork 本仓库
  2. 创建特性分支
  3. 提交变更
  4. 推送到分支
  5. 创建Pull Request

提交PR前请确保:

# 运行测试
go test ./...

# 运行示例
go run examples/*/main.go

# 格式化代码
go fmt ./...

许可证

本项目使用 MIT 许可证。详见 LICENSE 文件。

https://cxsecurity.com/exploit/#google_vignette

Releases

Packages

Used by

Contributors

Languages