Skip to content

Commit e1f35c5

Browse files
author
HD Moore
committed
Update using the MSP updater if available
1 parent 3e898b2 commit e1f35c5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

msfupdate

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ if not (Process.uid == 0 or File.stat(msfbase).owned?)
2828
$stderr.puts "Please run msfupdate as the same user who installed metasploit."
2929
end
3030

31+
def is_pro
32+
File.exists?(File.expand_path(File.join(@msfbase_dir, "..", "engine", "update.rb")))
33+
end
3134

3235
def is_git
3336
File.directory?(File.join(@msfbase_dir, ".git"))
@@ -105,7 +108,7 @@ if is_git
105108
# attempt to reapply them. If the user wants them back
106109
# they can always git stash pop them, and that presumes
107110
# they know what they're doing when they're editing local
108-
# checkout, which presumes they're not using msfupdate
111+
# checkout, which presumes they're not using msfupdate
109112
# to begin with.
110113
#
111114
# Note, this requires at least user.name and user.email
@@ -130,7 +133,12 @@ if is_git
130133
system("git", "merge", "#{remote}/#{branch}")
131134
end
132135

133-
unless is_svn || is_git
136+
if is_pro
137+
update_script = File.expand_path(File.join(@msfbase, "..", "engine", "update.rb"))
138+
system("ruby", update_script)
139+
end
140+
141+
unless is_svn || is_git || is_pro
134142
raise RuntimeError, "Cannot determine checkout type: `#{@msfbase_dir}'"
135143
end
136144

0 commit comments

Comments
 (0)