redirect msfupdate users on Kali
parent
d4ba28a20b
commit
c58d8afa2f
27
msfupdate
27
msfupdate
|
@ -13,6 +13,8 @@ while File.symlink?(msfbase)
|
||||||
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
|
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require 'backports'
|
||||||
|
|
||||||
class Msfupdate
|
class Msfupdate
|
||||||
attr_reader :stdin
|
attr_reader :stdin
|
||||||
attr_reader :stdout
|
attr_reader :stdout
|
||||||
|
@ -132,12 +134,12 @@ class Msfupdate
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir(@msfbase_dir) do
|
Dir.chdir(@msfbase_dir) do
|
||||||
if git?
|
if apt?
|
||||||
update_git!
|
raise "msfupdate is not supported when Metasploit is part of the operating system. Please use 'apt update; apt install metasploit-framework'"
|
||||||
elsif binary_install?
|
elsif binary_install?
|
||||||
update_binary_install!
|
update_binary_install!
|
||||||
elsif apt?
|
elsif git?
|
||||||
update_apt!
|
update_git!
|
||||||
else
|
else
|
||||||
raise "Cannot determine checkout type: `#{@msfbase_dir}'"
|
raise "Cannot determine checkout type: `#{@msfbase_dir}'"
|
||||||
end
|
end
|
||||||
|
@ -267,23 +269,6 @@ class Msfupdate
|
||||||
end
|
end
|
||||||
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
|
# Adding an upstream enables msfupdate to pull updates from
|
||||||
# Rapid7's metasploit-framework repo instead of the repo
|
# Rapid7's metasploit-framework repo instead of the repo
|
||||||
# the user originally cloned or forked.
|
# the user originally cloned or forked.
|
||||||
|
|
Loading…
Reference in New Issue