This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 20th, 2010  |  syntax: Bash  |  size: 14.31 KB  |  views: 133  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2.  
  3. #(C)opyright 2010 Scamentology
  4. vs="1.4"
  5. clear
  6. #---License------------------------------------------------------------------------------------#
  7. #  This program is free software: you can redistribute it and/or modify it under the terms     #
  8. #  of the GNU General Public License as published by the Free Software Foundation, either      #
  9. #  version 3 of the License, or (at your option) any later version.                            #
  10. #                                                                                              #
  11. #  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;   #
  12. #  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   #
  13. #  See the GNU General Public License for more details.                                        #
  14. #                                                                                              #
  15. #  You should have received a copy of the GNU General Public License along with this program.  #
  16. #  If not, see <http://www.gnu.org/licenses/>.                                                 #
  17. #----------------------------------------------------------------------------------------------#
  18. ################################################################################################
  19. #                                                                                              #
  20. #    ~btupdate.sh~                                                                             #
  21. #    Updates the following...                                                                  #
  22. #    apt-get everything ( -d )                                                                 #
  23. #    Metasploit ( -m )                                                                         #
  24. #    aircrack-ng ( -a )                                                                        #
  25. #    exploitdb ( -e )                                                                          #
  26. #    Social Engineering Toolkit ( -s )                                                         #
  27. #    Fasttrack ( -f )                                                                          #
  28. #    Starts Postgresql ( -p )                                                                  #
  29. #                                                                                              #
  30. #    ~Known Issues~                                                                            #
  31. #    If section is blank in the report there was an error with the update                      #
  32. #    Just scroll up to see the error                                                           #
  33. #                                                                                              #
  34. #    SQLMaps svn asks for passwords - Just keep hitting enter if you did this update           #
  35. #    !!!This program runs apt-get clean - so if you want to keep downloaded updates then       #
  36. #    # line 180                                                                                #
  37. #                                                                                              #
  38. ################################################################################################
  39.  
  40. #Default install paths (Change these if your install path is different)
  41. framework3_path="/pentest/exploits/framework3/"         #Metasploit framework 3
  42. framework2_path="/pentest/exploits/framework2/"         #Metasploit framework 2
  43.   aircrack_path="/pentest/wireless/aircrack-ng/"        #aircrack-ng
  44.        set_path="/pentest/exploits/SET/"                #Social Engineering Toolkit
  45.  exploitdb_path="/pentest/exploits/exploitdb/"          #Exploitdb
  46.     sqlmap_path="/pentest/database/sqlmap"              #SQLMap
  47.  fasttrack_path="/pentest/exploits/fasttrack"           #Fasttrack
  48.  
  49. #Online SVN Checks (Change these if the SVN link changes)
  50. framework3_svn="https://www.metasploit.com/svn/framework3/trunk"
  51. framework2_svn="https://www.metasploit.com/svn/framework2/trunk"
  52.   aircrack_svn="http://trac.aircrack-ng.org/svn/trunk"
  53.  exploitdb_svn="svn://www.exploit-db.com/exploitdb"
  54.        set_svn="http://svn.thepentest.com/social_engineering_toolkit"
  55.     sqlmap_svn="http://svn.sqlmap.org/sqlmap/trunk/sqlmap"
  56.  fasttrack_svn="http://svn.secmaniac.com/fasttrack"
  57.  
  58. function help() { #help
  59.    echo "(C)opyright 2010 Scamentology ~
  60. ######################################
  61. #           btupdate $vs             #
  62. # A script for updating Back|Track 4 #
  63. ######################################
  64.  
  65. Usage: update.sh [options]
  66.  
  67. Options:
  68.   -d [Dist-up]            ---  apt-get everything
  69.   -m [Metasploit]         ---  Update Metasploit 2 and 3 (svn update)
  70.   -a [aircrack-ng]        ---  Update aircrack-ng
  71.   -e [exploitdb]          ---  Update exploitdb
  72.   -s [SET]                ---  Update Social Engineering Toolkit
  73.   -S [SQLMap]             ---  Update SQLMap
  74.   -f [Fasttrack]          ---  Update Fasttrack
  75.   -p [Start Postgresql]   ---  Start Postgresql for MSF ( ./update.sh -p )
  76.   -x [Everything]         ---  Do all actions in script (except start Postgresql)
  77.   -h [Help]               ---  Help menu
  78.  
  79. Example:
  80.   ./update.sh -x              (updates everything including apt-get (Won't start Postgreql!!!)
  81.   ./update.sh -x -p           (updates everything including apt-get and will start Postgreql)
  82.   ./update.sh -d              (apt-get -y update && apt-get -y dist-upgrade)
  83.   ./update.sh -m -a -s -f     (updates Metasploit Aircrack-ng SET and Fasttrack)
  84.   ./update.sh -p              (Start Postgresql)
  85.  
  86. "
  87.    exit 1
  88. }
  89. while getopts "dmaesSfpxh" OPTIONS; do
  90.    case ${OPTIONS} in
  91.       d ) dup="true" ;;                         # apt-get everything
  92.       m ) metasploit="true" ;;                  # Update Metasploit 2 and 3 (svn co)
  93.       a ) aircrack="true" ;;                    # Update aircrack-ng
  94.       e ) exploitdb="true" ;;                   # Update exploitdb
  95.       s ) SET="true" ;;                         # Update Social Engineering Toolkit
  96.       S ) SQLMap="true" ;;                      # Update SQLMap
  97.       f ) fasttrack="true" ;;                   # Update Fasttrack
  98.       p ) postgresql="true" ;;                  # Start Postgresql for MSF
  99.       x ) all="true" ;;                         # Do all actions in script (except start Postgresql)
  100.       h ) help ;;                               # Help menu
  101.       * ) help ;;                               # Default
  102.    esac
  103. done
  104.  
  105. if [ "$all" == "true" ] ; then
  106. metasploit="true"
  107. aircrack="true"
  108. dup="true"
  109. SET="true"
  110. exploitdb="true"
  111. fasttrack="true"
  112. SQLMap="true"
  113. fi
  114.  
  115. if [ "$(id -u)" != "0" ] ; then echo "Run as root" ; exit 1 ; fi
  116.    echo "(C)opyright 2010 Scamentology ~
  117. echo "######################################"
  118. echo "#           btupdate $vs             #"
  119. echo "# A script for updating Back|Track 4 #"
  120. echo "######################################"
  121.  
  122. if [ "$postgresql" == "true" ] ; then
  123.    echo "###########################"
  124.    echo "[i] Starting Postgresql..."
  125.    echo "###########################"
  126.    /etc/init.d/postgresql-8.3 start
  127.    return_val=$?
  128.    if [ $return_val == "0" ] ; then echo "Postgresql Started" ; else echo "Postgresql Failed to start" ; fi
  129. fi
  130.  
  131. log="/tmp/btupdate.log"
  132. if [ "$all" == "" ] && [ "$metasploit" == "" ] && [ "$aircrack" == "" ] && [ "$dup" == "" ] && [ "$SET" == "" ] && [ "$SQLMap" == "" ] && [ "$exploitdb" == "" ] && [ "$fasttrack" == "" ] && [ "$postgresql" == "" ] ; then echo "Please choose an option" ; exit 1 ; fi
  133. if [ "$all" == "" ] && [ "$metasploit" == "" ] && [ "$aircrack" == "" ] && [ "$dup" == "" ] && [ "$SET" == "" ] && [ "$SQLMap" == "" ] && [ "$exploitdb" == "" ] && [ "$fasttrack" == "" ] && [ "$postgresql" == "true" ] ; then exit 1 ; fi
  134.  
  135. clear
  136. echo "############################"
  137. echo "#[!] Checking for internet"
  138. echo "############################"
  139. for (( ; ; ))
  140. do
  141.    wget -q -O - whatismyip.org # $(ping -c 1 google.com >/dev/null)
  142.    return_val=$?
  143.    if [ $return_val != "0" ] ; then
  144.       clear
  145.       echo "#############################################################"
  146.       echo "[!] Internet access: Failed..."
  147.       echo "#############################################################"
  148.       echo "[i] Click yes to start networking then close wicd to continue"
  149.       echo "#############################################################"
  150.       read -p "[?] Would you like to open WICD now? [Y/n]: "
  151.          if [[ "$REPLY" =~ ^[Yy]$ ]] ; then
  152.          wicd-gtk --no-tray
  153.       else
  154.          clear
  155.          echo "################################"
  156.          echo "[!] No internet access available"
  157.          echo "################################"
  158.          exit 1
  159.          fi
  160.    else
  161.       clear
  162.       echo "############################"
  163.       echo "[i] Internet access: Success" ;
  164.       echo "############################"
  165.       break;
  166.    fi
  167. done
  168. sleep 1
  169.  
  170. #exit 1 #temporary
  171.  
  172.  
  173.  
  174. if [ "$dup" == "true" ] ; then
  175.    clear
  176.    echo " -- Updating Distribution --------------------" >> $log
  177.    echo "############################"
  178.    echo "[i] Updating Distribution..."
  179.    echo "############################"
  180.    apt-get -y update && apt-get -y upgrade && apt-get -y dist-upgrade | grep "newly installed" >> $log
  181.    apt-get clean
  182. fi
  183. sleep 0
  184.  
  185. if [ "$metasploit" == "true" ] ; then
  186.    clear
  187.    echo " -- Framework 3 ------------------------------" >> $log
  188.    echo "############################"
  189.    echo "[i] Updating Framework 3..."
  190.    echo "############################"
  191.    cd $framework3_path
  192.    oldsvn=$(svn info | grep "Revision" | cut -c11-)
  193.    newsvn=$(svn info $framework3_svn | grep "Revision" | cut -c11-)
  194.       if [ "$newsvn" == "$oldsvn" ] ; then  
  195.          echo "You are up to date already (SVN $newsvn)" >> $log
  196.       else
  197.          svn update
  198.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  199.          if [ "$newsvn" == "$upsvn" ] ; then
  200.             echo "Updated Successfully to    (SVN $upsvn)" >> $log
  201.          fi
  202.       fi
  203.  
  204. fi
  205. sleep 0
  206.  
  207. if [ "$metasploit" == "true" ] ; then
  208.    clear
  209.    echo " -- Framework 2 ------------------------------" >> $log
  210.    echo "############################"
  211.    echo "[i] Updating Framework 2..."
  212.    echo "############################"
  213.    cd $framework2_path
  214.    oldsvn=$(svn info | grep "Revision" | cut -c11-)
  215.    newsvn=$(svn info $framework2_svn | grep "Revision" | cut -c11-)
  216.       if [ "$newsvn" == "$oldsvn" ] ; then  
  217.          echo "You are up to date already (SVN $newsvn)" >> $log
  218.       else
  219.          svn update
  220.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  221.          if [ "$newsvn" == "$upsvn" ] ; then
  222.             echo "Updated Successfully to    (SVN $upsvn)" >> $log
  223.          fi
  224.       fi
  225.  
  226. fi
  227. sleep 0
  228.  
  229. if [ "$aircrack" == "true" ] ; then
  230.    clear
  231.    echo " -- Aircrack-ng ------------------------------" >> $log
  232.    echo "############################"
  233.    echo "[i] Updating aircrack-ng..."
  234.    echo "############################"
  235.    cd $aircrack_path
  236.    oldsvn=$(svn info | grep "Revision" | cut -c11-)
  237.    newsvn=$(svn info $aircrack_svn | grep "Revision" | cut -c11-) >> $log
  238.       if [ "$newsvn" == "$oldsvn" ] ; then  
  239.          echo "You are up to date already (SVN $newsvn)" >> $log
  240.       else
  241.          svn update
  242.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  243.          if [ "$newsvn" == "$upsvn" ] ; then
  244.             echo "Updated Successfully to    (SVN $upsvn)" >> $log
  245.          fi
  246.       fi
  247. fi
  248. sleep 0
  249.  
  250. if [ "$exploitdb" == "true" ] ; then
  251.    clear
  252.    echo " -- Exploitdb --------------------------------" >> $log
  253.    echo "############################"
  254.    echo "[i] Updating Exploitdb..."
  255.    echo "############################"
  256.    cd $exploitdb_path
  257.    oldsvn=$(svn info | grep "Revision" | cut -c11-)
  258.    newsvn=$(svn info $exploitdb_svn | grep "Revision" | cut -c11-)
  259.       if [ "$newsvn" == "$oldsvn" ] ; then
  260.          echo "You are up to date already (SVN $newsvn)" >> $log
  261.       else
  262.          svn update
  263.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  264.          if [ "$newsvn" == "$upsvn" ] ; then
  265.             echo "Updated Successfully to    (SVN $upsvn)" >> $log
  266.          fi
  267.       fi
  268. fi
  269. sleep 0
  270.  
  271. if [ "$SET" == "true" ] ; then
  272.    clear
  273.    echo " -- SET --------------------------------------" >> $log
  274.    echo "############################"
  275.    echo "[i] Updating SET..."
  276.    echo "############################"
  277.    cd $set_path
  278.    oldsvn=$(svn info | grep "Revision" | cut -c11-)
  279.    newsvn=$(svn info $set_svn | grep "Revision" | cut -c11-)
  280.       if [ "$newsvn" == "$oldsvn" ] ; then
  281.          echo "You are up to date already (SVN $newsvn)" >> $log
  282.       else
  283.          ./set-update
  284.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  285.          if [ "$newsvn" == "$upsvn" ] ; then
  286.             echo "Updated Successfully to    (SVN $upsvn)" >> $log
  287.          fi
  288.       fi
  289. fi
  290. sleep 0
  291.  
  292. if [ "$SQLMap" == "true" ] ; then
  293.    clear
  294.    echo " -- SQLMap -----------------------------------" >> $log
  295.    echo "############################"
  296.    echo "[i] Updating SQLMap...      "
  297.    echo "############################"
  298.    cd $sqlmap_path
  299.    oldsvn=$(svn info | grep "Revision" | cut -c11-)
  300.    newsvn=$(svn info $sqlmap_svn | grep "Revision" | cut -c11-)
  301.       if [ "$newsvn" == "$oldsvn" ] ; then  
  302.          echo "You are up to date already (SVN $newsvn)" >> $log
  303.       else
  304.          svn update
  305.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  306.          if [ "$newsvn" == "$upsvn" ] ; then
  307.             echo "Updated Successfully to (SVN $upsvn)" >> $log
  308.          fi
  309.       fi
  310. fi
  311.  
  312. if [ "$fasttrack" == "true" ] ; then
  313.    clear
  314.    echo " -- Fasttrack --------------------------------" >> $log
  315.    echo "############################"
  316.    echo "[i] Updating Fasttrack...  "
  317.    echo "############################"
  318.    cd $fasttrack_path
  319.    oldsvn=$(svn info | grep "Revision" | cut -c11-)
  320.    newsvn=$(svn info $fasttrack_svn | grep "Revision" | cut -c11-)
  321.       if [ "$newsvn" == "$oldsvn" ] ; then
  322.          echo "You are up to date already (SVN $newsvn)" >> $log
  323.       else
  324.          svn update
  325.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  326.          if [ "$newsvn" == "$upsvn" ] ; then
  327.             echo "Updated Successfully to    (SVN $upsvn)" >> $log
  328.          fi
  329.       fi
  330. fi
  331. sleep 0
  332.  
  333. clear
  334. echo "################################################"
  335. echo " Update report for $(date)"
  336. echo "################################################"
  337. cat $log
  338. echo "################################################"
  339. sleep 1
  340. rm -f $log /dev/null
  341. #echo "###########################"
  342. #echo "[i] Removing Misc..."
  343. #echo "###########################"
  344. exit 1
  345.  
  346.  
  347. ########################################
  348. #todo
  349. #add loop if no options choosen
  350. #
  351. ########################################
clone this paste RAW Paste Data