Omp-script: Unterschied zwischen den Versionen

Aus xinux wiki
Wechseln zu: Navigation, Suche
(Scan Scipt)
(Scan Scipt)
 
(2 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 
=Before to do=
 
=Before to do=
#create a target
+
 
#create a scan
+
    create a target
 +
    create a scan
  
 
=Scan Scipt=
 
=Scan Scipt=
Zeile 35: Zeile 36:
 
done
 
done
 
</pre>
 
</pre>
 +
 
=cronjob=
 
=cronjob=
 +
 +
=target-import-script=
 +
*/usr/local/sbin/create-target /root/target.list
 +
*vi /usr/local/sbin/create-target
 +
<pre>
 +
#!/bin/bash
 +
while read LINE
 +
do
 +
NAME=$(echo $LINE | cut -f 1 -d :)
 +
IP=$(echo $LINE | cut -f 2 -d :)
 +
cat<<HERE | omp -X -
 +
<create_target>
 +
<name>$NAME</name>
 +
<hosts>$IP</hosts>
 +
<port_list id="33d0cd82-57c6-11e1-8ed1-406186ea4fc5"/>
 +
</create_target>'
 +
HERE
 +
done < $1
 +
</pre>
 +
 +
*vi /root/target.list
 +
<pre>
 +
example-target:10.0.0.0/8
 +
</pre>

Aktuelle Version vom 16. Januar 2020, 09:16 Uhr

Before to do

   create a target
   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

target-import-script

  • /usr/local/sbin/create-target /root/target.list
  • vi /usr/local/sbin/create-target
#!/bin/bash
while read LINE
do
NAME=$(echo $LINE | cut -f 1 -d :)
IP=$(echo $LINE | cut -f 2 -d :)
cat<<HERE | omp -X -
<create_target>
<name>$NAME</name>
<hosts>$IP</hosts>
<port_list id="33d0cd82-57c6-11e1-8ed1-406186ea4fc5"/>
</create_target>'
HERE
done < $1
  • vi /root/target.list
example-target:10.0.0.0/8