mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-12 11:52:01 +01:00
document report_note a little better, and modify several modules to use it correctly. fixes #2568
git-svn-id: file:///home/svn/framework3/trunk@10377 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
7c540583b5
commit
5f0cc946b1
@ -477,6 +477,30 @@ class DBManager
|
||||
report_note(opts.merge({:wait => true}))
|
||||
end
|
||||
|
||||
#
|
||||
# Report a Note to the database. Notes can be tied to a Workspace, Host, or Service.
|
||||
#
|
||||
# opts MUST contain
|
||||
# :data -- whatever it is you're making a note of
|
||||
# :type -- The type of note, e.g. smb_peer_os
|
||||
#
|
||||
# opts can contain
|
||||
# :workspace -- the workspace to associate with this Note
|
||||
# :host -- an IP address or a Host object to associate with this Note
|
||||
# :service -- a Service object to associate with this Note
|
||||
# :port -- along with :host and proto, a service to associate with this Note
|
||||
# :proto -- along with :host and port, a service to associate with this Note
|
||||
# :update -- what to do in case a similar Note exists, see below
|
||||
#
|
||||
# The :update option can have the following values:
|
||||
# :unique -- allow only a single Note per +host+/+type+ pair
|
||||
# :unique_data -- like :uniqe, but also compare +data+
|
||||
# :insert -- always insert a new Note even if one with identical values exists
|
||||
#
|
||||
# If the provided :host is an IP address and does not exist in the
|
||||
# database, it will be created. If :workspace, :host and :service are all
|
||||
# omitted, the new Note will be associated with the current workspace.
|
||||
#
|
||||
def report_note(opts)
|
||||
return if not active
|
||||
wait = opts.delete(:wait)
|
||||
@ -494,7 +518,16 @@ class DBManager
|
||||
addr = opts[:host]
|
||||
end
|
||||
end
|
||||
|
||||
# Do the same for a service
|
||||
if (opts[:proto] and opts[:port])
|
||||
report_service(
|
||||
:workspace => wspace,
|
||||
:host => opts[:host],
|
||||
:proto => opts[:proto],
|
||||
:port => opts[:port],
|
||||
:name => opts[:sname]
|
||||
)
|
||||
end
|
||||
# Update Modes can be :unique, :unique_data, :insert
|
||||
mode = opts[:update] || :unique
|
||||
|
||||
@ -503,6 +536,9 @@ class DBManager
|
||||
if addr and not host
|
||||
host = get_host(:workspace => wspace, :host => addr)
|
||||
end
|
||||
if not opts[:service] and (opts[:port] and opts[:proto])
|
||||
opts[:service] = get_service(wspace, host, opts[:proto], opts[:port])
|
||||
end
|
||||
|
||||
if host
|
||||
host.updated_at = host.created_at
|
||||
@ -522,7 +558,7 @@ class DBManager
|
||||
args = [ ntype ]
|
||||
when :unique_data
|
||||
method = "find_or_initialize_by_ntype_and_data"
|
||||
args = [ ntype, data.to_yaml ]
|
||||
args = [ ntype, data ]
|
||||
end
|
||||
|
||||
# Find and update a record by type
|
||||
|
@ -211,7 +211,8 @@ module Exploit::Remote::HttpServer
|
||||
report_note(
|
||||
:host => address,
|
||||
:type => 'http_request',
|
||||
:data => "#{address}: #{request.method} #{request.resource} #{os_name} #{ua_name} #{ua_ver}"
|
||||
:data => "#{address}: #{request.method} #{request.resource} #{os_name} #{ua_name} #{ua_ver}",
|
||||
:update => :unique_data
|
||||
)
|
||||
return host.merge(client)
|
||||
end
|
||||
|
@ -146,10 +146,11 @@ class Metasploit3 < Msf::Auxiliary
|
||||
else
|
||||
report_note(
|
||||
:host => ip,
|
||||
:proto => 'HTTP',
|
||||
:port => rport,
|
||||
:proto => (ssl ? 'https' : 'http'),
|
||||
:type => 'DIRECTORY',
|
||||
:data => "#{tpath}#{testfdir} Code: #{res.code}"
|
||||
:data => "#{tpath}#{testfdir} Code: #{res.code}",
|
||||
:update => :unique_data
|
||||
)
|
||||
|
||||
print_status("Found #{wmap_base_url}#{tpath}#{testfdir} #{res.code} (#{wmap_target_host})")
|
||||
@ -159,10 +160,11 @@ class Metasploit3 < Msf::Auxiliary
|
||||
|
||||
report_note(
|
||||
:host => ip,
|
||||
:proto => 'HTTP',
|
||||
:port => rport,
|
||||
:proto => (ssl ? 'https' : 'http'),
|
||||
:type => 'WWW_AUTHENTICATE',
|
||||
:data => "#{tpath}#{testfdir} Auth: #{res.headers['WWW-Authenticate']}"
|
||||
:data => "#{tpath}#{testfdir} Auth: #{res.headers['WWW-Authenticate']}",
|
||||
:update => :unique_data
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -142,10 +142,11 @@ class Metasploit3 < Msf::Auxiliary
|
||||
|
||||
report_note(
|
||||
:host => ip,
|
||||
:proto => 'HTTP',
|
||||
:proto => (ssl ? 'https' : 'http'),
|
||||
:port => rport,
|
||||
:type => 'FILE',
|
||||
:data => "#{tpath}#{testfext} Code: #{res.code}"
|
||||
:data => "#{tpath}#{testfext} Code: #{res.code}",
|
||||
:update => :unique_data
|
||||
)
|
||||
|
||||
end
|
||||
|
@ -49,7 +49,7 @@ class Metasploit3 < Msf::Auxiliary
|
||||
begin
|
||||
turl = tpath+'robots.txt'
|
||||
|
||||
res = send_request_cgi({
|
||||
res = send_request_raw({
|
||||
'uri' => turl,
|
||||
'method' => 'GET',
|
||||
'version' => '1.0',
|
||||
@ -66,13 +66,13 @@ class Metasploit3 < Msf::Auxiliary
|
||||
|
||||
print_status("[#{target_host}] #{tpath}robots.txt - #{result.join(", ")}")
|
||||
result.each do |u|
|
||||
|
||||
report_note(
|
||||
:host => target_host,
|
||||
:proto => 'HTTP',
|
||||
:port => rport,
|
||||
:proto => (ssl ? 'https' : 'http'),
|
||||
:type => 'ROBOTS_TXT',
|
||||
:data => "#{u}"
|
||||
:data => "#{u}",
|
||||
:update => :unique_data
|
||||
)
|
||||
|
||||
end
|
||||
|
@ -173,7 +173,8 @@ class Metasploit3 < Msf::Auxiliary
|
||||
report_note(
|
||||
:host => cli.peerhost,
|
||||
:type => "http_cookies",
|
||||
:data => hhead + " " + cookies
|
||||
:data => hhead + " " + cookies,
|
||||
:update => :unique_data
|
||||
)
|
||||
end
|
||||
|
||||
@ -193,7 +194,8 @@ class Metasploit3 < Msf::Auxiliary
|
||||
report_note(
|
||||
:host => cli.peerhost,
|
||||
:type => "http_auth_extra",
|
||||
:data => req.resource.to_s
|
||||
:data => req.resource.to_s,
|
||||
:update => :unique_data
|
||||
)
|
||||
print_status("HTTP LOGIN #{cli.peerhost} > #{hhead}:#{@myport} #{user} / #{pass} => #{req.resource}")
|
||||
end
|
||||
@ -219,7 +221,8 @@ class Metasploit3 < Msf::Auxiliary
|
||||
report_note(
|
||||
:host => cli.peerhost,
|
||||
:type => "http_formdata",
|
||||
:data => hhead + " " + data
|
||||
:data => hhead + " " + data,
|
||||
:update => :unique_data
|
||||
)
|
||||
|
||||
res =
|
||||
@ -237,7 +240,8 @@ class Metasploit3 < Msf::Auxiliary
|
||||
report_note(
|
||||
:host => cli.peerhost,
|
||||
:type => "http_request",
|
||||
:data => "#{hhead}:#{@myport} #{req.method} #{req.resource} #{os_name} #{ua_name} #{ua_vers}"
|
||||
:data => "#{hhead}:#{@myport} #{req.method} #{req.resource} #{os_name} #{ua_name} #{ua_vers}",
|
||||
:update => :unique_data
|
||||
)
|
||||
|
||||
print_status("HTTP REQUEST #{cli.peerhost} > #{hhead}:#{@myport} #{req.method} #{req.resource} #{os_name} #{ua_name} #{ua_vers} cookies=#{cookies}")
|
||||
|
Loading…
Reference in New Issue
Block a user