#!/bin/bash # Back|Track 4 Update Utility # (C)opyright 2010 Scamentology vs="1.81" 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 ) apt-get everything (Change variable under OS update below to disable any features) # # ( -m ) Metasploit # # ( -a ) aircrack-ng and airgraph-ng # # ( -e ) exploitdb # # ( -s ) Social Engineering Toolkit # # ( -f ) Fasttrack # # ( -S ) SQLMap # # ( -n ) Nikto # # ( -N ) Nessus # # ( -w ) w3af # # # # ~Known Issues~ # # Let me know # # # # 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 -clean="yes"- to -clean="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 clean="yes" # (yes/no) Cleanup Downloaded Packages # Default Install Paths (Change these if your install path is different) framework3_path="/pentest/exploits/framework3/" # Metasploit framework 3 framework2_path="/pentest/exploits/framework2/" # Metasploit framework 2 aircrack_path="/pentest/wireless/aircrack-ng/" # Aircrack-ng airgraph_path="/pentest/wireless/airgraph-ng" # Airgraph-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" airgraph_svn="http://trac.aircrack-ng.org/svn/trunk/scripts/airgraph-ng" 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) framework3_command="svn update" framework2_command="svn update" aircrack_command="svn update" airgraph_command="svn 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 "################################################################"" # Help Section function help() { echo "(C)opyright 2010 Scamentology ~ ###################################### # btupdate $vs # # A script for updating Back|Track 4 # ###################################### Usage: update.sh [options] Options: -d [Dist-up] --- apt-get everything -m [Metasploit] --- Update Metasploit 2 and 3 (svn update) -a [aircrack-ng] --- Update aircrack-ng, airdrop-ng and airgraph-ng -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 -h [Help] --- Help menu Example: ./btupdate.sh -x (updates everything including apt-get ./btupdate.sh -d (apt-get update, upgrade and dist-upgrade) ./btupdate.sh -m -a -s -f (updates Metasploit Aircrack-ng SET and Fasttrack) " exit 1 } while getopts "dmaesSfnNwxh" OPTIONS; do case ${OPTIONS} in d ) distup="true" ;; # apt-get everything m ) metasploit="true" ;; # Update Metasploit 2 and 3 (svn co) a ) aircrack="true" ;; # Update aircrack-ng and airgraph-ng e ) exploitdb="true" ;; # 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 h ) help ;; # Help menu * ) help ;; # Default esac done #__ If the -x switch is chosen______________________________________________ if [ "$all" == "true" ] ; then metasploit="true" aircrack="true" distup="true" 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 "Run as root" ; exit 1 ; fi #__ If no choices are made _________________________________________________ if [ "$all" == "" ] && [ "$metasploit" == "" ] && [ "$aircrack" == "" ] && [ "$distup" == "" ] && [ "$SET" == "" ] && [ "$SQLMap" == "" ] && [ "$exploitdb" == "" ] && [ "$fasttrack" == "" ] && [ "$nikto" == "" ] && [ "$nessus" == "" ] && [ "$w3af" == "" ] ; then echo "Please choose an option" ; exit 1 ; fi #__ Distribution Upgrade Variables _________________________________________ if [ "$update" == "yes" ] ; then updatea="apt-get -y update" ; fi if [ "$upgrade" == "yes" ] ; then upgradea="apt-get -y upgrade" ; fi if [ "$dup" == "yes" ] ; then distupa="apt-get -y dist-upgrade" ; fi if [ "$clean" == "yes" ] ; then cleana="apt-get -y dist-upgrade" ; fi #__ _________________________ if [ "$cleanup" == "true" ] ; then clean="apt-get clean" ; fi #__ Checking for Internet___________________________________________________ if [ "$netcheck" == "yes" ] ; then clear $border1 echo "#[i] Checking for internet" $border1 for (( ; ; )) do ping -c 1 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 open 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 #__ Distribution and apt-get _______________________________________________ if [ "$distup" == "true" ] ; then clear echo " -- Updating Distribution --------------------" >> $log $border1 echo "[i] Updating Distribution..." $border1 $updatea && $upgradea && $distupa | grep "newly installed" >> $log $cleana fi #__ MSF Framework 3 ________________________________________________________ if [ "$metasploit" == "true" ] ; then clear echo " -- Framework 3 ------------------------------" >> $log $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 "You are up to date already (SVN $newsvn)" >> $log else $framework3_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi fi fi #__ MSF Framework 2 ________________________________________________________ if [ "$metasploit" == "true" ] ; then clear echo " -- Framework 2 ------------------------------" >> $log $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 "You are up to date already (SVN $newsvn)" >> $log else $framework2_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi fi fi #__ Aircrack-ng ____________________________________________________________ if [ "$aircrack" == "true" ] ; then clear echo " -- Aircrack-ng ------------------------------" >> $log $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 "You are up to date already (SVN $newsvn)" >> $log else $aircrack_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi fi fi #__ Airgraph-ng _____________________________________________________________ if [ "$aircrack" == "true" ] ; then clear echo " -- Airgraph-ng ----------------------------------" >> $log $border1 echo "[i] Updating Airgraph-ng..." $border1 cd $airgraph_path oldsvn=$(svn info | grep "Revision" | cut -c11-) newsvn=$(svn info $airgraph_svn | grep "Revision" | cut -c11-) if [ "$newsvn" == "$oldsvn" ] ; then echo "You are up to date already (SVN $newsvn)" >> $log else $airgraph_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi fi fi #__ Exploitdb ______________________________________________________________ if [ "$exploitdb" == "true" ] ; then clear echo " -- Exploitdb --------------------------------" >> $log $border1 echo "[i] Updating Exploitdb..." $border1 cd $exploitdb_path oldsvn=$(svn info | grep "Revision" | cut -c11-) newsvn=$(svn info $exploitdb_svn | grep "Revision" | cut -c11-) if [ "$newsvn" == "$oldsvn" ] ; then echo "You are up to date already (SVN $newsvn)" >> $log else rm -rf exploitdb/ $exploitdb_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi fi fi #__ Social Engineering Toolkit _____________________________________________ if [ "$SET" == "true" ] ; then clear echo " -- SET --------------------------------------" >> $log $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 "You are up to date already (SVN $newsvn)" >> $log else $set_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi fi fi #__ Fast-track _____________________________________________________________ if [ "$fasttrack" == "true" ] ; then clear echo " -- Fasttrack --------------------------------" >> $log $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 "You are up to date already (SVN $newsvn)" >> $log else $fasttrack_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi fi fi #__ SQLMap _________________________________________________________________ if [ "$SQLMap" == "true" ] ; then clear echo " -- SQLMap -----------------------------------" >> $log $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 "You are up to date already (SVN $newsvn)" >> $log else svn update upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi fi fi #__ Nikto __________________________________________________________________ if [ "$nikto" == "true" ] ; then clear echo " -- Nikto ------------------------------------" >> $log $border1 echo "[i] Updating Nikto... " $border1 cd $nikto_path $nikto_command | awk -v line=1 'NR == line { print $0 }' >> $log fi #__ Nessus _________________________________________________________________ if [ "$nessus" == "true" ] ; then clear echo " -- Nessus -----------------------------------" >> $log $border1 echo "[i] Updating Nessus... " $border1 cd $nessus_path $nessus_command | awk -v line=2 'NR == line { print $0 }' >> $log fi #__ w3af ___________________________________________________________________ if [ "$w3af" == "true" ] ; then clear echo " -- w3af -------------------------------------" >> $log $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 "You are up to date already (SVN $newsvn)" >> $log else $w3af_command upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to (SVN $upsvn)" >> $log ; fi if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi fi fi clear $border2 echo " Update report for $(date)" $border2 cat $log $border2 sleep 1 rm -f $log exit 1