Cosmetic cleanup to the module output for vmauthd_login

unstable
HD Moore 2012-02-19 18:16:54 -06:00
parent 08d91aebdb
commit 87e7bf4934
1 changed files with 28 additions and 17 deletions

View File

@ -39,27 +39,32 @@ class Metasploit3 < Msf::Auxiliary
register_options([Opt::RPORT(902)])
end
def run_host(ip)
begin
connect
rescue
print_error "Could not connect to #{ip}:#{datastore['RPORT']}"
connect rescue nil
if not self.sock
print_error "#{rhost}:#{rport} Could not connect to vmauthd"
return
end
banner = sock.get_once.chomp
print_status "Banner: #{banner}"
banner = sock.get_once(-1, 10)
if not banner
print_error "#{rhost}:#{rport} No banner received from vmauthd"
return
end
banner = banner.strip
print_status "#{rhost}:#{rport} Banner: #{banner}"
unless banner.include? "VMware Authentication Daemon"
print_error "This does not appear to be a vmauthd service"
unless banner =~ /VMware Authentication Daemon/
print_error "#{rhost}:#{rport} This does not appear to be a vmauthd service"
return
end
if banner.include? "SSL"
print_status("Switching to SSL connection...")
if banner =~ /SSL/
print_status("#{rhost}:#{rport} Switching to SSL connection...")
swap_sock_plain_to_ssl
end
@ -67,9 +72,9 @@ class Metasploit3 < Msf::Auxiliary
result = do_login(user, pass)
case result
when :failed
print_error("#{ip}:#{datastore['RPORT']} vmauthd login FAILED - #{user}:#{pass}")
print_error("#{rhost}:#{rport} vmauthd login FAILED - #{user}:#{pass}")
when :success
print_good("#{ip}:#{datastore['RPORT']} vmauthd login SUCCESS - #{user}:#{pass}")
print_good("#{rhost}:#{rport} vmauthd login SUCCESS - #{user}:#{pass}")
report_auth_info(
:host => rhost,
:port => rport,
@ -81,9 +86,15 @@ class Metasploit3 < Msf::Auxiliary
)
return if datastore['STOP_ON_SUCCESS']
else
print_error("#{ip}:#{datastore['RPORT']} #{res}")
print_error("#{rhost}:#{rport} Error: #{res}")
end
end
rescue ::Interrupt
raise $!
ensure
disconnect
end
end
@ -91,7 +102,7 @@ class Metasploit3 < Msf::Auxiliary
nsock.put("USER #{user}\r\n")
res = nsock.get_once
unless res.start_with? "331"
ret_msg = "received unexpected reply to the USER command: #{res}"
ret_msg = "Unexpected reply to the USER command: #{res}"
return ret_msg
end
nsock.put("PASS #{pass}\r\n")
@ -101,7 +112,7 @@ class Metasploit3 < Msf::Auxiliary
elsif res.start_with? "230"
return :success
else
ret_msg = "received unexpected reply to the PASS command: #{res}"
ret_msg = "Unexpected reply to the PASS command: #{res}"
return ret_msg
end
end