Omp-script

Aus xinux wiki
Wechseln zu: Navigation, Suche

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

cronjob