View difference between Paste ID: swa1bm4c and
SHOW: | | - or go back to the newest paste.
1-
1+
#!/bin/bash
2
3
#  Back|Track 4 Update Utility
4
5
#  (C)opyright 2010 Scamentology
6
vs="1.7"
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
#    apt-get everything ( -d )                                                                 #
25
#    Metasploit ( -m )                                                                         #
26
#    aircrack-ng ( -a )                                                                        #
27
#    exploitdb ( -e )                                                                          #
28
#    Social Engineering Toolkit ( -s )                                                         #
29
#    Fasttrack ( -f )                                                                          #
30
#    SQLMap ( -S )                                                                             #
31
#    Nikto ( -n )                                                                              #
32
#    Nessus ( - N )                                                                            #
33
#    w3af ( -w )                                                                               #
34
#                                                                                              #
35
#    ~Known Issues~                                                                            #
36
#    Let me know                                                                               #
37
#                                                                                              #
38
#    SQLMaps SVN asks for passwords - Just keep hitting enter if you did this update           #
39
#    !!!This program runs apt-get clean - so if you want to keep downloaded updates then       #
40
#    # line 181                                                                                #
41
#                                                                                              #
42
################################################################################################
43
44
#                 Variables
45
46
# Default install paths (Change these if your install path is different)
47
     framework3_path="/pentest/exploits/framework3/"         # Metasploit framework 3
48
     framework2_path="/pentest/exploits/framework2/"         # Metasploit framework 2
49
       aircrack_path="/pentest/wireless/aircrack-ng/"        # aircrack-ng
50
      exploitdb_path="/pentest/exploits/exploitdb/"          # Exploitdb
51
            set_path="/pentest/exploits/SET/"                # Social Engineering Toolkit
52
      fasttrack_path="/pentest/exploits/fasttrack/"          # Fasttrack
53
         sqlmap_path="/pentest/database/sqlmap/"             # SQLMap
54
          nikto_path="/pentest/scanners/nikto/"              # Nikto
55
         nessus_path="/opt/nessus/sbin"                      # Nessus
56
           w3af_path="/pentest/web/w3af"                     # w3af
57
58
# Online SVN Checks (Change these if the SVN link changes)
59
      framework3_svn="https://www.metasploit.com/svn/framework3/trunk"
60
      framework2_svn="https://www.metasploit.com/svn/framework2/trunk"
61
        aircrack_svn="http://trac.aircrack-ng.org/svn/trunk"
62
       exploitdb_svn="svn://www.exploit-db.com/exploitdb"
63
             set_svn="http://svn.thepentest.com/social_engineering_toolkit"
64
       fasttrack_svn="http://svn.secmaniac.com/fasttrack"
65
          sqlmap_svn="http://svn.sqlmap.org/sqlmap/trunk/sqlmap"
66
            w3af_svn="https://w3af.svn.sourceforge.net/svnroot/w3af/trunk"
67
68
# Update Commands (Change these if the build design changes - or they are wrong)
69
  framework3_command="svn update"
70
  framework2_command="svn update"
71
    aircrack_command="svn update"
72
   exploitdb_command="svn update"
73
         set_command="./set-update"
74
   fasttrack_command="svn update"
75
      sqlmap_command="svn update"
76
       nikto_command="perl nikto.pl -update"
77
      nessus_command="./nessus-update-plugins"
78
        w3af_command="svn update"
79
80
#-- Nothing to change below this line --------------------------------------------------
81
82
# Temporary log location
83
                 log="/tmp/btupdate.log" 
84
# Borders
85
             border1="echo "############################""
86
             border2="echo "################################################################""
87
88
function help() { #help
89
   echo "(C)opyright 2010 Scamentology ~
90
######################################
91
#           btupdate $vs             #
92
# A script for updating Back|Track 4 #
93
######################################
94
95
 Usage: update.sh [options]
96
97
 Options:
98
   -d [Dist-up]            ---  apt-get everything
99
   -m [Metasploit]         ---  Update Metasploit 2 and 3 (svn update)
100
   -a [aircrack-ng]        ---  Update aircrack-ng
101
   -e [exploitdb]          ---  Update exploitdb
102
   -s [SET]                ---  Update Social Engineering Toolkit
103
   -S [SQLMap]             ---  Update SQLMap
104
   -f [Fasttrack]          ---  Update Fasttrack
105
   -n [Nikto]              ---  Update Nikto
106
   -N [Nessus]             ---  Update Nessus Plugins
107
   -w [w3af]               ---  Update w3af
108
   -x [Everything]         ---  Do all actions in script
109
   -h [Help]               ---  Help menu
110
111
 Example:
112
   ./btupdate.sh -x              (updates everything including apt-get
113
   ./btupdate.sh -d              (apt-get update & upgrade & dist-upgrade)
114
   ./btupdate.sh -m -a -s -f     (updates Metasploit Aircrack-ng SET and Fasttrack)
115
116
"
117
   exit 1
118
}
119
while getopts "dmaesSfnNwxh" OPTIONS; do
120
   case ${OPTIONS} in
121
      d ) dup="true" ;;                         # apt-get everything
122
      m ) metasploit="true" ;;                  # Update Metasploit 2 and 3 (svn co)
123
      a ) aircrack="true" ;;                    # Update aircrack-ng
124
      e ) exploitdb="true" ;;                   # Update exploitdb
125
      s ) SET="true" ;;                         # Update Social Engineering Toolkit
126
      S ) SQLMap="true" ;;                      # Update SQLMap
127
      n ) nikto="true" ;;                       # Update Nikto plugins
128
      N ) nessus="true" ;;                      # Update Nessus plugins
129
      f ) fasttrack="true" ;;                   # Update Fasttrack
130
      w ) w3af="true" ;;                        # Update w3af
131
      x ) all="true" ;;                         # Do all actions in script
132
      h ) help ;;                               # Help menu
133
      * ) help ;;                               # Default
134
   esac
135
done
136
137
#__ If the -x switch is chosen______________________________________________
138
if [ "$all" == "true" ] ; then
139
   metasploit="true"
140
     aircrack="true"
141
          dup="true"
142
          SET="true"
143
    exploitdb="true"
144
    fasttrack="true"
145
       SQLMap="true"
146
        nikto="true"
147
       nessus="true"
148
         w3af="true"
149
fi
150
151
echo "   (C)opyright 2010 Scamentology ~"
152
echo "######################################"
153
echo "#           btupdate $vs             #"
154
echo "# A script for updating Back|Track 4 #"
155
echo "######################################"
156
157
#__ Check if Root __________________________________________________________
158
if [ "$(id -u)" != "0" ] ; then echo "Run as root" ; exit 1 ; fi
159
160
#__ If no choices are made _________________________________________________
161
if [ "$all" == "" ] && [ "$metasploit" == "" ] && [ "$aircrack" == "" ] && [ "$dup" == "" ] && [ "$SET" == "" ] && [ "$SQLMap" == "" ] && [ "$exploitdb" == "" ] && [ "$fasttrack" == "" ] && [ "$nikto" == "" ] && [ "$nessus" == "" ] && [ "$w3af" == "" ] ; then echo "Please choose an option" ; exit 1 ; fi 
162
163
#__  _________________________
164
if [ "$cleanup" == "true" ] ; then clean="apt-get clean" ; fi
165
166
#__ Checking for Internet___________________________________________________
167
clear
168
$border1
169
echo "#[i] Checking for internet"
170
$border1
171
for (( ; ; ))
172
do
173
   ping -c 1 www.google.com >/dev/null
174
   return_val=$?
175
   if [ $return_val != "0" ] ; then
176
      clear
177
      $border2
178
      echo "[!] Internet access: Failed..."
179
      $border2
180
      echo "[i] Click yes to start networking then close wicd to continue"
181
      $border2
182
      read -p "[?] Would you like to open WICD now? [Y/n]: "
183
         if [[ "$REPLY" =~ ^[Yy]$ ]] ; then
184
         wicd-gtk --no-tray
185
      else
186
         clear
187
         $border1
188
         echo "[!] No internet access available"
189
         $border1
190
         exit 1
191
         fi
192
   else
193
      clear
194
      $border1
195
      echo "[i] Internet access: Success" ;
196
      $border1
197
      break;
198
   fi
199
done
200
201
#__ Distribution and apt-get _______________________________________________
202
if [ "$dup" == "true" ] ; then
203
   clear
204
   echo " -- Updating Distribution --------------------" >> $log
205
   $border1
206
   echo "[i] Updating Distribution..."
207
   $border1
208
   apt-get -y update && apt-get -y upgrade && apt-get -y dist-upgrade | grep "newly installed" >> $log
209
   $clean
210
fi
211
212
#__ MSF Framework 3 ________________________________________________________
213
if [ "$metasploit" == "true" ] ; then
214
   clear
215
   echo " -- Framework 3 ------------------------------" >> $log
216
   $border1
217
   echo "[i] Updating Framework 3..."
218
   $border1
219
   cd $framework3_path
220
   oldsvn=$(svn info | grep "Revision" | cut -c11-)
221
   newsvn=$(svn info $framework3_svn | grep "Revision" | cut -c11-)
222
   if [ "$newsvn" == "$oldsvn" ] ; then  
223
      echo "You are up to date already (SVN $newsvn)" >> $log
224
   else
225
      svn update
226
      upsvn=$(svn info | grep "Revision" | cut -c11-)
227
      if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to    (SVN $upsvn)" >> $log ; fi
228
      if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi
229
   fi
230
fi
231
232
if [ "$metasploit" == "true" ] ; then
233
   clear
234
   echo " -- Framework 2 ------------------------------" >> $log
235
   $border1
236
   echo "[i] Updating Framework 2..."
237
   $border1
238
   cd $framework2_path
239
   oldsvn=$(svn info | grep "Revision" | cut -c11-)
240
   newsvn=$(svn info $framework2_svn | grep "Revision" | cut -c11-)
241
   if [ "$newsvn" == "$oldsvn" ] ; then  
242
      echo "You are up to date already (SVN $newsvn)" >> $log
243
   else
244
      svn update
245
      upsvn=$(svn info | grep "Revision" | cut -c11-)
246
      if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to    (SVN $upsvn)" >> $log ; fi
247
      if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi
248
   fi
249
fi
250
251
#__ Aircrack-ng ____________________________________________________________
252
if [ "$aircrack" == "true" ] ; then
253
   clear
254
   echo " -- Aircrack-ng ------------------------------" >> $log
255
   $border1
256
   echo "[i] Updating aircrack-ng..."
257
   $border1
258
   cd $aircrack_path
259
   oldsvn=$(svn info | grep "Revision" | cut -c11-)
260
   newsvn=$(svn info $aircrack_svn | grep "Revision" | cut -c11-) >> $log
261
   if [ "$newsvn" == "$oldsvn" ] ; then  
262
      echo "You are up to date already (SVN $newsvn)" >> $log
263
   else
264
      svn update
265
      upsvn=$(svn info | grep "Revision" | cut -c11-)
266
      if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to    (SVN $upsvn)" >> $log ; fi
267
      if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi
268
   fi
269
fi
270
271
#__ Exploitdb ______________________________________________________________
272
if [ "$exploitdb" == "true" ] ; then
273
   clear
274
   echo " -- Exploitdb --------------------------------" >> $log
275
   $border1
276
   echo "[i] Updating Exploitdb..."
277
   $border1
278
   cd $exploitdb_path
279
   oldsvn=$(svn info | grep "Revision" | cut -c11-)
280
   newsvn=$(svn info $exploitdb_svn | grep "Revision" | cut -c11-)
281
   if [ "$newsvn" == "$oldsvn" ] ; then  
282
      echo "You are up to date already (SVN $newsvn)" >> $log
283
   else
284
      svn update
285
      upsvn=$(svn info | grep "Revision" | cut -c11-)
286
      if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to    (SVN $upsvn)" >> $log ; fi
287
      if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi
288
   fi
289
fi
290
291
#__ Social Engineering Toolkit _____________________________________________
292
if [ "$SET" == "true" ] ; then
293
   clear
294
   echo " -- SET --------------------------------------" >> $log
295
   $border1
296
   echo "[i] Updating SET..."
297
   $border1
298
   cd $set_path
299
   oldsvn=$(svn info | grep "Revision" | cut -c11-)
300
   newsvn=$(svn info $set_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 echo "Updated Successfully to    (SVN $upsvn)" >> $log ; fi
307
      if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi
308
   fi
309
fi
310
311
#__ Fast-track _____________________________________________________________
312
if [ "$fasttrack" == "true" ] ; then
313
   clear
314
   echo " -- Fasttrack --------------------------------" >> $log
315
   $border1
316
   echo "[i] Updating Fasttrack...  "
317
   $border1
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 echo "Updated Successfully to    (SVN $upsvn)" >> $log ; fi
327
      if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi
328
   fi
329
fi
330
331
#__ SQLMap _________________________________________________________________
332
if [ "$SQLMap" == "true" ] ; then
333
   clear
334
   echo " -- SQLMap -----------------------------------" >> $log
335
   $border1
336
   echo "[i] Updating SQLMap...      "
337
   $border1
338
   cd $sqlmap_path
339
   oldsvn=$(svn info | grep "Revision" | cut -c11-)
340
   newsvn=$(svn info $sqlmap_svn | grep "Revision" | cut -c11-)
341
   if [ "$newsvn" == "$oldsvn" ] ; then  
342
      echo "You are up to date already (SVN $newsvn)" >> $log
343
   else
344
      svn update
345
      upsvn=$(svn info | grep "Revision" | cut -c11-)
346
      if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to    (SVN $upsvn)" >> $log ; fi
347
      if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi
348
   fi
349
fi
350
351
#__ Nikto __________________________________________________________________
352
if [ "$nikto" == "true" ] ; then
353
   clear
354
   echo " -- Nikto ------------------------------------" >> $log
355
   $border1
356
   echo "[i] Updating Nikto...  "
357
   $border1
358
   cd $nikto_path
359
   $nikto_command | awk -v line=1 'NR == line { print $0 }'  >> $log
360
fi
361
362
#__ Nessus _________________________________________________________________
363
if [ "$nessus" == "true" ] ; then
364
   clear
365
   echo " -- Nessus -----------------------------------" >> $log
366
   $border1
367
   echo "[i] Updating Nessus...  "
368
   $border1
369
   cd $nessus_path
370
   $nessus_command | awk -v line=2 'NR == line { print $0 }'  >> $log
371
fi
372
373
#__ w3af ___________________________________________________________________
374
if [ "$w3af" == "true" ] ; then
375
   clear
376
   echo " -- w3af -------------------------------------" >> $log
377
   $border1
378
   echo "[i] Updating w3af..."
379
   $border1
380
   cd $w3af_path
381
   oldsvn=$(svn info | grep "Revision" | cut -c11-)
382
   newsvn=$(svn info $w3af_svn | grep "Revision" | cut -c11-)
383
   if [ "$newsvn" == "$oldsvn" ] ; then  
384
      echo "You are up to date already (SVN $newsvn)" >> $log
385
   else
386
      svn update
387
      upsvn=$(svn info | grep "Revision" | cut -c11-)
388
      if [ "$newsvn" == "$upsvn" ] ; then echo "Updated Successfully to    (SVN $upsvn)" >> $log ; fi
389
      if [ "$newsvn" != "$upsvn" ] ; then echo "Server might be down or slow - Try again" >> $log ; fi
390
   fi
391
fi
392
393
clear
394
$border2
395
echo " Update report for $(date)"
396
$border2
397
cat $log
398
$border2
399
sleep 1
400
rm -f $log
401
exit 1