Results 1 to 1 of 1

Thread: Openvas scripts update start and stop

Threaded View

  1. #1
    Just burned their ISO reaperz's Avatar
    Join Date
    Jan 2010
    Posts
    18

    Default Openvas scripts update start and stop

    Some scripts I wrote to start, update and stop openvas.
    Not much they do just what they say they do. Saves you a few keystrokes.
    Enjoy -Reaperz

    First the start and update script
    Code:
    #!/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 and clean script
    Code:
    #!/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..."
    banner got meshed up pasting it in here but script still works fine.
    Last edited by g0tmi1k; 01-09-2013 at 04:32 AM. Reason: Merged

Similar Threads

  1. How can I update all the scripts NSE of Nmap.
    By FlatL1ne in forum BackTrack 5 Beginners Section
    Replies: 1
    Last Post: 10-23-2012, 07:24 AM
  2. How to start/stop khotkeys
    By samtech in forum BackTrack 5 Beginners Section
    Replies: 1
    Last Post: 09-15-2012, 07:27 AM
  3. Can't find IPTABLES start/stop/restart service, rules file ...
    By elstupido in forum BackTrack 5 General Topics
    Replies: 5
    Last Post: 12-24-2011, 03:12 PM
  4. Starting openvas manager in backtrack5 - Can't start
    By msonga1 in forum BackTrack 5 Beginners Section
    Replies: 1
    Last Post: 12-08-2011, 11:38 AM
  5. OPENVAS 3.0 -update
    By Mr-Protocol in forum Tool Requests
    Replies: 4
    Last Post: 03-25-2010, 06:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •