#!/bin/bash # Back|Track 4 Update Utility # (C)opyright 2010 Scamentology vs="1.88" clear #---License------------------------------------------------------------------------------------# # This program is free software: you can redistribute it and/or modify it under the terms # # of the GNU General Public License as published by the Free Software Foundation, either # # version 3 of the License, or (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; # # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See the GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License along with this program. # # If not, see . # #----------------------------------------------------------------------------------------------# ################################################################################################ # # # ~ btupdate.sh ( options ) ~ # # Updates the following... # # ( -d ) Run apt-get (Change variable under OS update below to disable any features) # # ( -o ) Openvas Plugin Sync # # ( -m ) Metasploit # # ( -a ) aircrack-ng # # ( -e ) exploitdb # # ( -s ) Social Engineering Toolkit # # ( -f ) Fasttrack # # ( -S ) SQLMap # # ( -n ) Nikto # # ( -N ) Nessus # # ( -w ) w3af # # ( -z ) Update everything except apt-get # # ( -F ) Update Firefox (Optional Update) # # # # ~Known Issues~ # # Let me know # # # # No verification for Openvas Plugin update # # SQLMaps SVN asks for passwords - Just keep hitting enter if you did this update # # !!!This program runs apt-get clean - so if you want to keep downloaded updates then # # change -cleanup="yes"- to -cleanup="no"- # # # ################################################################################################ # Variables # Check for Internet Access netcheck="yes" # (yes/no) no = don't check for internet access # OS Update and Upgrade Variables update="yes" # (yes/no) yes for Update upgrade="yes" # (yes/no) yes for Upgrade dup="yes" # (yes/no) yes for Distribution Update cleanup="yes" # (yes/no) Cleanup Downloaded Packages # aircrack-ng build options build="yes" # (yes/no) Will run ./build.sh oui="yes" # (yes/no) Runs airodump-ng-oui-update # Default Install Paths (Change these if your install path is different) openvas_path="/usr/local/sbin/" # Openvas ff_profile_path="/home/root/.mozilla" # Firefox profile location (.mozilla) framework3_path="/pentest/exploits/framework3" # Metasploit framework 3 framework2_path="/pentest/exploits/framework2" # Metasploit framework 2 aircrack_path="/pentest/wireless/aircrack-ng" # Aircrack-ng exploitdb_path="/pentest/exploits/exploitdb" # Exploitdb set_path="/pentest/exploits/SET" # Social Engineering Toolkit fasttrack_path="/pentest/exploits/fasttrack" # Fasttrack sqlmap_path="/pentest/database/sqlmap" # SQLMap nikto_path="/pentest/scanners/nikto" # Nikto nessus_path="/opt/nessus/sbin" # Nessus w3af_path="/pentest/web/w3af" # w3af # Online SVN Checks (Change these if the SVN link changes) framework3_svn="https://www.metasploit.com/svn/framework3/trunk" framework2_svn="https://www.metasploit.com/svn/framework2/trunk" aircrack_svn="http://trac.aircrack-ng.org/svn/trunk" exploitdb_svn="svn://devel.offensive-security.com/exploitdb" set_svn="http://svn.thepentest.com/social_engineering_toolkit" fasttrack_svn="http://svn.secmaniac.com/fasttrack" sqlmap_svn="http://svn.sqlmap.org/sqlmap/trunk/sqlmap" w3af_svn="https://w3af.svn.sourceforge.net/svnroot/w3af/trunk" # Update Commands (Change these if the build design changes - or they are wrong) openvas_command="openvas-nvt-sync" framework3_command="svn update" framework2_command="svn update" aircrack_command="svn update" air_build_command="./build.sh" oui_update_command="./scripts/airodump-ng-oui-update" exploitdb_command="svn co svn://devel.offensive-security.com/exploitdb" set_command="./set-update" fasttrack_command="svn update" sqlmap_command="svn update" nikto_command="perl nikto.pl -update" nessus_command="./nessus-update-plugins" w3af_command="svn update" #-- Nothing to change below this line -------------------------------------------------- # Temporary log location log="/tmp/btupdate.log" # Borders border1="echo "################################"" border2="echo "################################################################"" logborder="echo "-------------------------------------------------------"" # Misc Variable servererror="Server might be down or slow - Try again" noupdate="You are up to date already" updated="Updated successfully to" exploitdb_backup="/pentest/exploits/exploitdbbackup" # Don't change unless you know what your doing ff_profile_backup="/home/root/.mozillaold" # Don't change unless you know what your doing # Help Section function help() { echo "(C)opyright 2010 Scamentology ~ ###################################### # btupdate $vs # # A script for updating Back|Track 4 # ###################################### Usage: $0 [options] Options: -d [Dist-up] --- apt-get everything -o [Openvas Plugins] --- Update Openvas Plugins -m [Metasploit] --- Update Metasploit 2 and 3 (svn update) -a [aircrack-ng] --- Update aircrack-ng and airodump-ng suite -e [exploitdb] --- Update exploitdb -s [SET] --- Update Social Engineering Toolkit -S [SQLMap] --- Update SQLMap -f [Fasttrack] --- Update Fasttrack -n [Nikto] --- Update Nikto -N [Nessus] --- Update Nessus Plugins -w [w3af] --- Update w3af -x [Everything] --- Do all actions in script (No Firefox) -z [Everything Except] --- Do all actions in script except apt-get (No Firefox) -h [Help] --- Help menu Optional Updates (Should be done seperately (won't update with -x or -z)) -F [Firefox] --- Updates Firefox -K [KDE] --- Update KDE Example: $0 -x (updates everything including apt-get $0 -d (apt-get update, upgrade and dist-upgrade) $0 -m -a -s -f (updates Metasploit Aircrack-ng SET and Fasttrack) $0 -F (Updates Firefox)(won't update with -x or -z) " exit 1 } while getopts "dFomaesSfnNwxzh" OPTIONS; do case ${OPTIONS} in d ) distup="true" ;; # apt-get everything F ) firefox="true" ;; # Update Firefox ( Optional Update ) K ) kde="true" ;; # Update KDE o ) openvas="true" ;; # Openvas Plugin Sync m ) metasploit="true" ;; # Update Metasploit 2 and 3 (svn co) a ) aircrack="true" ;; # Update aircrack-ng and airgraph-ng e ) exploitdb="false" ;; # Broken for now # Update exploitdb s ) SET="true" ;; # Update Social Engineering Toolkit S ) SQLMap="true" ;; # Update SQLMap n ) nikto="true" ;; # Update Nikto plugins N ) nessus="true" ;; # Update Nessus plugins f ) fasttrack="true" ;; # Update Fasttrack w ) w3af="true" ;; # Update w3af x ) all="true" ;; # Do all actions in script (No Firefox) z ) allbut="true" ;; # Do all actions in script except apt-get (No Firefox) h ) help ;; # Help menu * ) help ;; # Default esac done #__ If the -x switch is chosen_____________________________________________________________________ if [ "$all" == "true" ] ; then openvas="true" metasploit="true" aircrack="true" distup="true" SET="true" exploitdb="true" fasttrack="true" SQLMap="true" nikto="true" nessus="true" w3af="true" fi #__ If the -z switch is chosen_____________________________________________________________________ if [ "$allbut" == "true" ] ; then openvas="true" metasploit="true" aircrack="true" distup="false" SET="true" exploitdb="true" fasttrack="true" SQLMap="true" nikto="true" nessus="true" w3af="true" fi echo " (C)opyright 2010 Scamentology ~" echo "######################################" echo "# btupdate $vs #" echo "# A script for updating Back|Track 4 #" echo "######################################" #__ Check if Root _________________________________________________________________________________ if [ "$(id -u)" != "0" ] ; then echo "You must be root to use Back|Track Update Utility" ; exit 1 ; fi #__ If no choices are made ________________________________________________________________________ if [ "$all" == "" ] && [ "$openvas" == "" ] && [ "$metasploit" == "" ] && [ "$aircrack" == "" ] && [ "$distup" == "" ] && [ "$SET" == "" ] && [ "$SQLMap" == "" ] && [ "$exploitdb" == "" ] && [ "$fasttrack" == "" ] && [ "$nikto" == "" ] && [ "$nessus" == "" ] && [ "$w3af" == "" ] && [ "$firefox" == "" ] && [ "$kde" == "" ] ; then $0 -h ; exit 1 ; fi #__ OS Update and Upgrade Variables _______________________________________________________________ if [ "$update" == "yes" ] ; then updateb="apt-get -y update" ; fi if [ "$upgrade" == "yes" ] ; then upgradeb="apt-get -y upgrade" ; fi if [ "$dup" == "yes" ] ; then distupb="apt-get -y dist-upgrade" ; fi if [ "$cleanup" == "yes" ] ; then cleana="apt-get clean" ; fi if [ "$cleanup" == "yes" ] ; then cleanb="apt-get clean" ; fi if [ "$firefox" == "true" ] && [ "$distup" == "true" ] && [ "$cleanup" == "yes" ] ; then updatea="apt-get -y update" cleana="" updateb="" cleanb="apt-get clean" fi if [ "$firefox" == "true" ] && [ "$distup" == "true" ] && [ "$cleanup" == "no" ] ; then updatea="apt-get -y update" cleana="" updateb="" cleanb="" fi if [ "$firefox" == "true" ] ; then updatea="apt-get -y update" fi #__ Check if Programs are Installed ______________________________________________________________ if [ -e "$framework3_path/msfconsole" ] ; then framework3_install="true" ; fi if [ -e "$framework2_path/msfconsole" ] ; then framework2_install="true" ; fi if [ -d "$aircrack_path" ] ; then aircrack_install="true" ; fi if [ -d "$exploitdb_path" ] ; then exploitdb_install="true" ; fi if [ -e "$set_path/set" ] ; then set_install="true" ; fi if [ -e "$fasttrack_path/fast-track.py" ] ; then fasttrack_install="true" ; fi if [ -e "$sqlmap_path/sqlmap.py" ] ; then sqlmap_install="true" ; fi if [ -e "$nikto_path/nikto.pl" ] ; then nikto_install="true" ; fi if [ -e "$nessus_path/nessusd" ] ; then nessus_install="true" ; fi if [ -e "$openvas_path/openvas-nvt-sync" ] ; then openvas_install="true" ; fi #__ Checking for Internet _________________________________________________________________________ if [ "$netcheck" == "yes" ] ; then clear $border1 echo "#[i] Checking for internet" $border1 for (( ; ; )) do ping -c 4 www.google.com >/dev/null return_val=$? if [ $return_val != "0" ] ; then clear $border2 echo "[!] Internet access: Failed..." $border2 echo "[i] Click yes to start networking then close wicd to continue" $border2 read -p "[?] Would you like to start WICD now? [Y/n]: " if [[ "$REPLY" =~ ^[Yy]$ ]] ; then wicd-gtk --no-tray else clear $border1 echo "[!] No internet access available" $border1 exit 1 fi else clear $border1 echo "[i] Internet access: Success" ; $border1 break; fi done fi #__ Firefox _______________________________________________________________________________________ if [ "$firefox" == "true" ] ; then $border1 echo "[i] Updating Firefox" $border1 $logborder >> $log if [ ! -d "/home/root/.mozilla" ] && [ ! -d "/root/.mozilla" ] ; then echo "The Firefox profile is not located in the default location - I can not successfully back it up. If you were running other updates then try again without the -F switch" ; exit 1 ; fi oldversion="$(firefox -v | cut -b 17-22)" cp /etc/apt/sources.list /etc/apt/sources.list.backup if [ ! -e "/etc/apt/sources.list.backup" ] ; then echo "Unable to backup sources.list. If you were running other updates then try again without the -F switch" ; exit 1 ; fi echo -e "\ndeb http://switch.dl.sourceforge.net/project/ubuntuzilla/mozilla/apt all main" >> /etc/apt/sources.list sort -u -o /etc/apt/sources.list /etc/apt/sources.list apt-key adv --recv-keys --keyserver keyserver.ubuntu.com C1289A29 if [ -d "/root/.mozilla" ] ; then cp -r /root/.mozilla /root/.mozillaold profile="[i] Old Firefox Profile Backed up to ~/.mozillaold" fi if [ -d "/home/root/.mozilla" ] ; then cp -r /home/root/.mozilla /home/root/.mozillaold profile="[i] Old Firefox Profile Backed up to /home/root/.mozillaold" fi $updatea apt-get install firefox-mozilla-build $cleana # cd /tmp/ # wget https://secure.informaction.com/download/releases/noscript-2.0.4.xpi # noscriptpath="ls | grep "noscript"" # firefox -install-global-extension $noscriptpath -silent # firefox -setDefaultBrowser -silent # rm -f $noscriptpath # firefox # cd /root/ newversion="$(firefox -v | cut -b 17-22)" if [ $newversion == $oldversion ] ; then echo "Firefox - $noupdate (VER $newversion)" >> $log ; fi if [ $newversion != $oldversion ] ; then echo "Firefox - $updated (VER $newversion)" >> $log echo "$profile" >> $log clear $border1 killall firefox-bin echo "[i] Start firefox now and ensure your profile is correct?" read -p "[?] If your profile is not correct then enter [n] and your backup profile will be replaced [y/n]" $border1 if [[ "$REPLY" =~ ^[Nn]$ ]] ; then killall firefox-bin cp /home/root/.mozillaold /home/root/.mozilla fi fi fi #__ KDE ___________________________________________________________________________________________ if [ "$kde" == "true" ] ; then apt-get install kdm apt-get install kde dpkg -i --force-overwrite /var/cache/apt/archives/kdebase-workspace-bin_4%3a4.1.4-0ubuntu1~intrepid3.1_i386.deb apt-get -f install sed -i 's/AllowRootLogin=false/AllowRootLogin=true/g' /etc/kde4/kdm/kdmrc sed -i 's/telinit 2/telinit 3/g' /etc/event.d/rc-default fi #__ MSF Framework 3 _______________________________________________________________________________ if [ "$metasploit" == "true" ] ; then $logborder >> $log if [ "$framework3_install" == "true" ] ; then clear $border1 echo "[i] Updating Framework 3..." $border1 cd $framework3_path oldsvn=$(svn info | grep "Revision" | cut -c11-) newsvn=$(svn info $framework3_svn | grep "Revision" | cut -c11-) if [ "$newsvn" == "$oldsvn" ] ; then echo "Framework 3 - $noupdate (SVN $newsvn)" >> $log else $framework3_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Framework 3 - $updated (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "Framework 3 - $servererror" >> $log ; fi fi else echo "[!] MSF 3 Not Installed in $framework3_path" >> $log fi fi #__ MSF Framework 2 _______________________________________________________________________________ if [ "$metasploit" == "true" ] ; then $logborder >> $log if [ "$framework2_install" == "true" ] ; then clear $border1 echo "[i] Updating Framework 2..." $border1 cd $framework2_path oldsvn=$(svn info | grep "Revision" | cut -c11-) newsvn=$(svn info $framework2_svn | grep "Revision" | cut -c11-) if [ "$newsvn" == "$oldsvn" ] ; then echo "Framework 2 - $noupdate (SVN $newsvn)" >> $log else $framework2_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Framework 2 - $updated (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "Framework 2 - $servererror" >> $log ; fi fi else echo "[!] MSF 2 Not Installed in $framework2_path" >> $log fi fi #__ Aircrack-ng ___________________________________________________________________________________ if [ "$aircrack" == "true" ] ; then $logborder >> $log if [ "$aircrack_install" == "true" ] ; then clear $border1 echo "[i] Updating aircrack-ng..." $border1 cd $aircrack_path oldsvn=$(svn info | grep "Revision" | cut -c11-) newsvn=$(svn info $aircrack_svn | grep "Revision" | cut -c11-) >> $log if [ "$newsvn" == "$oldsvn" ] ; then echo "Aircrack-ng - $noupdate (SVN $newsvn)" >> $log else $aircrack_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then if [ "$build" == "yes" ] ; then $air_build_command ; fi if [ "$oui" == "yes" ] ; then chmod a+x $oui_update_command $oui_update_command fi echo "Aircrack-ng - Updated Successfully to (SVN $upsvn)" >> $log fi if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi fi else echo "[!] Aircrack-ng Not Installed in $aircrack_path" >> $log echo "[i] If it is installed then change default path in script" >> $log fi fi #__ Exploitdb _____________________________________________________________________________________ if [ "$exploitdb" == "true" ] ; then $logborder >> $log cd $exploitdb_path if [ "$exploitdb_install" == "true" ] ; then clear $border1 echo "[i] Updating Exploitdb..." $border1 oldsvn=$(svn info | grep "Revision" | cut -c11-) newsvn=$(svn info $exploitdb_svn | grep "Revision" | cut -c11-) if [ "$newsvn" == "$oldsvn" ] ; then echo "Exploitdb - $noupdate (SVN $newsvn)" >> $log else $exploitdb_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Exploitdb - $updated (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "Exploitdb - $servererror" >> $log ; fi fi else echo "[!] Exploitdb Not Installed in $set_path" >> $log echo "[i] If it is installed then change default path in script" >> $log read -p "[?] Would you like to put a copy of it there? [y/n]" if [[ "$REPLY" =~ ^[Yy]$ ]] ; then cd /pentest/exploits $exploitdb_command cd $exploitdb_path upsvn=$(svn info | grep "Revision" | cut -c11-) if [ -d $exploitdb_path ] && [ "$newsvn" == "$upsvn" ] ; then echo "Exploitdb - $updated (SVN $upsvn)" >> $log else echo "Exploitdb - $servererror" >> $log fi else echo "Exploitdb - Interupted by user" >> $log fi fi fi #__ Social Engineering Toolkit ____________________________________________________________________ if [ "$SET" == "true" ] ; then if [ "$set_install" == "true" ] ; then $logborder >> $log clear $border1 echo "[i] Updating SET..." $border1 cd $set_path oldsvn=$(svn info | grep "Revision" | cut -c11-) newsvn=$(svn info $set_svn | grep "Revision" | cut -c11-) if [ "$newsvn" == "$oldsvn" ] ; then echo "SET - $noupdate (SVN $newsvn)" >> $log else $set_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "SET - $updated (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "SET - $servererror" >> $log ; fi fi else echo "[!] SET Not Installed in $set_path" >> $log echo "[i] If it is installed then change default path in script" >> $log fi fi #__ Fast-track ____________________________________________________________________________________ if [ "$fasttrack" == "true" ] ; then $logborder >> $log if [ "$fasttrack_install" == "true" ] ; then clear $border1 echo "[i] Updating Fasttrack... " $border1 cd $fasttrack_path oldsvn=$(svn info | grep "Revision" | cut -c11-) newsvn=$(svn info $fasttrack_svn | grep "Revision" | cut -c11-) if [ "$newsvn" == "$oldsvn" ] ; then echo "Fasttrack - $noupdate (SVN $newsvn)" >> $log else $fasttrack_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Fasttrack - $updated (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "Fasttrack - $servererror" >> $log ; fi fi else echo "[!] Fasttrack Not Installed in $fasttrack_path" >> $log echo "[i] If it is installed then change default path in script" >> $log fi fi #__ SQLMap ________________________________________________________________________________________ if [ "$SQLMap" == "true" ] ; then $logborder >> $log if [ "$sqlmap_install" == "true" ] ; then clear $border1 echo "[i] Updating SQLMap... " $border1 cd $sqlmap_path oldsvn=$(svn info | grep "Revision" | cut -c11-) newsvn=$(svn info $sqlmap_svn | grep "Revision" | cut -c11-) if [ "$newsvn" == "$oldsvn" ] ; then echo "SQLMap - $noupdate (SVN $newsvn)" >> $log else $sqlmap_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "SQLMap - $updated (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "SQLMap - $servererror" >> $log ; fi fi else echo "[!] SQLMap Not Installed in $sqlmap_path" >> $log echo "[i] If it is installed then change default path in script" >> $log fi fi #__ w3af __________________________________________________________________________________________ if [ "$w3af" == "true" ] ; then $logborder >> $log clear $border1 echo "[i] Updating w3af..." $border1 cd $w3af_path oldsvn=$(svn info | grep "Revision" | cut -c11-) newsvn=$(svn info $w3af_svn | grep "Revision" | cut -c11-) if [ "$newsvn" == "$oldsvn" ] ; then echo "w3af - $noupdate (SVN $newsvn)" >> $log else $w3af_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "w3af - $updated (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "w3af - $servererror" >> $log ; fi fi fi #__ Nikto _________________________________________________________________________________________ if [ "$nikto" == "true" ] ; then $logborder >> $log if [ "$nikto_install" == "true" ] ; then clear $border1 echo "[i] Updating Nikto... " $border1 cd $nikto_path result="$($nikto_command | awk -v line=1 'NR == line { print $0 }' | awk '{ print $2,$3,$4 }')" echo "Nikto - $result" >> $log else echo "[!] Nikto Not Installed in $nikto_path" >> $log echo "[i] If it is installed then change default path in script" >> $log fi fi #__ Openvas Plugins _______________________________________________________________________________ if [ "$openvas" == "true" ] ; then $logborder >> $log if [ "$openvas_install" == "true" ] ; then clear $border1 echo "[i] Updating Openvas Plugins..." $border1 $openvas_command echo "openvas - Plugins are up to date" >> $log fi fi #__ Nessus ________________________________________________________________________________________ if [ "$nessus" == "true" ] ; then $logborder >> $log if [ "$nessus_install" == "true" ] ; then clear $border1 echo "[i] Updating Nessus... " $border1 cd $nessus_path result="$($nessus_command | awk -v line=2 'NR == line { print $0 }' | awk '{ print $1 }')" if [ "$result" == "Done." ] ; then echo "Nessus - Plugins are up to date" >> $log else echo "Nessus - Update error" >> $log fi else echo "[!] Nessus Not Installed in $nessus_path" >> $log echo "[i] If it is installed then change default path in script" >> $log fi fi #__ Distribution and apt-get ______________________________________________________________________ if [ "$distup" == "true" ] ; then $logborder >> $log clear echo "Updating Distribution" >> $log $border1 echo "[i] Updating Distribution..." $border1 $updateb && $upgradeb && $distupb | grep "newly installed" >> $log $cleanb fi # __ Report _______________________________________________________________________________________ echo " " >> $log clear $border2 echo " Update report for $(date)" $border2 cat $log $border2 sleep 1 rm -f $log exit 1