2014-10-31 21:04:23 +00:00
|
|
|
##
|
2015-02-03 21:50:00 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2014-10-31 21:04:23 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::UDPScanner
|
2014-10-31 21:27:30 +00:00
|
|
|
include Msf::Auxiliary::MDNS
|
2014-10-31 21:04:23 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(
|
|
|
|
update_info(
|
|
|
|
info,
|
2014-11-03 19:46:38 +00:00
|
|
|
'Name' => 'mDNS Query',
|
2014-10-31 21:04:23 +00:00
|
|
|
'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-10-31 21:04:23 +00:00
|
|
|
),
|
2014-11-03 19:46:38 +00:00
|
|
|
'Author' =>
|
2014-10-31 21:04:23 +00:00
|
|
|
[
|
2014-11-03 19:46:38 +00:00
|
|
|
'Jon Hart <jon_hart[at]rapid7.com>'
|
2014-10-31 21:04:23 +00:00
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2014-11-03 19:46:38 +00:00
|
|
|
def build_probe
|
|
|
|
@probe ||= ::Net::DNS::Packet.new(datastore['NAME'], query_type_num, query_class_num).data
|
2014-10-31 21:04:23 +00:00
|
|
|
end
|
|
|
|
|
2014-11-03 19:46:38 +00:00
|
|
|
def scanner_process(data, shost, _sport)
|
|
|
|
@results[shost] ||= []
|
|
|
|
@results[shost] << data
|
|
|
|
end
|
2014-10-31 21:04:23 +00:00
|
|
|
|
2014-11-03 19:46:38 +00:00
|
|
|
def scanner_prescan(batch)
|
|
|
|
print_status("Sending mDNS #{query_type_name} #{query_class_name} queries to #{batch[0]}->#{batch[-1]} (#{batch.length} hosts)")
|
|
|
|
@results = {}
|
2014-10-31 21:04:23 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def scanner_postscan(_batch)
|
2014-11-03 19:46:38 +00:00
|
|
|
@results.each_pair do |peer, resps|
|
|
|
|
resps.each do |resp|
|
2014-11-03 23:30:57 +00:00
|
|
|
resp_message = Resolv::DNS::Message.decode(resp)
|
2015-02-03 21:49:45 +00:00
|
|
|
print_good("#{peer} responded with #{resp_message.inspect}")
|
2014-10-31 21:04:23 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|