From 81043e8ba13bf4a7434a6219a29b4fda13a1848f Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sun, 9 Nov 2025 09:49:53 +0000 Subject: [PATCH] Adds cve details script --- bin/.bin/cve-details | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 bin/.bin/cve-details diff --git a/bin/.bin/cve-details b/bin/.bin/cve-details new file mode 100755 index 00000000..091b654d --- /dev/null +++ b/bin/.bin/cve-details @@ -0,0 +1,31 @@ +#!/bin/bash + +# Function to scrape CVE details from the NVD website +function scrape_cve_details() { + local cve_id="$1" + local url="https://www.opencve.io/cve/$cve_id" + + # Use curl to fetch HTML content + local html_content=$(curl -s "$url") + + # Extract severity and description using grep + local severity=$(echo "$html_content" | grep -oP 'Severity.*?\s*\K[^<]+') + local description=$(echo "$html_content" | grep -oP '

.*?\s*\K[^<]+') + + # Output severity and description + echo "CVE: $cve_id" + echo "Severity: $severity" + echo "Description: $description" + echo "-----------------------------" +} + +# Check if at least one CVE is provided as an argument +if [ "$#" -eq 0 ]; then + echo "Usage: $0 CVE-2021-XXXXX [CVE-2021-YYYYY ...]" + exit 1 +fi + +# Loop through provided CVEs and scrape details +for cve in "$@"; do + scrape_cve_details "$cve" +done