#!/bin/bash
# Back|Track 4 Update Utility
# (C)opyright 2010 Scamentology
vs="1.8"
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 <http://www.gnu.org/licenses/>. #
#----------------------------------------------------------------------------------------------#
################################################################################################
# #
# ~ btupdate.sh ( options ) ~ #
# Updates the following... #
# apt-get everything ( -d ) #
# Metasploit ( -m ) #
# aircrack-ng ( -a ) #
# exploitdb ( -e ) #
# Social Engineering Toolkit ( -s ) #
# Fasttrack ( -f ) #
# SQLMap ( -S ) #
# Nikto ( -n ) #
# Nessus ( - N ) #
# w3af ( -w ) #
# #
# ~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 #
# # line 181 #
# #
################################################################################################
# Variables
# 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
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://www.exploit-db.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"
exploitdb_command="svn update"
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 "################################################################""
function help() { #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
-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
-z [Almost Everything] --- Do all actions in script except apt-get upgrade/dist-upgrade
-h [Help] --- Help menu
Example:
./btupdate.sh -x (updates everything including apt-get
./btupdate.sh -d (apt-get update & upgrade & dist-upgrade)
./btupdate.sh -m -a -s -f (updates Metasploit Aircrack-ng SET and Fasttrack)
"
exit 1
}
while getopts "dmaesSfnNwxhz" OPTIONS; do
case ${OPTIONS} in
d ) dup="true" ;; # apt-get everything
m ) metasploit="true" ;; # Update Metasploit 2 and 3 (svn co)
a ) aircrack="true" ;; # Update aircrack-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
z ) partall="true";; # Do all actions in script exept apt-get upgrade & dist-upgrade
h ) help ;; # Help menu
* ) help ;; # Default
esac
done
#__ If the -x switch is chosen______________________________________________
if [ "$all" == "true" ] ; then
metasploit="true"
aircrack="true"
dup="true"
SET="true"
exploitdb="true"
fasttrack="true"
SQLMap="true"
nikto="true"
nessus="true"
w3af="true"
fi
#__ If the -z switch is chosen_______________________________________________
if [ "$partall" == "true" ] ; then
metasploit="true"
aircrack="true"
dup="false"
partapt="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" == "" ] && [ "$dup" == "" ] && [ "$SET" == "" ] && [ "$SQLMap" == "" ] && [ "$exploitdb" == "" ] && [ "$fasttrack" == "" ] && [ "$nikto" == "" ] && [ "$nessus" == "" ] && [ "$w3af" == "" ] ; then echo "Please choose an option" ; exit 1 ; fi
#__ _________________________
if [ "$cleanup" == "true" ] ; then clean="apt-get clean" ; fi
#__ Checking for Internet___________________________________________________
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
#__ Distribution and apt-get _______________________________________________
if [ "$dup" == "true" ] ; then
clear
echo " -- Updating Distribution --------------------" >> $log
$border1
echo "[i] Updating Distribution..."
$border1
apt-get -y update && apt-get -y upgrade && apt-get -y dist-upgrade | grep "newly installed" >> $log
$clean
fi
#__ Updating apt Cache _______________________________________________
if [ "$partapt" == "true" ] ; then
clear
echo " -- Updating apt Cache --------------------" >> $log
$border1
echo "[i] Updating apt Cache..."
$border1
apt-get update >> $log
$clean
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
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
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
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
#__ 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
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
#__ 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
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
#__ 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
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
#__ 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
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
#__ 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
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
clear
$border2
echo " Update report for $(date)"
$border2
cat $log
$border2
sleep 1
rm -f $log
exit 1