Created
January 11, 2024 06:29
-
-
Save leafsummer/a65b9d6249968fe03dbf6470c6b48f21 to your computer and use it in GitHub Desktop.
use shell to download the nvd cve datasource to save in the local files
This file contains 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
#!/bin/sh | |
# 下载nvd的数据源备份 | |
data_source="https://nvd.nist.gov/feeds/json/cve/1.1/" | |
download_dir="/data/SFTP/data/SDA/release/NVD/" | |
# file_name="nvdcve-1.1-{}.json.gz" | |
year=2002 | |
cur_year=$(date +"%Y") | |
# echo $cur_year | |
while [[ ${year} -le ${cur_year} ]]; do | |
time=$(date "+%Y-%m-%dT%H:%M:%S") | |
file_name="nvdcve-1.1-${year}.json.gz" | |
download_url=${data_source}${file_name} | |
echo "[${time}] start to download ${download_url} to NVD dir ...." | |
wget -q --no-check-certificate -O ${download_dir}${file_name} ${download_url} | |
time=$(date "+%Y-%m-%dT%H:%M:%S") | |
echo "[${time}] end to download ${download_url} to NVD dir" | |
year=$[ $year+1 ] | |
done | |
recent_file="nvdcve-1.1-recent.json.gz" | |
modified_file="nvdcve-1.1-modified.json.gz" | |
for file_name in ${recent_file} ${modified_file}; do | |
time=$(date "+%Y-%m-%dT%H:%M:%S") | |
download_url=${data_source}${file_name} | |
echo "[${time}] start to download ${download_url} to NVD dir ...." | |
wget -q --no-check-certificate -O ${download_dir}${file_name} ${download_url} | |
time=$(date "+%Y-%m-%dT%H:%M:%S") | |
echo "[${time}] end to download ${download_url} to NVD dir" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment