Update.sh in pentest distro

No replies
Liyan oz
Liyan oz's picture
Offline
Neophyte
Joined: 2011/04/11

Helloo everybody first time meet you, iam new here, and i try to share my knowledge,
ok we will talk about linux now, linux is the best OS i think Laughing out loud
and basicly we love penetration hehehe,, we know it..
ok for your penetration distro like gnacktrack,blackbuntu,backtrack,backbox or ect
i have one script for this distro to update many application we need,,
lets start it

#!/bin/bash
#__________________________________________________________
# Authors:              noes!s (<a href="mailto:blaksark@gmail.com">blaksark@gmail.com</a>)
#                               phillips321 (forum.gnacktrack.co.uk)
# Auditor/publisher ; Liyan Oz
# License:              CC BY-SA 3.0
# Use:                  Update several applications on GnackTrack
#__________________________________________________________

version="0.5" #April/2011
script="Updater"
changes="Bugged updates are on yellow."

# Changelog:
# v0.5 - Wicd added.
# v0.4 - Beef, Armitage fixed; bugged updates on yellow, news and tips msgs.
# v0.3 - Formatted layout with indentation and function names
# v0.2 - Fixed Armitage updater
#
# - Add new APPs to this list. DONT USE spaces for the names.
# - You can add up to 25 APPs/Updates in this version.
# - Update the full_updates_list (at the end of this list).

LIST(){
n1=Framework3 ; upd1() { svn up /pentest/exploits/framework3/ ;}
n2=w3af ; upd2() { svn up /pentest/web/w3af/ ;}
n3=SET ; upd4() { cd /pentest/exploits/SET/ ; ./set-update ;}
n4=FastTrack ; upd5() { cd /pentest/exploits/fasttrack/ ; ./fast-track.py -c 1 1 ;}
n5=BlindElephant ; upd6() { cd /pentest/web/blindelephant/ ; svn up; cd src; python setup.py install ;}
n6=SQLMap ; upd7() { svn up /pentest/database/sqlmap/ ;}
n7=Beef ; upd8() { cd /var/www/beef/ ; svn up; ruby install.rb ;}
n8=Middler ; upd9() { svn up /pentest/spoofing/middler/ ;}
n9=PentBox ; upd10() { svn up /pentest/exploits/pentbox/ ;}
n10=Nikto  ; upd11() { cd /pentest/web/nikto/ ; svn up ; ./nikto.pl -update ;}
n11=Arachni ; upd12() { cd /pentest/scanners/arachni/ ; git pull; rake install ;}
n12=Framework2 ; upd13() { svn up /pentest/exploits/framework2/ ;}
n13=Wifite ; upd14() { /pentest/wireless/wifite.py --update ;}
n14=Kismet ; upd15() { cd /pentest/wireless/kismet-newcore/ ; svn up ; ./configure && make dep && make && make install  ;}
n15=Armitage ; upd16() { cd /pentest/exploits/armitage; rm release/armitage-unix/armitage; svn up; ./package.sh  ;}
n16=`echo -e '\e[33mHostmap\e[m'` ; upd17() { svn up /pentest/enumeration/dns/hostmap/ ;}
n17=`echo -e '\e[33mOpenVAS\e[m'` ; upd3() { openvas-nvt-sync ;}
n18=`echo -e '\e[33mExploitDB\e[m'` ; upd18() { svn up /pentest/exploits/exploitdb ;}
n19=`echo -e '\e[33mNessus\e[m'` ; upd19() { /opt/nessus/sbin/nessus-update-plugins ;}
n20=Wicd ; upd20() { sudo apt-get install -y bzr; bzr branch lp:wicd; cd wicd; python setup.py configure; python setup.py install ;}
### IF YOU ADD SOMETHING THEN ADD IT TO THE FULL_UPDATES_LIST section below
}

FULL_UPDATES_LIST(){ upd1; upd2; upd3; upd4; upd5; upd6; upd7; upd8; upd9; upd10; upd11; upd12; upd13; upd14; upd15; upd16; upd17; upd18; upd19; upd20; }

MOD_MENU()
{
                back=`echo -e '\e[1;30m<<                  \e[m'`
                ALL=`echo -e '\e[37mALL\e[m'`
                line="echo -e \e[30m_____________________________________________________\e[m"
                user=`who wants beer? | awk '{ print $1 }'`
                kernel=`uname -r`
                defaultdir=`pwd`

                msg_top() { clear; echo -e "\e[1;32m<<\e[1;30mnoes1s\e[1;32m/\e[0;34m $script\e[0;34m $version\e[m\n" ;}
                msg_info() { echo -e "\e[0;36m Welcome \e[1;36m$user\e[0;36m. $changes\e[m"; $line ;}
                cfgmsg() { echo; echo -e "\e[1;32m Updating $option...\e[m\n";}
                okmsg() { msg_top ; echo -e "\e[1;32m $option \e[1;32mupdated!\e[m" ; $line; menu ; break; }
                        x1_infomsg() { clear; msg_top; echo -e "\e[1;36m $x1_info\e[m"; $line ;}
                        x2_infomsg() { clear; msg_top; echo -e "\e[1;36m $x2_info\e[m"; $line ;}
                        x3_infomsg() { clear; msg_top; echo -e "\e[1;36m $x3_info\e[m"; $line ;}
                        msg_invalid() { clear; msg_top; echo -e "\e[1;33m Invalid Option!\e[m"; $line;}
                        check() { [[ $option = '' ]] && msg_invalid; }

                menu_options=("$back" $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8 $n9 $n10
                                 "$ALL" $n11 $n12 $n13 $n14 $n15 $n16 $n17 $n18 $n19 $n20
                                        $n21 $n22 $n23 $n24 $n25 )

                menu()
                {
                        select option in "${menu_options[@]}"
                        do
                        case $option in
                                "$back") cd $defaultdir; break;;
                                "$ALL") cfgmsg; FULL_UPDATES_LIST; sleep 3 ; okmsg;;
                                "$n1") check; cfgmsg; upd1; sleep 3 ; okmsg;;
                                "$n2") check; cfgmsg; upd2; sleep 3 ; okmsg;;
                                "$n3") check; cfgmsg; upd3; sleep 3 ; okmsg;;
                                "$n4") check; cfgmsg; upd4; sleep 3 ; okmsg;;
                                "$n5") check; cfgmsg; upd5; sleep 3 ; okmsg;;
                                "$n6") check; cfgmsg; upd6; sleep 3 ; okmsg;;
                                "$n7") check; cfgmsg; upd7; sleep 3 ; okmsg;;
                                "$n8") check; cfgmsg; upd8; sleep 3 ; okmsg;;
                                "$n9") check; cfgmsg; upd9; sleep 3 ; okmsg;;
                                "$n10") check; cfgmsg; upd10; sleep 3 ; okmsg;;
                                "$n11") check; cfgmsg; upd11; sleep 3 ; okmsg;;
                                "$n12") check; cfgmsg; upd12; sleep 3 ; okmsg;;
                                "$n13") check; cfgmsg; upd13; sleep 3 ; okmsg;;
                                "$n14") check; cfgmsg; upd14; sleep 3 ; okmsg;;
                                "$n15") check; cfgmsg; upd15; sleep 3 ; okmsg;;
                                "$n16") check; cfgmsg; upd16; sleep 3 ; okmsg;;
                                "$n17") check; cfgmsg; upd17; sleep 3 ; okmsg;;
                                "$n18") check; cfgmsg; upd18; sleep 3 ; okmsg;;
                                "$n19") check; cfgmsg; upd19; sleep 3 ; okmsg;;
                                "$n20") check; cfgmsg; upd20; sleep 3 ; okmsg;;
                                "$n21") check; cfgmsg; upd21; sleep 3 ; okmsg;;
                                "$n22") check; cfgmsg; upd22; sleep 3 ; okmsg;;
                                "$n23") check; cfgmsg; upd23; sleep 3 ; okmsg;;
                                "$n24") check; cfgmsg; upd24; sleep 3 ; okmsg;;
                                "$n25") check; cfgmsg; upd25; sleep 3 ; okmsg;;
                                *) msg_invalid; menu; break;;
                        esac
                        done
                }

        PS3=`echo -e '\e[0;30mChoose an option: \e[m'`
        msg_top; msg_info; menu
}

MOD_CHECKS()
{
        #Required functions and variables for this module
        defaultdir=`pwd`
        msg1_main() { clear; echo -e "\e[1;32m<<\e[1;30mnoes1s\e[1;32m/\e[0;34m $script\e[0;34m $version\e[m\n" ;}
        msg_ok() { echo -e "\e[1;32m OK\e[m\n"; sleep 1; }

        #Force-root:
        msg_root() { msg1_main; echo -e '\e[1;33m ERROR: This script has to be run with root permissions.\e[m\n'; exit 1 ;}
        [[ ${UID} -ne 0 ]] && msg_root

        #Force-connected:
        msg_net() { msg1_main; echo -e '\e[1;33m ERROR: You need to be connected to the internet.\e[m\n'; exit 1 ;}
        [[ `eval ping -c 1 ssl.scroogle.org` ]] || msg_net

        #Connection-check:
        msg_net() { msg1_main; echo -e '\e[1;33m Checking internet connection...\e[0;30m\n' ;}
        msg_net; sleep 1; [[ `eval 'ping -c 1 ssl.scroogle.org'` ]] && { net=ON; msg_ok ;} || net=OFF

        #Conflicts-check:
        msg_conf() { msg1_main; echo -e '\e[1;33m Checking conflicts...\e[0;30m\n' ;}
        msg_conf; kill -9 `ps -ef | grep synaptic| gawk '{print $2}'` 2</dev/null; sleep 1; msg_ok

        #Integrity-check:
        msg_integrity() { msg1_main; echo -e '\e[1;33m Checking packages integrity...\e[0;30m\n' ;}
        msg_integrity; apt-get install -f; dpkg --configure -a; msg_ok

        #Update-check:
        msg_updlist() { msg1_main; echo -e '\e[1;33m Updating list of packages...\e[0;30m\n' ;}
        [[ $net = ON ]] && { msg_updlist; apt-get update; msg_ok ;}

        #Dependency-check:
        msg_dep() { msg1_main; echo -e '\e[1;33m Checking dependencies...\e[0;30m\n' ;}
        msg_depins() { msg1_main; echo -e '\e[1;33m Installing dependencies...\e[0;30m\n' ;}
        msg_dep
        [[ `which aptitude` = '' ]] && { msg_depins; apt-get install -y -qq aptitude; msg_ok ;}
        #[[ `which module-assistant` = '' ]] && { msg_depins; apt-get install -y -qq module-assistant; msg_ok ;}
        [[ `which svn` = '' ]] && { msg_depins; apt-get install -y -qq subversion; msg_ok ;}
        [[ `which git` = '' ]] && { msg_depins; apt-get install -y -qq git; msg_ok ;}
}

MOD_CHECKS
LIST
MOD_MENU

# Good Luck

how to run it ?
its a bash script now open your terminal and dont forgot to give this script name like update.sh (OK)

on terminal type

# bash update.sh
the code will run,
and the screen will give infrmation like it
-----------------------------------------------------------
Updater /dev/null

Welcome
________________________________________
1) <<
2) Update applications
choose an option:
-----------------------------------------------------------

choose to and we will get 20 application of pentest distro to update manually..

good luck for you
dont forgot to visit my blog http://0nto.blogspot.com/

regards,
Liyan Oz

"Blood Line of underground Linux"