mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-14 21:10:11 +01:00
36 lines
1.1 KiB
Bash
36 lines
1.1 KiB
Bash
#!/bin/sh
|
|
function cvecheck {
|
|
CVEDIR="/tmp/cve-indicator/"
|
|
CVEBIN="${CVEDIR}/bin"
|
|
REPORTS="reports"
|
|
mkdir -p $REPORTS
|
|
|
|
dpkg -s python3 python3-requests python3-yaml python3-mako python3-six &> /dev/null
|
|
if [ $? -ne 0 ]
|
|
then
|
|
echo "Missing dependencies"
|
|
sudo apt-get update
|
|
sudo apt-get install python3 python3-requests python3-yaml python3-mako python3-six
|
|
|
|
else
|
|
echo "Dependecy check passed"
|
|
fi
|
|
|
|
|
|
if [ -d "$CVEDIR" ]; then
|
|
### Take action if $DIR exists ###
|
|
echo "${CVEDIR} exists running cvecheck"
|
|
else
|
|
### Control will jump here if $DIR does NOT exists ###
|
|
echo "Error: cvecheck not found. getting from iopsys repo"
|
|
git clone git@dev.iopsys.eu:iopsys/cve-indicator.git /tmp/cve-indicator
|
|
fi
|
|
CVEGENLIST=`${CVEBIN}/cve-indicator gen-list openwrt bin`
|
|
CVEGETCVES=`${CVEBIN}/cve-indicator get-cves $CVEGENLIST --api_url http://cve.circl.lu/api/cvefor/`
|
|
CVEGETRPRT=`${CVEBIN}/cve-indicator gen-rprt $CVEGETCVES`
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
register_command "cvecheck" "Generate a CVE report on latest build"
|