Check severity: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Zeile 1: Zeile 1:
*cat /usr/local/bin/check_severiy
+
*cat /usr/local/bin/check_severity
 
<pre>
 
<pre>
 
#!/bin/bash
 
#!/bin/bash

Version vom 2. Dezember 2021, 14:21 Uhr

  • 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