Adds cve details script
This commit is contained in:
parent
01371ba3b6
commit
81043e8ba1
1 changed files with 31 additions and 0 deletions
31
bin/.bin/cve-details
Executable file
31
bin/.bin/cve-details
Executable file
|
|
@ -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 '<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
|
||||
Loading…
Add table
Add a link
Reference in a new issue