#!/bin/bash #(C)opyright 2010 Scamentology vs="1.4" 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~ # # Updates the following... # # apt-get everything ( -d ) # # Metasploit ( -m ) # # aircrack-ng ( -a ) # # exploitdb ( -e ) # # Social Engineering Toolkit ( -s ) # # Fasttrack ( -f ) # # Starts Postgresql ( -p ) # # # # ~Known Issues~ # # If section is blank in the report there was an error with the update # # Just scroll up to see the error # # # # 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 180 # # # ################################################################################################ #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 set_path="/pentest/exploits/SET/" #Social Engineering Toolkit exploitdb_path="/pentest/exploits/exploitdb/" #Exploitdb sqlmap_path="/pentest/database/sqlmap" #SQLMap fasttrack_path="/pentest/exploits/fasttrack" #Fasttrack #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" sqlmap_svn="http://svn.sqlmap.org/sqlmap/trunk/sqlmap" fasttrack_svn="http://svn.secmaniac.com/fasttrack" 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 -p [Start Postgresql] --- Start Postgresql for MSF ( ./update.sh -p ) -x [Everything] --- Do all actions in script (except start Postgresql) -h [Help] --- Help menu Example: ./update.sh -x (updates everything including apt-get (Won't start Postgreql!!!) ./update.sh -x -p (updates everything including apt-get and will start Postgreql) ./update.sh -d (apt-get -y update && apt-get -y dist-upgrade) ./update.sh -m -a -s -f (updates Metasploit Aircrack-ng SET and Fasttrack) ./update.sh -p (Start Postgresql) " exit 1 } while getopts "dmaesSfpxh" 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 f ) fasttrack="true" ;; # Update Fasttrack p ) postgresql="true" ;; # Start Postgresql for MSF x ) all="true" ;; # Do all actions in script (except start Postgresql) h ) help ;; # Help menu * ) help ;; # Default esac done if [ "$all" == "true" ] ; then metasploit="true" aircrack="true" dup="true" SET="true" exploitdb="true" fasttrack="true" SQLMap="true" fi if [ "$(id -u)" != "0" ] ; then echo "Run as root" ; exit 1 ; fi echo "(C)opyright 2010 Scamentology ~ echo "######################################" echo "# btupdate $vs #" echo "# A script for updating Back|Track 4 #" echo "######################################" if [ "$postgresql" == "true" ] ; then echo "###########################" echo "[i] Starting Postgresql..." echo "###########################" /etc/init.d/postgresql-8.3 start return_val=$? if [ $return_val == "0" ] ; then echo "Postgresql Started" ; else echo "Postgresql Failed to start" ; fi fi log="/tmp/btupdate.log" if [ "$all" == "" ] && [ "$metasploit" == "" ] && [ "$aircrack" == "" ] && [ "$dup" == "" ] && [ "$SET" == "" ] && [ "$SQLMap" == "" ] && [ "$exploitdb" == "" ] && [ "$fasttrack" == "" ] && [ "$postgresql" == "" ] ; then echo "Please choose an option" ; exit 1 ; fi if [ "$all" == "" ] && [ "$metasploit" == "" ] && [ "$aircrack" == "" ] && [ "$dup" == "" ] && [ "$SET" == "" ] && [ "$SQLMap" == "" ] && [ "$exploitdb" == "" ] && [ "$fasttrack" == "" ] && [ "$postgresql" == "true" ] ; then exit 1 ; fi clear echo "############################" echo "#[!] Checking for internet" echo "############################" for (( ; ; )) do wget -q -O - whatismyip.org # $(ping -c 1 google.com >/dev/null) return_val=$? if [ $return_val != "0" ] ; then clear echo "#############################################################" echo "[!] Internet access: Failed..." echo "#############################################################" echo "[i] Click yes to start networking then close wicd to continue" echo "#############################################################" read -p "[?] Would you like to open WICD now? [Y/n]: " if [[ "$REPLY" =~ ^[Yy]$ ]] ; then wicd-gtk --no-tray else clear echo "################################" echo "[!] No internet access available" echo "################################" exit 1 fi else clear echo "############################" echo "[i] Internet access: Success" ; echo "############################" break; fi done sleep 1 #exit 1 #temporary if [ "$dup" == "true" ] ; then clear echo " -- Updating Distribution --------------------" >> $log echo "############################" echo "[i] Updating Distribution..." echo "############################" apt-get -y update && apt-get -y upgrade && apt-get -y dist-upgrade | grep "newly installed" >> $log apt-get clean fi sleep 0 if [ "$metasploit" == "true" ] ; then clear echo " -- Framework 3 ------------------------------" >> $log echo "############################" echo "[i] Updating Framework 3..." echo "############################" 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 fi fi sleep 0 if [ "$metasploit" == "true" ] ; then clear echo " -- Framework 2 ------------------------------" >> $log echo "############################" echo "[i] Updating Framework 2..." echo "############################" 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 fi fi sleep 0 if [ "$aircrack" == "true" ] ; then clear echo " -- Aircrack-ng ------------------------------" >> $log echo "############################" echo "[i] Updating aircrack-ng..." echo "############################" 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 fi fi sleep 0 if [ "$exploitdb" == "true" ] ; then clear echo " -- Exploitdb --------------------------------" >> $log echo "############################" echo "[i] Updating Exploitdb..." echo "############################" 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 fi fi sleep 0 if [ "$SET" == "true" ] ; then clear echo " -- SET --------------------------------------" >> $log echo "############################" echo "[i] Updating SET..." echo "############################" 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-update upsvn=$(svn info | grep "Revision" | cut -c11-) if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to (SVN $upsvn)" >> $log fi fi fi sleep 0 if [ "$SQLMap" == "true" ] ; then clear echo " -- SQLMap -----------------------------------" >> $log echo "############################" echo "[i] Updating SQLMap... " echo "############################" 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 fi fi if [ "$fasttrack" == "true" ] ; then clear echo " -- Fasttrack --------------------------------" >> $log echo "############################" echo "[i] Updating Fasttrack... " echo "############################" 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 fi fi sleep 0 clear echo "################################################" echo " Update report for $(date)" echo "################################################" cat $log echo "################################################" sleep 1 rm -f $log /dev/null #echo "###########################" #echo "[i] Removing Misc..." #echo "###########################" exit 1 ######################################## #todo #add loop if no options choosen # ########################################