Merge branch 'vmware-api' of github.com:rapid7/metasploit-framework into vmware-api

unstable
David Maloney 2012-02-16 02:22:31 -06:00
commit a0dac593bc
2 changed files with 15 additions and 3 deletions

View File

@ -686,6 +686,16 @@ class Host < ActiveRecord::Base
wtype['server'] = wtype['server'].to_i + points wtype['server'] = wtype['server'].to_i + points
end # End of s.info for SMTP end # End of s.info for SMTP
when 'https'
points = 101
case s.info
when /(VMware\s(ESXi?)).*\s([\d\.]+)/
# Very reliable fingerprinting from our own esx_fingerprint module
wname[$1] = wname[$1].to_i + (points * 5)
wflav[$3] = wflav[$3].to_i + (points * 5)
wtype['device'] = wtype['device'].to_i + points
end # End of s.info for HTTPS
when 'netbios' when 'netbios'
points = 201 points = 201
case s.info case s.info
@ -720,7 +730,7 @@ class Host < ActiveRecord::Base
best_match[:name] = whost.keys.sort{|a,b| whost[b] <=> whost[a]}[0] best_match[:name] = whost.keys.sort{|a,b| whost[b] <=> whost[a]}[0]
best_match[:os_lang] = wlang.keys.sort{|a,b| wlang[b] <=> wlang[a]}[0] best_match[:os_lang] = wlang.keys.sort{|a,b| wlang[b] <=> wlang[a]}[0]
best_match[:os_flavor] ||= "" best_match[:os_flavor] ||= host[:os_flavor] || ""
if best_match[:os_name] if best_match[:os_name]
# Handle cases where the flavor contains the base name # Handle cases where the flavor contains the base name
# Don't use gsub!() here because the string was a hash key in a # Don't use gsub!() here because the string was a hash key in a
@ -728,7 +738,9 @@ class Host < ActiveRecord::Base
best_match[:os_flavor] = best_match[:os_flavor].gsub(best_match[:os_name], '') best_match[:os_flavor] = best_match[:os_flavor].gsub(best_match[:os_name], '')
end end
best_match[:os_name] ||= 'Unknown' # If we didn't get anything, use whatever the host already has.
# Failing that, fallback to "Unknown"
best_match[:os_name] ||= host[:os_name] || 'Unknown'
best_match[:purpose] ||= 'device' best_match[:purpose] ||= 'device'
[:os_name, :purpose, :os_flavor, :os_sp, :arch, :name, :os_lang].each do |host_attr| [:os_name, :purpose, :os_flavor, :os_sp, :arch, :name, :os_lang].each do |host_attr|

View File

@ -81,7 +81,7 @@ class Metasploit3 < Msf::Auxiliary
this_host = nil this_host = nil
if full_match if full_match
print_good "Identified #{full_match[1]}" print_good "Identified #{full_match[1]}"
report_service(:host => (this_host || ip), :port => rport, :proto => 'tcp', :sname => 'https', :info => full_match[1]) report_service(:host => (this_host || ip), :port => rport, :proto => 'tcp', :name => 'https', :info => full_match[1])
end end
if os_match and ver_match and build_match if os_match and ver_match and build_match
if os_match[1] =~ /ESX/ or os_match[1] =~ /vCenter/ if os_match[1] =~ /ESX/ or os_match[1] =~ /vCenter/