Tag Archives: json

Get CVE information from NIST NVD and RHEL

Just two littel scripts that come handy if you want to download all the CVE info in JSON format for offline use.

#!/bin/bash
urls=$(curl https://nvd.nist.gov/vuln/data-feeds#JSON_FEED | grep 'https://' | grep -i json.gz | sed 's/.*href=//g' | cut -d\'  -f2)

mkdir -p ./nistNvdJson
cd nistNvdJson
for l in $urls;
do
wget $l
done
gunzip *
Donwload NIST NVD CVEs in JSON

 

#!/bin/bash


loopVar=1
dataDir="rhelCveData"
mkdir $dataDir -p
echo "getting data:"
T="$(date +%s)"
while [[ $loopVar -ne 0 ]];
do
        echo -n "-$loopVar- "
        data=$(curl -s https://access.redhat.com/labs/securitydataapi/cve.json?page=$loopVar)
        if [[ "$data" == "[]" ]]; then
                loopVar=0
        else
                toFile=$toFile${data:1:-1}", "
                let loopVar=loopVar+1
        fi
done
T="$(($(date +%s)-T))"
echo "[${toFile::-2}]" >> "$dataDir/rhelCve.json"
sed -i 's/^\[\]$//g' "$dataDir/rhelCve.json"
printf "Got data in: %02dd:%02dh:%02dm:%02ds\n" "$((T/86400))" "$((T/3600%24))" "$((T/60%60))" "$((T%60))"
Get CVE infos for RHEL

 

Additional information:
If you query the NIST NVD Data and search for RHEL CPEs you won’t get a lot of hits as only a smal percentage of the CVEs that affect Red Hat software has the correct CPE attached. However – NIST NVD is nice to have because in the Red Hat CVEs only the total CVSS score is listed but no detailed vulnerability metrics are included.