Merge branch 'master' of github.com:rapid7/metasploit-framework

unstable
sinn3r 2012-02-15 23:47:24 -06:00
commit b8c2e2f45c
2 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,6 @@
#include "precomp.h"
#include "fs.h"
#include <sys/stat.h>
/*
* Returns an expanded file path that must be freed

View File

@ -65,7 +65,6 @@ class Host < ActiveRecord::Base
warch = {} # arch == x86, PPC, SPARC, MIPS, ''
wlang = {} # os_lang == English, ''
whost = {} # hostname
wtype = {} # purpose
# Note that we're already restricting the query to this host by using
# host.notes instead of Note, so don't need a host_id in the
@ -720,7 +719,9 @@ class Host < ActiveRecord::Base
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_flavor] ||= ""
# If service tests were inconclusive, use whatever the host already
# has, if anything.
best_match[:os_flavor] ||= host[:os_flavor] || ""
if best_match[:os_name]
# Handle cases where the flavor contains the base name
# Don't use gsub!() here because the string was a hash key in a
@ -728,7 +729,9 @@ class Host < ActiveRecord::Base
best_match[:os_flavor] = best_match[:os_flavor].gsub(best_match[:os_name], '')
end
best_match[:os_name] ||= 'Unknown'
# As with os_flavor above, 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'
[:os_name, :purpose, :os_flavor, :os_sp, :arch, :name, :os_lang].each do |host_attr|