CVEFixFormatter is a lightweight tool for transforming CVEfix dataset into customized formats for data analysis, visualization, or integration into other applications. It provides a seamless way to preprocess, clean, and structure vulnerability and fix data for research or practical use.
我们的数据集来源于两个项目,分别是CVEFix和VulnCodeCollector.我们分别对这两个项目进行处理和清洗.以提取高级语义化的信息.并存入mongodb中.
该功能从VulnCodeCollector中自动化解析并提取CVE信息,自动由大模型生成语义化信息并存入mongodb中。
Initialize mongo container
docker run -d --name cve-mongodb -p 27017:27017 \
-v [mount point]:/data/db \
mongo --noauthClone VulnCodeCollector
git clone https://github.com/iridium-soda/VulnCodeCollector.gitRun
conda env create -f environment.yaml
conda activate cveformatter
python3 vulnsrc_formatter.py --helpTip
本项目采用基于 Ollama 的 Qwen2.5Code 模型对代码进行语义清洗,暂时只支持Ollama标准的API接口。如有需要请在utils/providers中进行编写并修改源代码。
生成项目配置文件:
cp config.example.yaml config.yaml打开 config.yaml 文件,根据当前可用的大模型提供商进行适配和调整。确保配置符合实际需求,以便正常使用项目功能。
Usage:
Usage: vulnsrc_formatter.py [OPTIONS]
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ * --repo-path TEXT The path of Vulsrc repo's root path [default: None] [required] │
│ --mongo-host TEXT The host address of the mongodb [default: 127.0.0.1] │
│ --mongo-port INTEGER The port of the mongodb port [default: 27017] │
│ --verbose -v Enable verbose mode (DEBUG logging) │
│ --help Show this message and exit. │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
flowchart LR
A(main) --> B(parse_CVE)
B --> commit_enrty
subgraph parse_commit
commit_enrty-->parse_the_commit_description
parse_the_commit_description-->get_files
get_files-->save_files
save_files-->|GridFS_id|commit_enrty
commit_enrty-->ask_LLM
ask_LLM-->|Semantic info|commit_enrty
commit_enrty-->save_desc_to_mongo
end
该功能从CVEFIX数据集中读取相关CVE数据,并按照相同的方式存入mongo中。
其他主要安装和配置在Vulnsrc已经做好。只需要下载并导入CVEFIX数据集为.db文件。
conda activate cveformatter
python3 cvefix_formatter.py --help同VulnSrc Formatter。如果你能顺利运行VulnSrc Formatter,在外部环境不变的情况下可以直接运行该功能。