Advertisement
Guest User

Untitled

a guest
Nov 9th, 2010
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 26.93 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #  Back|Track 4 Update Utility
  4.  
  5. #  (C)opyright 2010 Scamentology
  6. vs="1.86"
  7. clear
  8. #---License------------------------------------------------------------------------------------#
  9. #  This program is free software: you can redistribute it and/or modify it under the terms     #
  10. #  of the GNU General Public License as published by the Free Software Foundation, either      #
  11. #  version 3 of the License, or (at your option) any later version.                            #
  12. #                                                                                              #
  13. #  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;   #
  14. #  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   #
  15. #  See the GNU General Public License for more details.                                        #
  16. #                                                                                              #
  17. #  You should have received a copy of the GNU General Public License along with this program.  #
  18. #  If not, see <http://www.gnu.org/licenses/>.                                                 #
  19. #----------------------------------------------------------------------------------------------#
  20. ################################################################################################
  21. #                                                                                              #
  22. #    ~ btupdate.sh ( options ) ~                                                               #
  23. #    Updates the following...                                                                  #
  24. #    ( -d ) Run apt-get (Change variable under OS update below to disable any features)        #
  25. #    ( -o ) Openvas Plugin Sync                                                                #
  26. #    ( -m ) Metasploit                                                                         #
  27. #    ( -a ) aircrack-ng                                                                        #
  28. #    ( -e ) exploitdb                                                                          #
  29. #    ( -s ) Social Engineering Toolkit                                                         #
  30. #    ( -f ) Fasttrack                                                                          #
  31. #    ( -S ) SQLMap                                                                             #
  32. #    ( -n ) Nikto                                                                              #
  33. #    ( -N ) Nessus                                                                             #
  34. #    ( -w ) w3af                                                                               #
  35. #    ( -z ) Update everything except apt-get                                                   #
  36. #    ( -F ) Update Firefox (Optional Update)                                                   #
  37. #                                                                                              #
  38. #    ~Known Issues~                                                                            #
  39. #    Let me know                                                                               #
  40. #                                                                                              #
  41. #    No verification for Openvas Plugin update                                                 #
  42. #    SQLMaps SVN asks for passwords - Just keep hitting enter if you did this update           #
  43. #    !!!This program runs apt-get clean - so if you want to keep downloaded updates then       #
  44. #    change -cleanup="yes"- to -cleanup="no"-                                                  #
  45. #                                                                                              #
  46. ################################################################################################
  47.  
  48. #                 Variables
  49.  
  50. # Check for Internet Access
  51.             netcheck="yes"        # (yes/no) no = don't check for internet access
  52.  
  53. # OS Update and Upgrade Variables
  54.               update="yes"        # (yes/no) yes for Update
  55.              upgrade="yes"        # (yes/no) yes for Upgrade
  56.                  dup="yes"        # (yes/no) yes for Distribution Update
  57.              cleanup="yes"        # (yes/no) Cleanup Downloaded Packages
  58.  
  59. # aircrack-ng build options
  60.                build="yes"        # (yes/no) Will run build.sh
  61.                  oui="yes"        # (yes/no) Runs airodump-ng-oui-update
  62.  
  63. # Default Install Paths (Change these if your install path is different)
  64.         openvas_path="/usr/local/sbin/"                     # Openvas
  65.      ff_profile_path="/home/root/.mozilla"                  # Firefox profile location (.mozilla)
  66.      framework3_path="/pentest/exploits/framework3"         # Metasploit framework 3
  67.      framework2_path="/pentest/exploits/framework2"         # Metasploit framework 2
  68.        aircrack_path="/pentest/wireless/aircrack-ng"        # Aircrack-ng
  69.       exploitdb_path="/pentest/exploits/exploitdb"          # Exploitdb
  70.             set_path="/pentest/exploits/SET"                # Social Engineering Toolkit
  71.       fasttrack_path="/pentest/exploits/fasttrack"          # Fasttrack
  72.          sqlmap_path="/pentest/database/sqlmap"             # SQLMap
  73.           nikto_path="/pentest/scanners/nikto"              # Nikto
  74.          nessus_path="/opt/nessus/sbin"                     # Nessus
  75.            w3af_path="/pentest/web/w3af"                    # w3af
  76.  
  77. # Online SVN Checks (Change these if the SVN link changes)
  78.       framework3_svn="https://www.metasploit.com/svn/framework3/trunk"
  79.       framework2_svn="https://www.metasploit.com/svn/framework2/trunk"
  80.         aircrack_svn="http://trac.aircrack-ng.org/svn/trunk"
  81.        exploitdb_svn="svn://devel.offensive-security.com/exploitdb"
  82.              set_svn="http://svn.thepentest.com/social_engineering_toolkit"
  83.        fasttrack_svn="http://svn.secmaniac.com/fasttrack"
  84.           sqlmap_svn="http://svn.sqlmap.org/sqlmap/trunk/sqlmap"
  85.             w3af_svn="https://w3af.svn.sourceforge.net/svnroot/w3af/trunk"
  86.  
  87. # Update Commands (Change these if the build design changes - or they are wrong)
  88.      openvas_command="openvas-nvt-sync"
  89.   framework3_command="svn update"
  90.   framework2_command="svn update"
  91.     aircrack_command="svn update"
  92.    air_build_command="./build.sh"
  93.   oui_update_command="./scripts/airodump-ng-oui-update"
  94.    exploitdb_command="svn co svn://devel.offensive-security.com/exploitdb"
  95.          set_command="./set-update"
  96.    fasttrack_command="svn update"
  97.       sqlmap_command="svn update"
  98.        nikto_command="perl nikto.pl -update"
  99.       nessus_command="./nessus-update-plugins"
  100.         w3af_command="svn update"
  101.  
  102. #-- Nothing to change below this line --------------------------------------------------
  103.  
  104. # Temporary log location
  105.                  log="/tmp/btupdate.log"
  106. # Borders
  107.              border1="echo "################################""
  108.              border2="echo "################################################################""
  109.            logborder="echo "_______________________________________________________""
  110.  
  111. # Misc Variable
  112.          servererror="Server might be down or slow - Try again"
  113.             noupdate="You are up to date already"
  114.              updated="Updated successfully to"
  115.     exploitdb_backup="/pentest/exploits/exploitdbbackup"        # Don't change unless you know what your doing
  116.    ff_profile_backup="/home/root/.mozillaold"                   # Don't change unless you know what your doing
  117.  
  118. # Help Section
  119. function help() {
  120.    echo "(C)opyright 2010 Scamentology ~
  121. ######################################
  122. #           btupdate $vs            #
  123. # A script for updating Back|Track 4 #
  124. ######################################
  125.  
  126. Usage: btupdate.sh [options]
  127.  
  128. Options:
  129.   -d [Dist-up]            ---  apt-get everything
  130.   -o [Openvas Plugins]    ---  Update Openvas Plugins
  131.   -m [Metasploit]         ---  Update Metasploit 2 and 3 (svn update)
  132.   -a [aircrack-ng]        ---  Update aircrack-ng and airodump-ng suite
  133.   -e [exploitdb]          ---  Update exploitdb
  134.   -s [SET]                ---  Update Social Engineering Toolkit
  135.   -S [SQLMap]             ---  Update SQLMap
  136.   -f [Fasttrack]          ---  Update Fasttrack
  137.   -n [Nikto]              ---  Update Nikto
  138.   -N [Nessus]             ---  Update Nessus Plugins
  139.   -w [w3af]               ---  Update w3af
  140.   -x [Everything]         ---  Do all actions in script (No Firefox)
  141.   -z [Everything Except]  ---  Do all actions in script except apt-get (No Firefox)
  142.   -h [Help]               ---  Help menu
  143.  
  144. Optional Updates (Should be done seperately and !!!AT YOUR OWN RISK!!!)
  145.   -F [Firefox]            ---  Updates Firefox
  146.  
  147.  
  148. Example:
  149.   ./btupdate.sh -x              (updates everything including apt-get
  150.   ./btupdate.sh -d              (apt-get update, upgrade and dist-upgrade)
  151.   ./btupdate.sh -m -a -s -f     (updates Metasploit Aircrack-ng SET and Fasttrack)
  152. Optional Updates (won't update with -x or -z)
  153.   ./btupdate.sh -F              (Updates Firefox)
  154.  
  155. "
  156.    exit 1
  157. }
  158. while getopts "dFomaesSfnNwxzh" OPTIONS; do
  159.    case ${OPTIONS} in
  160.       d ) distup="true" ;;                      # apt-get everything
  161.       F ) firefox="true" ;;                     # Update Firefox ( Optional Update )
  162.       o ) openvas="true" ;;                     # Openvas Plugin Sync
  163.       m ) metasploit="true" ;;                  # Update Metasploit 2 and 3 (svn co)
  164.       a ) aircrack="true" ;;                    # Update aircrack-ng and airgraph-ng
  165.       e ) exploitdb="true" ;;                   # Update exploitdb
  166.       s ) SET="true" ;;                         # Update Social Engineering Toolkit
  167.       S ) SQLMap="true" ;;                      # Update SQLMap
  168.       n ) nikto="true" ;;                       # Update Nikto plugins
  169.       N ) nessus="true" ;;                      # Update Nessus plugins
  170.       f ) fasttrack="true" ;;                   # Update Fasttrack
  171.       w ) w3af="true" ;;                        # Update w3af
  172.       x ) all="true" ;;                         # Do all actions in script (No Firefox)
  173.       z ) allbut="true" ;;                      # Do all actions in script except apt-get (No Firefox)
  174.       h ) help ;;                               # Help menu
  175.       * ) help ;;                               # Default
  176.    esac
  177. done
  178.  
  179. #__ If the -x switch is chosen______________________________________________
  180. if [ "$all" == "true" ] ; then
  181.       openvas="true"
  182.    metasploit="true"
  183.      aircrack="true"
  184.        distup="true"
  185.           SET="true"
  186.     exploitdb="true"
  187.     fasttrack="true"
  188.        SQLMap="true"
  189.         nikto="true"
  190.        nessus="true"
  191.          w3af="true"
  192. fi
  193. #__ If the -z switch is chosen______________________________________________
  194. if [ "$allbut" == "true" ] ; then
  195.       openvas="true"
  196.    metasploit="true"
  197.      aircrack="true"
  198.        distup="false"
  199.           SET="true"
  200.     exploitdb="true"
  201.     fasttrack="true"
  202.        SQLMap="true"
  203.         nikto="true"
  204.        nessus="true"
  205.          w3af="true"
  206. fi
  207.  
  208. echo "   (C)opyright 2010 Scamentology ~"
  209. echo "######################################"
  210. echo "#           btupdate $vs            #"
  211. echo "# A script for updating Back|Track 4 #"
  212. echo "######################################"
  213.  
  214. #__ Check if Root __________________________________________________________
  215. if [ "$(id -u)" != "0" ] ; then echo "You must be root to use Back|Track Update Utility" ; exit 1 ; fi
  216.  
  217. #__ If no choices are made _________________________________________________
  218. if [ "$all" == "" ] && [ "$openvas" == "" ] && [ "$metasploit" == "" ] && [ "$aircrack" == "" ] && [ "$distup" == "" ] && [ "$SET" == "" ] && [ "$SQLMap" == "" ] && [ "$exploitdb" == "" ] && [ "$fasttrack" == "" ] && [ "$nikto" == "" ] && [ "$nessus" == "" ] && [ "$w3af" == "" ] && [ "$firefox" == "" ] ; then echo "Please choose an option" ; exit 1 ; fi
  219.  
  220. #__ OS Update and Upgrade Variables ________________________________________
  221. if [ "$update" == "yes" ] ; then updateb="apt-get -y update" ; fi
  222. if [ "$upgrade" == "yes" ] ; then upgradeb="apt-get -y upgrade" ; fi
  223. if [ "$dup" == "yes" ] ; then distupb="apt-get -y dist-upgrade" ; fi
  224. if [ "$cleanup" == "yes" ] ; then cleana="apt-get clean" ; fi
  225. if [ "$cleanup" == "yes" ] ; then cleanb="apt-get clean" ; fi
  226. if [ "$firefox" == "true" ] && [ "$distup" == "true" ] && [ "$cleanup" == "yes" ] ; then
  227.    updatea="apt-get -y update"
  228.    cleana=""
  229.    updateb=""
  230.    cleanb="apt-get clean"
  231. fi
  232. if [ "$firefox" == "true" ] && [ "$distup" == "true" ] && [ "$cleanup" == "no" ] ; then
  233.    updatea="apt-get -y update"
  234.    cleana=""
  235.    updateb=""
  236.    cleanb=""
  237. fi
  238. if [ "$firefox" == "true" ] ; then
  239.    updatea="apt-get -y update"
  240. fi
  241.  
  242. #__  Check if Programs are Installed _______________________________________
  243. if [ -e "$framework3_path/msfconsole" ] ; then framework3_install="true" ; fi
  244. if [ -e "$framework2_path/msfconsole" ] ; then framework2_install="true" ; fi
  245. if [ -d "$aircrack_path" ] ; then aircrack_install="true" ; fi
  246. if [ -d "$exploitdb_path" ] ; then exploitdb_install="true" ; fi
  247. if [ -e "$set_path/set" ] ; then set_install="true" ; fi
  248. if [ -e "$fasttrack_path/fast-track.py" ] ; then fasttrack_install="true" ; fi
  249. if [ -e "$sqlmap_path/sqlmap.py" ] ; then sqlmap_install="true" ; fi
  250. if [ -e "$nikto_path/nikto.pl" ] ; then nikto_install="true" ; fi
  251. if [ -e "$nessus_path/nessusd" ] ; then nessus_install="true" ; fi
  252. if [ -e "$openvas_path/openvas-nvt-sync" ] ; then openvas_install="true" ; fi
  253.  
  254. #__ Checking for Internet __________________________________________________
  255. if [ "$netcheck" == "yes" ] ; then
  256.    clear
  257.    $border1
  258.    echo "#[i] Checking for internet"
  259.    $border1
  260.    for (( ; ; ))
  261.    do
  262.       ping -c 2 www.google.com >/dev/null
  263.       return_val=$?
  264.       if [ $return_val != "0" ] ; then
  265.          clear
  266.          $border2
  267.          echo "[!] Internet access: Failed..."
  268.          $border2
  269.          echo "[i] Click yes to start networking then close wicd to continue"
  270.          $border2
  271.          read -p "[?] Would you like to open WICD now? [Y/n]: "
  272.             if [[ "$REPLY" =~ ^[Yy]$ ]] ; then
  273.             wicd-gtk --no-tray
  274.          else
  275.             clear
  276.             $border1
  277.             echo "[!] No internet access available"
  278.             $border1
  279.             exit 1
  280.             fi
  281.       else
  282.          clear
  283.          $border1
  284.          echo "[i] Internet access: Success" ;
  285.          $border1
  286.          break;
  287.       fi
  288. done
  289. fi
  290. #__ Firefox ________________________________________________________________
  291. if [ "$firefox" == "true" ] ; then
  292.    $border1
  293.    echo "[i] Updating Firefox"
  294.    $border1
  295.    $logborder  >> $log
  296.    if [ ! -d "/home/root/.mozilla" ] && [ ! -d "/root/.mozilla" ] ; then echo "The Firefox profile is not located in the default location - I can not successfully back it up. If you were running other updates then try again without the -F switch" ; exit 1 ; fi
  297.    oldversion="$(firefox -v | cut -b 17-22)"
  298.    cp /etc/apt/sources.list /etc/apt/sources.list.backup
  299.    if [ ! -e "/etc/apt/sources.list.backup" ] ; then echo "Unable to backup sources.list. If you were running other updates then try again without the -F switch" ; exit 1 ; fi
  300.    echo -e "\ndeb http://switch.dl.sourceforge.net/project/ubuntuzilla/mozilla/apt all main" >> /etc/apt/sources.list
  301.    sort -u -o /etc/apt/sources.list /etc/apt/sources.list
  302.    apt-key adv --recv-keys --keyserver keyserver.ubuntu.com C1289A29
  303.    if [ -d "/root/.mozilla" ] ; then
  304.       cp -r /root/.mozilla /root/.mozillaold
  305.       profile="[i] Old Firefox Profile Backed up to ~/.mozillaold"
  306.    fi
  307.    if [ -d "/home/root/.mozilla" ] ; then
  308.       cp -r /home/root/.mozilla /home/root/.mozillaold
  309.       profile="[i] Old Firefox Profile Backed up to /home/root/.mozillaold"
  310.    fi
  311.    killall firefox-bin
  312.    $updatea
  313.    apt-get install firefox-mozilla-build
  314.    $cleana
  315. #   cd /tmp/
  316. #   wget https://secure.informaction.com/download/releases/noscript-2.0.4.xpi
  317. #   noscriptpath="ls | grep "noscript""
  318. #   firefox -install-global-extension $noscriptpath -silent
  319. #   firefox -setDefaultBrowser -silent
  320. #   rm -f $noscriptpath
  321. #   firefox
  322. #   cd /root/
  323.    newversion="$(firefox -v | cut -b 17-22)"
  324.    if [ $newversion == $oldversion ] ; then echo "Firefox     - $noupdate (VER $newversion)" >> $log ; fi
  325.    if [ $newversion != $oldversion ] ; then
  326.       echo "Firefox   - $updated    (VER $newversion)" >> $log
  327.       echo "$profile" >> $log
  328.       clear
  329.       $border1
  330.       echo "[i] Start firefox now and ensure your profile is correct?"
  331.       read -p "[?] If your profile is not correct then enter [n] and your backup profile will be replaced [y/n]"
  332.       $border1
  333.       if [[ "$REPLY" =~ ^[Nn]$ ]] ; then
  334.          killall firefox-bin
  335.          cp /home/root/.mozillaold /home/root/.mozilla
  336.       fi
  337.    fi
  338. fi
  339. #__ MSF Framework 3 ________________________________________________________
  340. if [ "$metasploit" == "true" ] ; then
  341.    $logborder  >> $log
  342.    if [ "$framework3_install" == "true" ] ; then
  343.       clear
  344.       $border1
  345.       echo "[i] Updating Framework 3..."
  346.       $border1
  347.       cd $framework3_path
  348.       oldsvn=$(svn info | grep "Revision" | cut -c11-)
  349.       newsvn=$(svn info $framework3_svn | grep "Revision" | cut -c11-)
  350.       if [ "$newsvn" == "$oldsvn" ] ; then
  351.          echo "Framework 3 - $noupdate (SVN $newsvn)" >> $log
  352.       else
  353.          $framework3_command
  354.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  355.          if [ "$newsvn" == "$upsvn" ] ; then echo "Framework 3 - $updated    (SVN $upsvn)" >> $log ; fi
  356.          if [ "$newsvn" != "$upsvn" ] ; then echo "Framework 3 - $servererror" >> $log ; fi
  357.       fi
  358.    else
  359.       echo "[!] MSF 3 Not Installed in $framework3_path" >> $log
  360.    fi
  361. fi
  362. #__ MSF Framework 2 ________________________________________________________
  363. if [ "$metasploit" == "true" ] ; then
  364.    $logborder  >> $log
  365.    if [ "$framework2_install" == "true" ] ; then
  366.       clear
  367.       $border1
  368.       echo "[i] Updating Framework 2..."
  369.       $border1
  370.       cd $framework2_path
  371.       oldsvn=$(svn info | grep "Revision" | cut -c11-)
  372.       newsvn=$(svn info $framework2_svn | grep "Revision" | cut -c11-)
  373.       if [ "$newsvn" == "$oldsvn" ] ; then  
  374.          echo "Framework 2 - $noupdate (SVN $newsvn)" >> $log
  375.       else
  376.          $framework2_command
  377.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  378.          if [ "$newsvn" == "$upsvn" ] ; then echo "Framework 2 - $updated    (SVN $upsvn)" >> $log ; fi
  379.          if [ "$newsvn" != "$upsvn" ] ; then echo "Framework 2 - $servererror" >> $log ; fi
  380.       fi
  381.    else
  382.       echo "[!] MSF 2 Not Installed in $framework2_path" >> $log
  383.    fi
  384. fi
  385. #__ Aircrack-ng ____________________________________________________________
  386. if [ "$aircrack" == "true" ] ; then
  387.       $logborder  >> $log
  388.    if [ "$aircrack_install" == "true" ] ; then
  389.       clear
  390.       $border1
  391.       echo "[i] Updating aircrack-ng..."
  392.       $border1
  393.       cd $aircrack_path
  394.       oldsvn=$(svn info | grep "Revision" | cut -c11-)
  395.       newsvn=$(svn info $aircrack_svn | grep "Revision" | cut -c11-) >> $log
  396.       if [ "$newsvn" == "$oldsvn" ] ; then  
  397.          echo "Aircrack-ng - $noupdate (SVN $newsvn)" >> $log
  398.       else
  399.          $aircrack_command
  400.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  401.          if [ "$newsvn" == "$upsvn" ] ; then
  402.             if [ "$build" == "yes" ] ; then $air_build_command ; fi
  403.             if [ "$oui" == "yes" ] ; then
  404.                chmod a+x $oui_update_command
  405.                $oui_update_command
  406.             fi
  407.                 echo "Updated Successfully to    (SVN $upsvn)" >> $log
  408.          fi
  409.          if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi
  410.       fi
  411.    else
  412.       echo "[!] Aircrack-ng Not Installed in $aircrack_path" >> $log
  413.       echo "[i] If it is installed then change default path in script" >> $log
  414.    fi
  415. fi
  416. #__ Exploitdb ______________________________________________________________
  417. if [ "$exploitdb" == "true" ] ; then
  418.    $logborder >> $log
  419.    cd $exploitdb_path
  420.    oldsvn=$(svn info | grep "Revision" | cut -c11-)
  421.    newsvn=$(svn info $exploitdb_svn | grep "Revision" | cut -c11-)
  422.    if [ "$exploitdb_install" == "true" ] ; then
  423.       clear
  424.       $border1
  425.       echo "[i] Updating Exploitdb..."
  426.       $border1
  427.       if [ "$newsvn" == "$oldsvn" ] ; then  
  428.          echo "Exploitdb   - $noupdate (SVN $newsvn)" >> $log
  429.       else
  430.          cp -r $exploitdb_path $exploitdb_backup
  431.          if [ -d $exploitdb_backup ] ; then rm -rf $exploitdb_path ; fi
  432.          if [ ! -d $exploitdb_path ] ; then $exploitdb_command ; fi
  433.          cd $exploitdb_path
  434.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  435.          if [ -d $exploitdb_path ] && [ "$newsvn" == "$upsvn" ] ; then
  436.             rm -rf $exploitdb_backup
  437.             echo "Exploitdb   - $updated    (SVN $upsvn)" >> $log
  438.          else
  439.             echo "exploitdb   - Update failed - Replaced VER $oldsvn" >> $log
  440.             cp -r $exploitdbbackup $exploitdb_path
  441.             if [ -d $exploitdb_path ] ; then rm -rf $exploitdb_backup ; fi
  442.          fi
  443.          if [ "$newsvn" != "$upsvn" ] ; then echo "exploitdb   - $servererror" >> $log ; fi
  444.       fi
  445.    else
  446.       echo "[!] Exploitdb Not Installed in $exploitdb_path"
  447.       echo "If you DID NOT move it then its safe to type [y] below"
  448.       echo "If you DID move it then change the install path above this script"
  449.       read -p "[?] Would you like to put a copy of it there? [y/n]"
  450.       if [[ "$REPLY" =~ ^[Yy]$ ]] ; then
  451.          cd /pentest/exploits
  452.          $exploitdb_command
  453.          cd $exploitdb_path
  454.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  455.             if [ -d $exploitdb_path ] && [ "$newsvn" == "$upsvn" ] ; then
  456.                echo "Exploitdb   - $updated    (SVN $upsvn)" >> $log
  457.             else
  458.                echo "Exploitdb   - $servererror" >> $log
  459.             fi
  460.       else
  461.          echo "Exploitdb   - Interupted by user" >> $log
  462.       fi
  463.    fi
  464. fi
  465. #__ Social Engineering Toolkit _____________________________________________
  466. if [ "$SET" == "true" ] ; then
  467.    if [ "$set_install" == "true" ] ; then
  468.       $logborder  >> $log
  469.       clear
  470.       $border1
  471.       echo "[i] Updating SET..."
  472.       $border1
  473.       cd $set_path
  474.       oldsvn=$(svn info | grep "Revision" | cut -c11-)
  475.       newsvn=$(svn info $set_svn | grep "Revision" | cut -c11-)
  476.       if [ "$newsvn" == "$oldsvn" ] ; then  
  477.          echo "SET         - $noupdate (SVN $newsvn)" >> $log
  478.       else
  479.          $set_command
  480.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  481.          if [ "$newsvn" == "$upsvn" ] ; then echo "SET         - $updated    (SVN $upsvn)" >> $log ; fi
  482.          if [ "$newsvn" != "$upsvn" ] ; then echo "SET         - $servererror" >> $log ; fi
  483.       fi
  484.    else
  485.       echo "[!] SET Not Installed in $set_path" >> $log
  486.       echo "[i] If it is installed then change default path in script" >> $log
  487.    fi
  488. fi
  489. #__ Fast-track _____________________________________________________________
  490. if [ "$fasttrack" == "true" ] ; then
  491.       $logborder  >> $log
  492.    if [ "$fasttrack_install" == "true" ] ; then
  493.       clear
  494.       $border1
  495.       echo "[i] Updating Fasttrack...  "
  496.       $border1
  497.       cd $fasttrack_path
  498.       oldsvn=$(svn info | grep "Revision" | cut -c11-)
  499.       newsvn=$(svn info $fasttrack_svn | grep "Revision" | cut -c11-)
  500.       if [ "$newsvn" == "$oldsvn" ] ; then  
  501.          echo "Fasttrack   - $noupdate (SVN $newsvn)" >> $log
  502.       else
  503.          $fasttrack_command
  504.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  505.          if [ "$newsvn" == "$upsvn" ] ; then echo "Fasttrack   - $updated    (SVN $upsvn)" >> $log ; fi
  506.          if [ "$newsvn" != "$upsvn" ] ; then echo "Fasttrack   - $servererror" >> $log ; fi
  507.       fi
  508.    else
  509.       echo "[!] Fasttrack Not Installed in $fasttrack_path" >> $log
  510.       echo "[i] If it is installed then change default path in script" >> $log
  511.    fi
  512. fi
  513. #__ SQLMap _________________________________________________________________
  514. if [ "$SQLMap" == "true" ] ; then
  515.    $logborder  >> $log
  516.    if [ "$sqlmap_install" == "true" ] ; then
  517.       clear
  518.       $border1
  519.       echo "[i] Updating SQLMap...      "
  520.       $border1
  521.       cd $sqlmap_path
  522.       oldsvn=$(svn info | grep "Revision" | cut -c11-)
  523.       newsvn=$(svn info $sqlmap_svn | grep "Revision" | cut -c11-)
  524.       if [ "$newsvn" == "$oldsvn" ] ; then  
  525.          echo "SQLMap      - $noupdate (SVN $newsvn)" >> $log
  526.       else
  527.          $sqlmap_command
  528.          upsvn=$(svn info | grep "Revision" | cut -c11-)
  529.          if [ "$newsvn" == "$upsvn" ] ; then echo "SQLMap      - $updated    (SVN $upsvn)" >> $log ; fi
  530.          if [ "$newsvn" != "$upsvn" ] ; then echo "SQLMap      - $servererror" >> $log ; fi
  531.       fi
  532.    else
  533.       echo "[!] SQLMap Not Installed in $sqlmap_path" >> $log
  534.       echo "[i] If it is installed then change default path in script" >> $log
  535.    fi
  536. fi
  537. #__ w3af ___________________________________________________________________
  538. if [ "$w3af" == "true" ] ; then
  539.    $logborder  >> $log
  540.    clear
  541.    $border1
  542.    echo "[i] Updating w3af..."
  543.    $border1
  544.    cd $w3af_path
  545.    oldsvn=$(svn info | grep "Revision" | cut -c11-)
  546.    newsvn=$(svn info $w3af_svn | grep "Revision" | cut -c11-)
  547.    if [ "$newsvn" == "$oldsvn" ] ; then  
  548.       echo "w3af        - $noupdate (SVN $newsvn)" >> $log
  549.    else
  550.       $w3af_command
  551.       upsvn=$(svn info | grep "Revision" | cut -c11-)
  552.       if [ "$newsvn" == "$upsvn" ] ; then echo "w3af        - $updated    (SVN $upsvn)" >> $log ; fi
  553.       if [ "$newsvn" != "$upsvn" ] ; then echo "w3af        - $servererror" >> $log ; fi
  554.    fi
  555. fi
  556. #__ Nikto __________________________________________________________________
  557. if [ "$nikto" == "true" ] ; then
  558.    $logborder  >> $log
  559.    if [ "$nikto_install" == "true" ] ; then
  560.       clear
  561.       $border1
  562.       echo "[i] Updating Nikto...  "
  563.       $border1
  564.       cd $nikto_path
  565.       result="$($nikto_command | awk -v line=1 'NR == line { print $0 }' | awk '{ print $2,$3,$4 }')"
  566.       echo "Nikto       - $result"  >> $log
  567.    else
  568.       echo "[!] Nikto Not Installed in $nikto_path" >> $log
  569.       echo "[i] If it is installed then change default path in script" >> $log
  570.    fi
  571. fi
  572. #__ Openvas Plugins ________________________________________________________
  573. if [ "$openvas" == "true" ] ; then
  574.    $logborder  >> $log
  575.    if [ "$openvas_install" == "true" ] ; then
  576.    clear
  577.    $border1
  578.    echo "[i] Updating Openvas Plugins..."
  579.    $border1
  580.    $openvas_command
  581.    echo "openvas     - Plugins are up to date" >> $log
  582.    fi
  583. fi
  584. #__ Nessus _________________________________________________________________
  585. if [ "$nessus" == "true" ] ; then
  586.    $logborder  >> $log
  587.    if [ "$nessus_install" == "true" ] ; then
  588.       clear
  589.       $border1
  590.       echo "[i] Updating Nessus...  "
  591.       $border1
  592.       cd $nessus_path
  593.       result="$($nessus_command | awk -v line=2 'NR == line { print $0 }' | awk '{ print $1 }')"
  594.       if [ $result == "Done." ] ; then
  595.          echo "Nessus      - Plugins are up to date" >> $log
  596.       else
  597.          echo "Nessus      - Update error" >> $log
  598.       fi
  599.    else
  600.       echo "[!] Nessus Not Installed in $nessus_path" >> $log
  601.       echo "[i] If it is installed then change default path in script" >> $log
  602.    fi
  603. fi
  604. #__ Distribution and apt-get _______________________________________________
  605. if [ "$distup" == "true" ] ; then
  606.    $logborder  >> $log
  607.    clear
  608.    echo "Updating Distribution" >> $log
  609.    $border1
  610.    echo "[i] Updating Distribution..."
  611.    $border1
  612.    $updateb && $upgradeb && $distupb | grep "newly installed" >> $log
  613.    $cleanb
  614. fi
  615. echo " " >> $log
  616. clear
  617. $border2
  618. echo " Update report for $(date)"
  619. $border2
  620. cat $log
  621. $border2
  622. sleep 1
  623. rm -f $log
  624. exit 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement