redirect msfupdate users on Kali

bug/bundler_fix
Brent Cook 2017-05-26 10:02:51 -05:00 committed by Brent Cook
parent d4ba28a20b
commit c58d8afa2f
1 changed files with 6 additions and 21 deletions

View File

@ -13,6 +13,8 @@ while File.symlink?(msfbase)
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
end
require 'backports'
class Msfupdate
attr_reader :stdin
attr_reader :stdout
@ -132,12 +134,12 @@ class Msfupdate
end
Dir.chdir(@msfbase_dir) do
if git?
update_git!
if apt?
raise "msfupdate is not supported when Metasploit is part of the operating system. Please use 'apt update; apt install metasploit-framework'"
elsif binary_install?
update_binary_install!
elsif apt?
update_apt!
elsif git?
update_git!
else
raise "Cannot determine checkout type: `#{@msfbase_dir}'"
end
@ -267,23 +269,6 @@ class Msfupdate
end
end
def update_apt!
# For more information, see here:
# https://community.rapid7.com/community/metasploit/blog/2013/01/17/metasploit-updates-and-msfupdate
stdout.puts "[*] Checking for updates via the APT repository"
stdout.puts "[*] Note: expect weekly(ish) updates using this method"
system("apt-get", "-qq", "update")
framework_version = apt_upgrade_available('metasploit-framework')
if framework_version.blank?
stdout.puts "[*] No updates available"
else
stdout.puts "[*] Updating to version #{framework_version}"
system("apt-get", "install", "--assume-yes", "metasploit-framework")
end
end
# Adding an upstream enables msfupdate to pull updates from
# Rapid7's metasploit-framework repo instead of the repo
# the user originally cloned or forked.