Check severity: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| Zeile 1: | Zeile 1: | ||
| + | *apt install bc | ||
*cat /usr/local/bin/check_severity | *cat /usr/local/bin/check_severity | ||
<pre> | <pre> | ||
Version vom 2. Dezember 2021, 14:23 Uhr
- apt install bc
- cat /usr/local/bin/check_severity
#!/bin/bash
#• BSI Schwachstellenampel
#– 7.0 – 10.0: Rot
#– 4.0 – 6.9: Gelb
#– 0.0 – 3.9: Grün
file=$1
path="/var/www/scans/severity/"
if [[ ! -f $path$file ]]
then
echo "Status Warning - File $file not found"
exit 1
fi
severity=$(cat $path$file)
if [ $(echo "$severity>4" | bc) -eq 0 ]
then
echo "Status OK - Severity: $severity"
exit 0
elif [ $(echo "$severity>7" | bc) -eq 0 ]
then
echo "Status Warning - Severity: $severity"
exit 1
elif [ $(echo "$severity>10" | bc) -eq 0 ]
then
echo "Status Critical - Severity: $severity"
exit 2
fi