31 lines
948 B
Bash
Executable file
31 lines
948 B
Bash
Executable file
#!/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 '<span id="cvss3-link">Severity</span>.*?</strong>\s*\K[^<]+')
|
|
local description=$(echo "$html_content" | grep -oP '<p id="cvename-description">.*?\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
|