2013
01.05

Openvas scripts update start and stop

Here are some scripts to update start and stop openvas security scanner.
I could have been done in 6 lines , but this was more fun!
So if you use OPENVAS give these scripts a try.

Start and upgrade script

#!/bin/bash
# Bash script to start openvas and greenbone services.
# startopenvas.sh v0.1 by r3@p3rz
# tested in backtrack 5R1 environment, run as root.
# written just to save some steps.
# could have been done in 6 lines , but this was more fun

# style variables
execstyle="[\e[01;32mx\e[00m]" # execute msgs style
warnstyle="[\e[01;31m!\e[00m]" # warning msgs stylee
infostyle="[\e[01;34mi\e[00m]" # informational msgs style

#fun little banner
clear
echo -e "\e[01;32m 
 _______ _______ _______ _ _______ _______
( ___ )( ____ )( ____ \( ( /||\ /|( ___ )( ____ \ 
| ( ) || ( )|| ( \/| \ ( || ) ( || ( ) || ( \/
| | | || (____)|| (__ | \ | || | | || (___) || (_____ 
| | | || _____)| __) | (\ \) |( ( ) )| ___ |(_____ )
| | | || ( | ( | | \ | \ \_/ / | ( ) | ) |
| (___) || ) | (____/\| ) \ | \ / | ) ( |/\____) |
(_______)|/ (_______/|/ )_) \_/ |/ \|\_______)
\e[0m"
echo -e "\e[1;1m..----=====*****(( Startup Script ))*******=====----..\e[0m"
echo -e "\e[31m *************************************************************\e[0m"
echo -e "\e[31m * *\e[0m"
echo -e "\e[31m * \e[1;37mStarting All OpenVas Services \e[0;31m*\e[0m"
echo -e "\e[31m * *\e[0m"
echo -e "\e[31m *************************************************************\e[0m"

echo
echo -e "\e[31mKilling all Openvas for fresh start.\e[0m"
#kill openvas scanner
echo -e "$execstyle Checking OpenVas Scanner is running..."
ps -ef | grep -v grep | grep openvassd
if [ $? -eq 1 ]
 then
	echo -e "$warnstyle OpenVas Scanner not running!" 
 else
	echo -e "$execstyle Stopping OpenVas Scanner..."
	killall openvassd
fi

#kill openvas administrator
echo -e "$execstyle Checking if OpenVas Administrator is running..."
ps -ef | grep -v grep | grep openvasad
if [ $? -eq 1 ]
 then
	echo -e "$warnstyle OpenVas Administrator not running!" 
 else
	echo -e "$execstyle Stopping OpenVas Administrator..."
	killall openvasad
fi

#kill openvas manager
echo -e "$execstyle Checking if OpenVas Manager is running..."
ps -ef | grep -v grep | grep openvasmd
if [ $? -eq 1 ]
 then
	echo -e "$warnstyle OpenVas Manager not running!" 
 else
	echo -e "$execstyle Stopping OpenVas Manager..."
	killall openvasmd
fi

#kill Greenbone Security Assistant
echo -e "$execstyle Checking if Greenbone Security Assistant is running..."
ps -ef | grep -v grep | grep gsad
if [ $? -eq 1 ]
 then
	echo -e "$warnstyle Greenbone Security Assistant not running!" 
 else
	echo -e "$execstyle Stopping Greenbone Security Assistant..."
	killall gsad
fi

#### all done! now start services
echo
echo -e "\033[31mAll Done!! :\033[m
Now starting OpenVas services..."

echo -e "\033[31mSyncing updates.......\033[m
This may take a while!!!!"
openvas-nvt-sync
echo ok!

echo -e "\e[31mStarting OpenVas Scanner.\e[0m"
openvassd
echo ok!

echo -e "\033[31mRebuilding database......\033[m
This may take a while!!!!"
openvasmd --rebuild
echo ok!

echo -e "\e[31mStarting OpenVas Manager.\e[0m"
openvasmd -p 9390 -a 127.0.0.1
echo ok!

echo -e "\e[31mStarting OpenVas Administrator.\e[0m"
openvasad -a 127.0.0.1 -p 9393
echo ok!

echo -e "\e[31mStarting Greenbone Security Assistant.\e[0m"
gsad --http-only --listen=127.0.0.1 -p 9392
echo ok! All should be good!

#is it up openvas scanner
echo -e "$execstyle Checking if OpenVas Scanner is running..."
ps -ef | grep -v grep | grep openvassd
if [ $? -eq 1 ]
 then
	echo -e "$warnstyle OpenVas Scanner not running!" 
 else
	echo -e "$infostyle OpenVas Scanner is running!!"
fi

#is it up openvas administrator
echo -e "$execstyle Checking if OpenVas Administrator is running..."
ps -ef | grep -v grep | grep openvasad
if [ $? -eq 1 ]
 then
	echo -e "$warnstyle OpenVas Administrator not running!" 
 else
	echo -e "$infostyle OpenVas Administrator is running!!"
fi

#is it up openvas manager
echo -e "$execstyle Checking if OpenVas Manager is running..."
ps -ef | grep -v grep | grep openvasmd
if [ $? -eq 1 ]
 then
	echo -e "$warnstyle OpenVas Manager not running!" 
 else
	echo -e "$infostyle OpenVas Manager is running!!"
fi

#is it up Greenbone Security Assistant
echo -e "$execstyle Checking if Greenbone Security Assistant is running..."
ps -ef | grep -v grep | grep gsad
if [ $? -eq 1 ]
 then
	echo -e "$warnstyle Greenbone Security Assistant not running!" 
 else
	echo -e "$infostyle Greenbone Security Assistant is running"
fi

#### all done!
echo
echo -e "\033[01;32mOK!!\033[m"
echo -e "\033[31mAll Done!! :)\033[m
OpenVas is running!! Open browser to 127.0.0.1:9392 or open Green Bone Security Desktop.
You can close this window now!"

Now the stop

 

#!/bin/bash
# Bash script to stop openvas and greenbone services.
# stopopenvas.sh v0.1 by r3@p3rz
# tested in backtrack 5R1 environment, run as root.
# written just to save some steps.
# could have been done in a single line 
# -ie. echo ; killall openvassd ; killall openvasad ; killall openvasmd ; killall gsad
# but this was more fun

# style variables
execstyle="[\e[01;32mx\e[00m]" # execute msgs style
warnstyle="[\e[01;31m!\e[00m]" # warning msgs style
infostyle="[\e[01;34mi\e[00m]" # informational msgs style

#fun little banner
clear
echo -e "\e[01;32m 
 _______ _______ _______ _ _______ _______
( ___ )( ____ )( ____ \( ( /||\ /|( ___ )( ____ \ 
| ( ) || ( )|| ( \/| \ ( || ) ( || ( ) || ( \/
| | | || (____)|| (__ | \ | || | | || (___) || (_____ 
| | | || _____)| __) | (\ \) |( ( ) )| ___ |(_____ )
| | | || ( | ( | | \ | \ \_/ / | ( ) | ) |
| (___) || ) | (____/\| ) \ | \ / | ) ( |/\____) |
(_______)|/ (_______/|/ )_) \_/ |/ \|\_______)
\e[0m"
echo -e "\e[1;1m..----=====*****(( Shutdown Script ))*******=====----..\e[0m"
echo -e "\e[31m *************************************************************\e[0m"
echo -e "\e[31m * *\e[0m"
echo -e "\e[31m * \e[1;37mStopping All OpenVas Services \e[0;31m*\e[0m"
echo -e "\e[31m * *\e[0m"
echo -e "\e[31m *************************************************************\e[0m"

#kill openvas scanner
echo -e "$execstyle Checking OpenVas Scanner is running..."
ps -ef | grep -v grep | grep openvassd
if [ $? -eq 1 ]
 then
	echo -e "$warnstyle OpenVas Scanner not running!" 
 else
	echo -e "$execstyle Stopping OpenVas Scanner..."
	killall openvassd
	echo -e "$infostyle OpenVas Scanner is dead!!"
fi

#kill openvas administrator
echo -e "$execstyle Checking if OpenVas Administrator is running..."
ps -ef | grep -v grep | grep openvasad
if [ $? -eq 1 ]
 then
	echo -e "$warnstyle OpenVas Administrator not running!" 
 else
	echo -e "$execstyle Stopping OpenVas Administrator..."
	killall openvasad
	echo -e "$infostyle OpenVas Administrator is dead!!"
fi

#kill openvas manager
echo -e "$execstyle Checking if OpenVas Manager is running..."
ps -ef | grep -v grep | grep openvasmd
if [ $? -eq 1 ]
 then
	echo -e "$warnstyle OpenVas Manager not running!" 
 else
	echo -e "$execstyle Stopping OpenVas Manager..."
	killall openvasmd
	echo -e "$infostyle OpenVas Manager is dead!!"
fi

#kill Greenbone Security Assistant
echo -e "$execstyle Checking if Greenbone Security Assistant is running..."
ps -ef | grep -v grep | grep gsad
if [ $? -eq 1 ]
 then
	echo -e "$warnstyle Greenbone Security Assistant not running!" 
 else
	echo -e "$execstyle Stopping Greenbone Security Assistant..."
	killall gsad
	echo -e "$infostyle Greenbone Security Assistant is dead!!"

fi

#### all done!
echo
echo -e "\033[01;32m All Done!! :)\033[m
 You can close this window now..."

3 comments so far

Add Your Comment
  1. I appreciate your script(s). Thank you; they’ve been helpful for me in getting started with better using openVAS.

    Not sure if you noticed, but the ascii-text for the openVAS banner looks way off.

    I’ve tried to find a banner ‘generator’ that would ‘fix’ it. Am unable to locate one with the ascii line art like you did.

    • Lazykali has this script built in and the banner is fixed, wordpress messed it up. Glad you like the script.

  2. I found a site with what seems to be the right drawing style.
    http://www.patorjk.com/software/taag/#p=display&f=Graffiti&t=Type%20Something

    The style is “Epic”.

    Had to play with it for a minute so that it would display right when actually running the script. At the end of the first line, add an extra backslash (\) after the last one on the line, and it works perfectly from then on.

Current day month ye@r *

This site is protected by Comment SPAM Wiper.