make report_user_agent return something useful and fix a bug using the wrong column name

git-svn-id: file:///home/svn/framework3/trunk@6880 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2009-07-23 06:18:34 +00:00
parent 0ce2d7c6a1
commit 98d0b62942
1 changed files with 22 additions and 13 deletions

View File

@ -355,20 +355,25 @@ module Exploit::Remote::HttpServer
add_resource(uopts)
end
def report_user_agent(host, request)
#
# Store the results of server-side User-Agent fingerprinting in the DB.
#
# Returns an array containing host and client information.
#
def report_user_agent(address, request)
ua = request['User-Agent'].downcase
# always check for IE last because everybody tries to
# look like IE
case (ua)
when /version\/(\d+\.\d+\.\d+).*safari/
ua_name = HttpClients::SAFARI
ua_vers = $1
ua_ver = $1
when /firefox\/((:?[0-9]+\.)+[0-9]+)/
ua_name = HttpClients::FF
ua_vers = $1
ua_ver = $1
when /mozilla\/[0-9]\.[0-9] \(compatible; msie ([0-9]\.[0-9]+)/
ua_name = HttpClients::IE
ua_vers = $1
ua_ver = $1
else
ua_name = HttpClients::UNKNOWN
end
@ -429,24 +434,28 @@ module Exploit::Remote::HttpServer
else
arch = ARCH_X86
end
report_host(
:host => host,
host = {
:address => address,
:host => address,
:os_name => os_name,
:os_flavor => os_flavor,
:os_lang => os_lang || 'en',
:arch => arch
)
report_client(
:host => host,
}
report_host(host)
client = {
:host => address,
:ua_string => request['User-Agent'],
:ua_name => ua_name,
:ua_vers => ua_vers
)
:ua_ver => ua_ver
}
report_client(client)
report_note(
:host => host,
:host => address,
:type => 'http_request',
:data => "#{@myhost}:#{@myport} #{request.method} #{request.resource} #{os_name} #{ua_name} #{ua_vers}"
:data => "#{@myhost}:#{@myport} #{request.method} #{request.resource} #{os_name} #{ua_name} #{ua_ver}"
)
return [host, client]
end
#