{
"cells": [
{
"cell_type": "markdown",
"id": "604150b3-255c-441f-8f67-c95b2f91158e",
"metadata": {},
"source": [
"# CVE"
]
},
{
"cell_type": "markdown",
"id": "9688bdc8-ceb9-4fb5-a43b-588a5f108d83",
"metadata": {},
"source": [
"**Common Vulnerabilities and Exposures Identifier (CVE ID)** is a unique, alphanumeric identifier assigned by the CVE Program. Each identifier references a specific vulnerability. A CVE ID enables automation and multiple parties to discuss, share, and correlate information about a specific vulnerability, knowing they are referring to the same thing\n",
"\n",
"> source: [www.cve.org](https://www.cve.org/ResourcesSupport/Glossary?activeTerm=glossaryCVEID)"
]
},
{
"cell_type": "markdown",
"id": "bb012dcd-8476-4501-8ca2-1008a08588e3",
"metadata": {},
"source": [
"You can see this notebook directly via:\n",
"- [GitHub](https://github.com/LimberDuck/limberduck_org_julio_7/blob/main/docs/notebooks/cve/cve.ipynb)\n",
"- [Jupyter nbviewer](https://nbviewer.org/github/LimberDuck/limberduck_org_julio_7/blob/main/docs/notebooks/cve/cve.ipynb)"
]
},
{
"cell_type": "markdown",
"id": "f7c29080-90bd-4e34-bc6f-92511ed31595",
"metadata": {},
"source": [
"## Generation time"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "ff06696a-18c2-4c59-9cae-bc0dd8b7b308",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2025-04-05 17:08:26 +0000\n"
]
}
],
"source": [
"from datetime import datetime, timezone, timedelta\n",
"\n",
"timezone_offset = 0.0\n",
"tzinfo = timezone(timedelta(hours=timezone_offset))\n",
"generation_time = datetime.now(tzinfo).strftime('%Y-%m-%d %H:%M:%S %z')\n",
"print(generation_time)"
]
},
{
"cell_type": "markdown",
"id": "f3a4c46a-1ece-4601-9f72-90d64e12f888",
"metadata": {},
"source": [
"## Creative Commons"
]
},
{
"cell_type": "markdown",
"id": "33983601-bf85-4ba0-babc-5e3a69bc5ef4",
"metadata": {},
"source": [
"This notebook and generated diagrams are released with [Creative Commons liecense (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/deed.en).\n",
"\n",
"
"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "17811d3a-f62b-4c35-9bad-75fcdc9e9cf5",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"cc.xlarge.png\n",
"by.xlarge.png\n"
]
}
],
"source": [
"import requests\n",
"import urllib3\n",
"\n",
"urllib3.disable_warnings()\n",
"\n",
"urls = ['https://mirrors.creativecommons.org/presskit/icons/cc.xlarge.png',\n",
" 'https://mirrors.creativecommons.org/presskit/icons/by.xlarge.png']\n",
"for url in urls:\n",
" file_name = url.split(\"/\")[-1:][0]\n",
" print(file_name)\n",
"\n",
" file = requests.get(url, verify=False)\n",
" open(file_name, 'wb').write(file.content)"
]
},
{
"cell_type": "markdown",
"id": "f0d55e25-0b30-4377-95cf-20f471fcaf21",
"metadata": {},
"source": [
"## CVE data downloading"
]
},
{
"cell_type": "markdown",
"id": "b29a1112-344a-4015-91d1-c1ee0aa63629",
"metadata": {},
"source": [
"All CVE IDs are taken from [https://www.cve.org/Downloads](https://www.cve.org/Downloads)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "239ee776-f15c-43d4-a8f5-d1ca251f0f37",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"main.zip\n"
]
}
],
"source": [
"url = 'https://github.com/CVEProject/cvelistV5/archive/refs/heads/main.zip'\n",
"file_name = url.split(\"/\")[-1:][0]\n",
"print(file_name)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "50f24f67-75e2-4d85-bf23-47182cbf46f3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"465762550"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import requests\n",
"import urllib3\n",
"\n",
"urllib3.disable_warnings()\n",
"\n",
"file = requests.get(url, verify=False)\n",
"open(file_name, 'wb').write(file.content)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "e02dc4ee",
"metadata": {},
"outputs": [],
"source": [
"import zipfile\n",
"\n",
"with zipfile.ZipFile(file_name, 'r') as zip_ref:\n",
" zip_ref.extractall()"
]
},
{
"cell_type": "markdown",
"id": "cb262f32-6398-44c9-a365-d5e1b47dfcd8",
"metadata": {},
"source": [
"## CVE data parsing"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "69608e9f-cbad-40db-85f2-48d25d1aa381",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" number year\n",
"0 CVE-1999-0001 1999\n",
"1 CVE-1999-0002 1999\n",
"2 CVE-1999-0003 1999\n",
"3 CVE-1999-0004 1999\n",
"4 CVE-1999-0005 1999\n",
"... ... ...\n",
"288692 CVE-2025-3268 2025\n",
"288693 CVE-2025-3296 2025\n",
"288694 CVE-2025-3297 2025\n",
"288695 CVE-2025-3298 2025\n",
"288696 CVE-2025-3299 2025\n",
"\n",
"[288697 rows x 2 columns]\n"
]
}
],
"source": [
"import os\n",
"import json\n",
"import pandas as pd\n",
"\n",
"base_path = \"cvelistV5-main/cves\"\n",
"rows = []\n",
"\n",
"for item in os.listdir(base_path):\n",
" item_path = os.path.join(base_path, item)\n",
"\n",
" if not os.path.isdir(item_path) or not item.isdigit():\n",
" continue\n",
"\n",
" year = int(item)\n",
"\n",
" for root, dirs, files in os.walk(item_path):\n",
" for file in files:\n",
" if file.endswith(\".json\"):\n",
" full_path = os.path.join(root, file)\n",
"\n",
" try:\n",
" with open(full_path, \"r\", encoding=\"utf-8\") as f:\n",
" data = json.load(f)\n",
" cve_id = data.get(\"cveMetadata\", {}).get(\"cveId\")\n",
" if cve_id:\n",
" rows.append({\"number\": cve_id, \"year\": year})\n",
" except Exception as e:\n",
" print(f\"Failed to parse {full_path}: {e}\")\n",
"\n",
"df = pd.DataFrame(rows).sort_values(by=\"number\").reset_index(drop=True)\n",
"\n",
"print(df)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "ecbe6644-37e1-4747-b8cc-3181570bfb1e",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
| \n", " | year | \n", "number | \n", "
|---|---|---|
| 1 | \n", "1999 | \n", "1579 | \n", "
| 2 | \n", "2000 | \n", "1242 | \n", "
| 3 | \n", "2001 | \n", "1556 | \n", "
| 4 | \n", "2002 | \n", "2393 | \n", "
| 5 | \n", "2003 | \n", "1554 | \n", "
| 6 | \n", "2004 | \n", "2707 | \n", "
| 7 | \n", "2005 | \n", "4767 | \n", "
| 8 | \n", "2006 | \n", "7142 | \n", "
| 9 | \n", "2007 | \n", "6580 | \n", "
| 10 | \n", "2008 | \n", "7176 | \n", "
| 11 | \n", "2009 | \n", "5040 | \n", "
| 12 | \n", "2010 | \n", "5217 | \n", "
| 13 | \n", "2011 | \n", "4861 | \n", "
| 14 | \n", "2012 | \n", "5893 | \n", "
| 15 | \n", "2013 | \n", "6780 | \n", "
| 16 | \n", "2014 | \n", "8982 | \n", "
| 17 | \n", "2015 | \n", "8748 | \n", "
| 18 | \n", "2016 | \n", "10555 | \n", "
| 19 | \n", "2017 | \n", "17019 | \n", "
| 20 | \n", "2018 | \n", "17487 | \n", "
| 21 | \n", "2019 | \n", "17029 | \n", "
| 22 | \n", "2020 | \n", "20594 | \n", "
| 23 | \n", "2021 | \n", "23056 | \n", "
| 24 | \n", "2022 | \n", "26060 | \n", "
| 25 | \n", "2023 | \n", "29523 | \n", "
| 26 | \n", "2024 | \n", "37576 | \n", "
| 27 | \n", "2025 | \n", "7581 | \n", "