#!/bin/bash
# Back|Track 4 Update Utility
# (C)opyright 2010 Scamentology
vs="1.83"
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... #
# ( -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 #
# #
# ~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
cleanup="yes" # (yes/no) Cleanup Downloaded Packages
# Default Install Paths (Change these if your install path is different)
openvas_path="/usr/local/sbin/" # Openvas
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"
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
-o [Openvas Plugins] --- 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
-z [Everything Except] --- Do all actions in script except apt-get
-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 "domaesSfnNwxzh" OPTIONS; do
case ${OPTIONS} in
d ) distup="true" ;; # apt-get everything
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="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 ) allbut="true" ;; # Do all actions in script except apt-get
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" == "" ] ; then echo "Please choose an option" ; exit 1 ; fi
#__ OS Update and 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 [ "$cleanup" == "true" ] ; then cleana="apt-get clean" ; 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 2 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
#__ Openvas Plugins ________________________________________________________
if [ "$openvas" == "true" ] ; then
if [ "$openvas_install" == "true" ] ; then
clear
$border1
echo "[i] Updating Openvas Plugins..."
$border1
echo " -- Openvas Plugins -----------------------" >> $log
$openvas_command
echo "openvas plugin sync completed" >> $log
fi
fi
#__ MSF Framework 3 ________________________________________________________
if [ "$metasploit" == "true" ] ; then
if [ "$framework3_install" == "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
else
echo " -- Framework 3 ------------------------------" >> $log
echo "[!] MSF 3 Not Installed in $framework3_path" >> $log
fi
fi
#__ MSF Framework 2 ________________________________________________________
if [ "$metasploit" == "true" ] ; then
if [ "$framework2_install" == "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
else
echo " -- Framework 2 ------------------------------" >> $log
echo "[!] MSF 2 Not Installed in $framework2_path" >> $log
fi
fi
#__ Aircrack-ng ____________________________________________________________
if [ "$aircrack" == "true" ] ; then
if [ "$aircrack_install" == "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
else
echo " -- Aircrack-ng ------------------------------" >> $log
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
if [ "$exploitdb_install" == "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
cd /pentest/exploits
rm -rf $exploitdb_path
$exploitdb_command
cd $exploitdb_path
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
else
echo " -- Exploitdb --------------------------------" >> $log
echo "[!] Exploitdb Not Installed in $exploitdb_path" >> $log
echo "[i] If it is installed then change default path in script" >> $log
fi
fi
#__ Social Engineering Toolkit _____________________________________________
if [ "$SET" == "true" ] ; then
if [ "$set_install" == "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
else
echo " -- SET --------------------------------------" >> $log
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
if [ "$fasttrack_install" == "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
else
echo " -- Fasttrack --------------------------------" >> $log
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
if [ "$sqlmap_install" == "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
$sqlmap_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
else
echo " -- SQLMap -----------------------------------" >> $log
echo "[!] SQLMap Not Installed in $sqlmap_path" >> $log
echo "[i] If it is installed then change default path in script" >> $log
fi
fi
#__ Nikto __________________________________________________________________
if [ "$nikto" == "true" ] ; then
if [ "$nikto_install" == "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
else
echo " -- Nikto -----------------------------------" >> $log
echo "[!] Nikto Not Installed in $nikto_path" >> $log
echo "[i] If it is installed then change default path in script" >> $log
fi
fi
#__ Nessus _________________________________________________________________
if [ "$nessus" == "true" ] ; then
if [ "$nessus_install" == "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
else
echo " -- Nessus -----------------------------------" >> $log
echo "[!] Nessus Not Installed in $nessus_path" >> $log
echo "[i] If it is installed then change default path in script" >> $log
fi
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