Skip to content

Commit c58d8af

Browse files
busterbBrent Cook
authored andcommitted
redirect msfupdate users on Kali
1 parent d4ba28a commit c58d8af

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

msfupdate

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ while File.symlink?(msfbase)
1313
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
1414
end
1515

16+
require 'backports'
17+
1618
class Msfupdate
1719
attr_reader :stdin
1820
attr_reader :stdout
@@ -132,12 +134,12 @@ class Msfupdate
132134
end
133135

134136
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'"
137139
elsif binary_install?
138140
update_binary_install!
139-
elsif apt?
140-
update_apt!
141+
elsif git?
142+
update_git!
141143
else
142144
raise "Cannot determine checkout type: `#{@msfbase_dir}'"
143145
end
@@ -267,23 +269,6 @@ class Msfupdate
267269
end
268270
end
269271

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-
287272
# Adding an upstream enables msfupdate to pull updates from
288273
# Rapid7's metasploit-framework repo instead of the repo
289274
# the user originally cloned or forked.

0 commit comments

Comments
 (0)