Created
November 11, 2025 06:44
-
-
Save rhaps0dy/76515b02ba8cd0d33f3b22de42d01d1f to your computer and use it in GitHub Desktop.
Analyze CVE data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| from pathlib import Path | |
| cves_dir = Path('cves/2025') | |
| severity_count = {'CRITICAL': 0, 'HIGH': 0, 'MEDIUM': 0, 'LOW': 0, 'UNKNOWN': 0} | |
| total = 0 | |
| for json_file in cves_dir.rglob('*.json'): | |
| total += 1 | |
| try: | |
| with open(json_file, 'r') as f: | |
| cve_data = json.load(f) | |
| cna = cve_data.get('containers', {}).get('cna', {}) | |
| metrics = cna.get('metrics', []) | |
| severity = 'UNKNOWN' | |
| for metric in metrics: | |
| if 'cvssV3_1' in metric: | |
| severity = metric['cvssV3_1'].get('baseSeverity', 'UNKNOWN') | |
| break | |
| elif 'cvssV3_0' in metric: | |
| severity = metric['cvssV3_0'].get('baseSeverity', 'UNKNOWN') | |
| break | |
| elif 'cvssV4_0' in metric: | |
| severity = metric['cvssV4_0'].get('baseSeverity', 'UNKNOWN') | |
| break | |
| severity_count[severity] += 1 | |
| except: | |
| pass | |
| high_or_critical = severity_count['HIGH'] + severity_count['CRITICAL'] | |
| print('ALL 2025 CVEs BY SEVERITY') | |
| print('='*60) | |
| print(f'Total CVEs: {total:,}') | |
| print() | |
| print(f'CRITICAL: {severity_count[\"CRITICAL\"]:,} | |
| ({severity_count[\"CRITICAL\"]/total*100:.2f}%)') | |
| print(f'HIGH: {severity_count[\"HIGH\"]:,} | |
| ({severity_count[\"HIGH\"]/total*100:.2f}%)') | |
| print(f'MEDIUM: {severity_count[\"MEDIUM\"]:,} | |
| ({severity_count[\"MEDIUM\"]/total*100:.2f}%)') | |
| print(f'LOW: {severity_count[\"LOW\"]:,} | |
| ({severity_count[\"LOW\"]/total*100:.2f}%)') | |
| print(f'UNKNOWN: {severity_count[\"UNKNOWN\"]:,} | |
| ({severity_count[\"UNKNOWN\"]/total*100:.2f}%)') | |
| print() | |
| print(f'HIGH or CRITICAL: {high_or_critical:,} | |
| ({high_or_critical/total*100:.2f}%)') | |
| print() | |
| print('MEMORY CORRUPTION COMPARISON:') | |
| print(f' Memory Corruption (High/Critical): 2,004') | |
| print(f' As % of all High/Critical CVEs: {2004/high_or_critical*100:.2f}%') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment