Skip to content

Commit

Permalink
Cleanup after some testing
Browse files Browse the repository at this point in the history
  • Loading branch information
todb committed Feb 24, 2013
1 parent d5a0742 commit a7c0d62
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions lib/msf/ui/console/command_dispatcher/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2620,18 +2620,20 @@ def cmd_go_pro(*args)
end
unless is_metasploit_debian_package_installed
print_warning " You will want to install the 'metasploit' package first."
print_warning " Type 'apt-get install metasploit' to do this now."
print_warning " Type 'apt-get install metasploit' to do this now, then try 'go_pro' again."
return false
end
# If I've gotten this far, I know that this is apt-installed
# and the packages I need are here.
if is_metasploit_service_running
print_good " Metasploit services are running, launching a browser..."
launch_metasploit_browser
else
print_warning " Starting the Metasploit services. This will take a few minutes."
print_status "Starting the Metasploit services. This can take a little time."
start_metasploit_service
launch_metasploit_browser
select(nil,nil,nil,3)
if is_metasploit_service_running
launch_metasploit_browser
end
end
@@go_pro_opts.parse(args) do |opt, idx, val|
case opt
Expand All @@ -2646,25 +2648,33 @@ def cmd_go_pro(*args)
def launch_metasploit_browser
cmd = "/usr/bin/xdg-open"
return unless ::File.executable_real? cmd
svc_log = File.join(msf_base, ".." , "engine", "prosvc_stdout.log")
svc_log = File.expand_path(File.join(msfbase_dir, ".." , "engine", "prosvc_stdout.log"))
return unless ::File.readable_real? svc_log
really_started = false
# This method is a little lame but it's a short enough file that it
# shouldn't really matter that we reopen it a few times.
# shouldn't really matter that we open and close it a few times.
until really_started
select(3,nil,nil,nil)
select(nil,nil,nil,3)
log_data = ::File.open(svc_log, "rb") {|f| f.read f.stat.size}
really_started = log_data =~ /^\[\*\] Ready/ # This is webserver ready, not totally ready.
print_raw "." unless really_started
really_started = log_data =~ /^\[\*\] Ready/ # This is webserver ready
if really_started
print_line
print_good "The web UI is up and running, connecting with your default browser."
print_good "If this is your first time connecting, you will be presented with"
print_good "a self-signed certificate warning. Accept it to create a new user."
select(nil,nil,nil,7)
system(cmd, "https://localhost:3790")
else
print "."
end
end
system(cmd, "https://localhost:3790")
end

def start_metasploit_service
cmd = "/usr/sbin/service"
return unless ::File.executable_real? cmd
%x{#{cmd} metasploit start}.each_line do |line|
print_status line
print_status line.chomp
end
end

Expand All @@ -2676,6 +2686,7 @@ def is_metasploit_service_running
%w{web rpc}.each do |svc|
return false unless services.include?(expected % svc)
end
return true
end

def is_metasploit_debian_package_installed
Expand All @@ -2687,6 +2698,7 @@ def is_metasploit_debian_package_installed
return true
end
end
return false
end

# Determines if this is an apt-based install
Expand Down

0 comments on commit a7c0d62

Please sign in to comment.