Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add the optional pause for Windows

  • Loading branch information...
commit 279a61d0f4f6d6128902d22d0da45d828e11a68f 1 parent db4a392
@todb todb authored bturner-r7 committed
Showing with 17 additions and 10 deletions.
  1. +17 −10 msfupdate
View
27 msfupdate
@@ -23,6 +23,7 @@ $stderr.puts "[*] Attempting to update the Metasploit Framework..."
$stderr.puts "[*]"
$stderr.puts ""
+# Bail right away, no waiting around for consoles.
if not (Process.uid == 0 or File.stat(msfbase).owned?)
$stderr.puts "[-] ERROR: User running msfupdate does not own the Metasploit installation"
$stderr.puts "[-] Please run msfupdate as the same user who installed Metasploit."
@@ -58,6 +59,16 @@ def print_deprecation_warning
$stdout.puts "[*] Please adjust your egress firewall rules accordingly."
end
+def maybe_wait_and_exit(exit_code=0)
+ if @actually_wait
+ $stdout.puts ""
+ $stdout.puts "[*] Please hit enter to exit"
+ $stdout.puts ""
+ $stdin.readline
+ exit exit_code
+ end
+end
+
# Some of these args are meaningful for SVN, some for Git,
# some for both. Fun times.
@args.each_with_index do |arg,i|
@@ -104,7 +115,7 @@ if is_svn
$stderr.puts "[-] If you used a binary installer, make sure you run the symlink in"
$stderr.puts "[-] /usr/local/bin instead of running this file directly (e.g.: ./msfupdate)"
$stderr.puts "[-] to ensure a proper environment."
- exit 1
+ maybe_wait_and_exit 1
else
# Cleanup worked, go ahead and update
system("svn", "update", *@args)
@@ -136,7 +147,7 @@ if is_git
$stderr.puts "[-] If you used a binary installer, make sure you run the symlink in"
$stderr.puts "[-] /usr/local/bin instead of running this file directly (e.g.: ./msfupdate)"
$stderr.puts "[-] to ensure a proper environment."
- exit 1
+ maybe_wait_and_exit 1
elsif not committed
system("git", "stash")
$stdout.puts "[*] Stashed local changes to avoid merge conflicts."
@@ -161,7 +172,7 @@ if is_installed
$stdout.puts "[-] You must be able to read the product key for the"
$stdout.puts "[-] Metasploit installation in order to run msfupdate."
$stdout.puts "[-] Usually, this means you must be root (EUID 0)."
- exit 0x10
+ maybe_wait_and_exit 10
end
else
$stdout.puts "[-] ERROR: Failed to update Metasploit installation"
@@ -171,7 +182,7 @@ if is_installed
$stderr.puts "[-] https://localhost:3790 (note, Metasploit Community"
$stderr.puts "[-] Edition is totally free and takes just a few seconds"
$stderr.puts "[-] to register!)"
- exit 0x11
+ maybe_wait_and_exit 11
end
end
@@ -179,9 +190,5 @@ unless is_svn || is_git || is_installed
raise RuntimeError, "Cannot determine checkout type: `#{@msfbase_dir}'"
end
-if @actually_wait
- $stderr.puts ""
- $stderr.puts "[*] Please hit enter to exit"
- $stderr.puts ""
- $stdin.readline
-end
+maybe_wait_and_exit(0)
+
Please sign in to comment.
Something went wrong with that request. Please try again.