Omp-script: Unterschied zwischen den Versionen

Aus xinux.net
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „= =Scan Scipt= <pre> #!/bin/bash TARGET=$1 MAIL="technik@xxx.de" TASKID=$(omp -G | grep $TARGET | cut -c1-37) X=0 if ! [ -d "/tmp/openvas-reports" ] then…“)
 
Zeile 1: Zeile 1:
=
+
=Before to do=
 +
#create a target
 +
#create a scan
  
 
=Scan Scipt=
 
=Scan Scipt=
Zeile 5: Zeile 7:
 
#!/bin/bash
 
#!/bin/bash
 
TARGET=$1
 
TARGET=$1
 +
FORMAT="c402cc3e-b531-11e1-9163-406186ea4fc5"
 
MAIL="technik@xxx.de"
 
MAIL="technik@xxx.de"
 +
INFO="$TARGET scan pdf $(date)"
 
TASKID=$(omp -G | grep $TARGET | cut -c1-37)
 
TASKID=$(omp -G | grep $TARGET | cut -c1-37)
 
X=0
 
X=0
Zeile 22: Zeile 26:
 
         if [ "$PROGRESS" == "Done" ]
 
         if [ "$PROGRESS" == "Done" ]
 
         then
 
         then
                cd /tmp/openvas-reports
+
        cd /tmp/openvas-reports
                X=$((X+1))
+
        X=$((X+1))
                omp -R $REPORTID -f c402cc3e-b531-11e1-9163-406186ea4fc5 > $TARGET.pdf && echo $TARGET scan pdf $(date) | mutt -s "$TARGET scan pdf $(date)" $MAIL -a $TARGET.pdf
+
        omp -R $REPORTID -f $FORMAT > $TARGET.pdf && echo $INFO| mutt -s "$INFO" $MAIL -a $TARGET.pdf
 
         else
 
         else
 
                 PROGRESS=$(omp -G | grep $TARGET | cut -c39-42)
 
                 PROGRESS=$(omp -G | grep $TARGET | cut -c39-42)

Version vom 13. November 2018, 15:46 Uhr

Before to do

  1. create a target
  2. create a scan

Scan Scipt

#!/bin/bash
TARGET=$1
FORMAT="c402cc3e-b531-11e1-9163-406186ea4fc5"
MAIL="technik@xxx.de"
INFO="$TARGET scan pdf $(date)"
TASKID=$(omp -G | grep $TARGET | cut -c1-37)
X=0

if ! [ -d "/tmp/openvas-reports" ]
then
        mkdir /tmp/openvas-reports
fi

#starte scan
REPORTID=$(omp -S $TASKID)

echo start
while [ "$X" -lt "1" ]
do
        if [ "$PROGRESS" == "Done" ]
        then
         cd /tmp/openvas-reports
         X=$((X+1))
         omp -R $REPORTID -f $FORMAT > $TARGET.pdf && echo $INFO| mutt -s "$INFO" $MAIL -a $TARGET.pdf
        else
                PROGRESS=$(omp -G | grep $TARGET | cut -c39-42)
                sleep 60
        fi
done