@@ -13,6 +13,8 @@ while File.symlink?(msfbase)
13
13
msfbase = File . expand_path ( File . readlink ( msfbase ) , File . dirname ( msfbase ) )
14
14
end
15
15
16
+ require 'backports'
17
+
16
18
class Msfupdate
17
19
attr_reader :stdin
18
20
attr_reader :stdout
@@ -132,12 +134,12 @@ class Msfupdate
132
134
end
133
135
134
136
Dir . chdir ( @msfbase_dir ) do
135
- if git ?
136
- update_git!
137
+ if apt ?
138
+ raise "msfupdate is not supported when Metasploit is part of the operating system. Please use 'apt update; apt install metasploit-framework'"
137
139
elsif binary_install?
138
140
update_binary_install!
139
- elsif apt ?
140
- update_apt !
141
+ elsif git ?
142
+ update_git !
141
143
else
142
144
raise "Cannot determine checkout type: `#{ @msfbase_dir } '"
143
145
end
@@ -267,23 +269,6 @@ class Msfupdate
267
269
end
268
270
end
269
271
270
- def update_apt!
271
- # For more information, see here:
272
- # https://community.rapid7.com/community/metasploit/blog/2013/01/17/metasploit-updates-and-msfupdate
273
- stdout . puts "[*] Checking for updates via the APT repository"
274
- stdout . puts "[*] Note: expect weekly(ish) updates using this method"
275
- system ( "apt-get" , "-qq" , "update" )
276
-
277
- framework_version = apt_upgrade_available ( 'metasploit-framework' )
278
-
279
- if framework_version . blank?
280
- stdout . puts "[*] No updates available"
281
- else
282
- stdout . puts "[*] Updating to version #{ framework_version } "
283
- system ( "apt-get" , "install" , "--assume-yes" , "metasploit-framework" )
284
- end
285
- end
286
-
287
272
# Adding an upstream enables msfupdate to pull updates from
288
273
# Rapid7's metasploit-framework repo instead of the repo
289
274
# the user originally cloned or forked.
0 commit comments