metasploit-framework/modules/auxiliary/scanner/mdns/query.rb

49 lines
1.4 KiB
Ruby
Raw Normal View History

##
2015-02-03 21:50:00 +00:00
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Auxiliary
include Msf::Auxiliary::Report
include Msf::Auxiliary::UDPScanner
include Msf::Auxiliary::MDNS
def initialize(info = {})
super(
update_info(
info,
2014-11-03 19:46:38 +00:00
'Name' => 'mDNS Query',
'Description' => %q(
2014-11-03 19:53:38 +00:00
This module sends mDNS queries, which are really just normal UDP DNS
queries done (usually) over multicast on a different port, 5353.
),
2014-11-03 19:46:38 +00:00
'Author' =>
[
2014-11-03 19:46:38 +00:00
'Jon Hart <jon_hart[at]rapid7.com>'
],
'License' => MSF_LICENSE
)
)
end
2014-11-03 19:46:38 +00:00
def scanner_prescan(batch)
2015-08-28 21:04:52 +00:00
print_status("Sending mDNS #{query_type_name} #{query_class_name} queries for " \
2015-08-13 18:17:27 +00:00
"#{query_name} to #{batch[0]}->#{batch[-1]} port #{rport} (#{batch.length} hosts)")
2014-11-03 19:46:38 +00:00
@results = {}
end
def scanner_postscan(_batch)
found = {}
2014-11-03 19:46:38 +00:00
@results.each_pair do |peer, resps|
resps.each do |resp|
found[peer] ||= {}
next if found[peer][resp]
response_info = describe_response(resp)
print_good("#{peer} responded with #{response_info}")
report_service(host: peer, port: rport, proto: "udp", name: "mdns", info: response_info)
found[peer][resp] = true
end
end
end
end