vfeedio/pyvfeed

GitHub: vfeedio/pyvfeed

Python 命令行工具,用于查询 vFeed 漏洞与威胁情报数据库并输出结构化的漏洞关联信息。

Stars: 105 | Forks: 18

vfeed



pyvfeed - Python CLI for vFeed Vulnerability and Threat Intelligence

`pyvfeed` 是一个 Python 命令行工具,用于查询 vFeed 相关的漏洞和威胁情报数据库。它能生成结构化的 JSON 输出,涵盖 CVE 信息、CVSS 2/3/4 评分、EPSS、KEV、MITRE ATT&CK、公告、漏洞利用、补丁、检测规则等。 ## 要求 - Python 3.9+ - `boto3` — 通过 AWS S3 进行授权 DB 更新 - `pyyaml` — YAML 导出支持 - `urllib3` / 标准库 `urllib` — 演示 DB 下载 安装所有依赖项: ``` pip install -r requirements.txt ``` ## 快速入门 ### 1. 下载演示 DB 下载演示 vFeed DB 并自动检查更新。 ``` python pyvfeed.py --download-demo-db [+] Checking demo DB update status ... [-] Fetching remote checksum from '...' ... [-] Remote checksum: a3f1... [-] Downloading demo DB 'vfeed.db.tgz' ... [-] Unpacking ... [+] Cleaning tmp downloads ... ``` ### 2. 永久设置 DB 文件 保存 DB 路径,这样每个后续命令都会使用它,而无需指定 `--db`: ``` python pyvfeed.py --set-dbfile /path/to/vfeed.db [+] DB file saved to /path/to/pyvfeed/.pyvfeedrc: /path/to/vfeed.db ``` 这会在项目目录中写入一个 `.pyvfeedrc` 文件。所有后续运行都会自动识别它。 ### 3. 覆盖单次运行的 DB 使用 `--db` 指向不同的数据库,而无需更改 `.pyvfeedrc`: ``` python pyvfeed.py --db /tmp/other.db --information CVE-2017-9805 ``` **DB 解析顺序:** `common/config.py` → `.pyvfeedrc` → `--db` ## 数据库管理 ### 显示 DB schema ``` python pyvfeed.py --schema ``` 打印 SQLite3 DB 中的所有 `CREATE TABLE` 和 `CREATE INDEX` 语句。 ### 更新授权 DB 需要在 `common/config.py` 中提供有效的订阅密钥: ``` python pyvfeed.py --update [+] Checking update status ... [-] Checksum verification a3f1... [-] Already updated [+] Cleaning tmp downloads ... ``` 如果本地 DB 已过期,它会自动下载并解压最新版本。 ### 版本信息 ``` python pyvfeed.py --version { "title": "Python CLI for vFeed Vulnerability and Threat Intelligence - Pro Edition", "build": "2.0.0", "support": "support@vfeed.io" } ``` ## 漏洞查询 所有查询命令都接受 CVE 或 CPE 标识符并返回 JSON。 ### 信息 基本的漏洞元数据,包括 NVD 状态和分类标志(如果可用)。 ``` python pyvfeed.py --information CVE-2017-9805 { "information": { "description": [ { "id": "CVE-2017-9805", "parameters": { "published": "2017-09-05T17:29Z", "modified": "2019-10-03T00:03Z", "summary": "The REST Plugin in Apache Struts 2.1.2 ...", "vuln_status": "Analyzed", "source_identifier": "security@apache.org", "has_exploits": true, "has_kev_cisa": true, "has_patches": true, "has_advisory": true, "risk_score": 0.94 } } ], "references": [ { "vendor": "MISC", "url": "https://..." } ] } } ``` ### 分类 CPE 目标、受影响的包以及带有 MITRE ATT&CK 排名的 CWE 弱点。 ``` python pyvfeed.py --classification CVE-2017-9805 ``` ### 风险 CVSS 2、CVSS 3、CVSS 4(如果可用)、EPSS 概率以及 CISA KEV 目录条目。 ``` python pyvfeed.py --risk CVE-2017-9805 { "risk": { "cvss": { "cvss2": { "vector": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "base_score": "6.8", ... }, "cvss3": { "vector": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "base_score": "8.1", ... }, "cvss4": { "vector": "CVSS:4.0/AV:N/AC:L/...", "base_score": "9.3", ... } }, "epss": { "probability": 0.95975, "percentile": 0.99987 }, "kev": { "id": "CISA:BOD 22-01", "parameters": { "date_added": "2021-11-03", "date_due": "2022-05-03", "name": "Apache Struts Multiple Versions Remote Code Execution Vulnerability", "vendor": "Apache", "product": "Struts", "required_action": "Apply updates per vendor instructions.", "url": "https://www.cisa.gov/known-exploited-vulnerabilities-catalog" } } } } ``` ### 公告 针对给定 CVE,从公告数据库中获取的顶级公告。 ``` python pyvfeed.py --advisory CVE-2017-9805 [ { "type": "vendor", "source": "Apache", "id": "S2-052", "link": "https://cwiki.apache.org/confluence/display/WW/S2-052" }, ... ] ``` ### MITRE CWE 和 ATT&CK 通过 CVE → CWE → CAPEC → ATT&CK 链解析的 CWE 弱点和 ATT&CK 技术。 ``` python pyvfeed.py --mitre CVE-2017-9805 { "cve_id": "CVE-2017-9805", "weaknesses": [ { "cwe_id": "CWE-502", "title": "Deserialization of Untrusted Data", "class": "weakness", "url": "https://cwe.mitre.org/data/definitions/502.html", "attack_techniques": [ { "id": "T1059", "name": "Command and Scripting Interpreter", "tactic": "execution", "description": "...", "url": "https://attack.mitre.org/techniques/T1059/" } ] } ] } ``` ### 检查 远程和本地漏洞扫描器签名(Nessus、OpenVAS 等)。 ``` python pyvfeed.py --inspection CVE-2017-9805 ``` ### 漏洞利用 来自 ExploitDB、Metasploit 和其他来源的漏洞利用和 PoC。 ``` python pyvfeed.py --exploitation CVE-2017-9805 ``` ### 防御 供应商补丁、安全公告、IDS/IPS 规则(Snort、Suricata、Juniper)。 ``` python pyvfeed.py --defense CVE-2017-9805 ``` ### 导出 将某个 CVE 的所有元数据导出为配置好的导出路径下的 JSON 文件。 ``` python pyvfeed.py --export CVE-2017-9805 # 生成:CVE-2017-9805.json ``` ## 搜索 ### 按 CVE 搜索 返回基本信息以及任何可用的漏洞利用。 ``` python pyvfeed.py --search cve CVE-2017-9805 ``` ### 按 CPE 搜索 同时接受 CPE 2.2 (`cpe:/`) 和 CPE 2.3 (`cpe:2.3:`) 格式。 ``` python pyvfeed.py --search cpe "cpe:2.3:a:apache:struts:2.3.5:*:*:*:*:*:*:*" python pyvfeed.py --search cpe "cpe:/a:apache:struts:2.3.5" ``` ### 按 CWE 搜索 返回与 CWE 标识符关联的所有 CVE。 ``` python pyvfeed.py --search cwe CWE-502 { "id": "CWE-502", "parameters": { "title": "Deserialization of Untrusted Data", "class": "weakness", "url": "https://cwe.mitre.org/data/definitions/502.html" }, "vulnerability": [ "CVE-2017-9805", "CVE-2019-0232", ... ] } ``` ## 语言漏洞 列出与某种编程语言相关的 CVE,并附带 CVSS 分数和元数据。 ``` python pyvfeed.py --lang python python pyvfeed.py --lang cpp python pyvfeed.py --lang javascript python pyvfeed.py --lang golang python pyvfeed.py --lang java ``` 输出条目示例: ``` { "cve_id": "CVE-2021-3177", "summary": "Python 3.x through 3.9.1 has a buffer overflow ...", "cvss3_vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "cpe23_id": "cpe:2.3:a:python:python:3.9.0:*:*:*:*:*:*:*", "cvss4_vector": "CVSS:4.0/AV:N/AC:L/...", "cvss4_base": "9.3", "vuln_status": "Analyzed", "has_exploits": true, "risk_score": 0.87 } ``` ## 包漏洞 列出影响特定包的 CVE,带有可选的版本范围过滤器。 ``` # 所有版本 python pyvfeed.py --pkgs wordpress # 特定版本范围 python pyvfeed.py --pkgs openssl 1.0.1 ``` ## 配置 ### common/config.py 默认数据库和导出路径,以及用于授权 DB 更新的订阅密钥: ``` database = { "file": "vfeed.db", "path": "./" } export = {"path": "/tmp"} subscription = { "access_key": "YOUR_ACCESS_KEY", "secret_key": "YOUR_SECRET_KEY", "plan": "YOUR_PLAN" } ``` ### .pyvfeedrc 由 `--set-dbfile` 自动创建。存储在项目目录中: ``` { "dbfile": "/path/to/vfeed.db" } ``` ## 完整帮助 ``` python pyvfeed.py --help usage: pyvfeed [-h] [--db FILE] [--set-dbfile FILE] [--schema] [--update] [--download-demo-db] [--information CVE|CPE] [--classification CVE|CPE] [--risk CVE|CPE] [--inspection CVE|CPE] [--exploitation CVE|CPE] [--defense CVE|CPE] [--advisory CVE] [--mitre CVE] [--export CVE|CPE] [--search TYPE ID] [--lang LANGUAGE] [--pkgs PACKAGE [PACKAGE ...]] [--version] [--plugin NAME TARGET] Python CLI for vFeed Vulnerability and Threat Intelligence - Pro Edition database: --db FILE SQLite3 DB file to use (overrides config and .pyvfeedrc) --set-dbfile FILE Permanently save DB file path to .pyvfeedrc --schema Print DB schema to stdout --update Update the vFeed database --download-demo-db Download demo vFeed DB vulnerability queries: --information CVE|CPE --classification CVE|CPE --risk CVE|CPE --inspection CVE|CPE --exploitation CVE|CPE --defense CVE|CPE --advisory CVE --mitre CVE --export CVE|CPE search: --search TYPE ID Search by type (cpe, cve, cwe) and identifier --lang LANGUAGE List CVEs for a language --pkgs PACKAGE ... List CVEs for a package and optional version miscellaneous: --version Show version and build info --plugin NAME TARGET Load and run a third-party plugin ```
Copyright (C) vFeed IO vFeed 2026.
标签:CVE, Python, 威胁情报, 安全数据库, 开发者工具, 数字签名, 无后门, 漏洞查询, 逆向工具