cfg/bin/vuls-refresh
Knut Ahlers 358d665ff0
Add vuls helpers
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-08-17 11:57:04 +02:00

33 lines
827 B
Bash
Executable File

#!/bin/bash
set -euxo pipefail
CACHE_DIR="${HOME}/.cache/vuls"
# Fetch VND database
if [ -f "${CACHE_DIR}/cve.sqlite3" ]; then
# Database exists, only update
docker run --rm -it \
-v "${CACHE_DIR}:/vuls" \
vuls/go-cve-dictionary fetchnvd -last2y
else
# Database does not exist, do a full-fetch
docker run --rm -it \
-v "${CACHE_DIR}:/vuls" \
vuls/go-cve-dictionary fetchnvd -years $(seq 2002 $(date +%Y))
fi
# Fetch OVAL for common systems
docker run --rm -it \
-v "${CACHE_DIR}:/vuls" \
vuls/goval-dictionary fetch-alpine $(seq 3.3 0.1 3.7)
docker run --rm -it \
-v "${CACHE_DIR}:/vuls" \
vuls/goval-dictionary fetch-ubuntu $(seq 12 2 18)
# Ensure vuls binary
curl -sSfL https://github.com/future-architect/vuls/releases/download/v0.4.2/vuls_0.4.2_linux_amd64.tar.gz |
tar -C ${HOME}/.bin -xz vuls