Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/auxiliary/scanner/mdns/query.rb
19592 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Auxiliary
7
include Msf::Auxiliary::Report
8
include Msf::Auxiliary::UDPScanner
9
include Msf::Auxiliary::MDNS
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'mDNS Query',
16
'Description' => %q{
17
This module sends mDNS queries, which are really just normal UDP DNS
18
queries done (usually) over multicast on a different port, 5353.
19
},
20
'Author' => [
21
'Jon Hart <jon_hart[at]rapid7.com>'
22
],
23
'License' => MSF_LICENSE,
24
'Notes' => {
25
'Reliability' => UNKNOWN_RELIABILITY,
26
'Stability' => UNKNOWN_STABILITY,
27
'SideEffects' => UNKNOWN_SIDE_EFFECTS
28
}
29
)
30
)
31
end
32
33
def scanner_prescan(batch)
34
print_status("Sending mDNS #{query_type_name} #{query_class_name} queries for " \
35
"#{query_name} to #{batch[0]}->#{batch[-1]} port #{rport} (#{batch.length} hosts)")
36
@results = {}
37
end
38
39
def scanner_postscan(_batch)
40
found = {}
41
@results.each_pair do |peer, resps|
42
resps.each do |resp|
43
found[peer] ||= {}
44
next if found[peer][resp]
45
46
response_info = describe_response(resp)
47
print_good("#{peer} responded with #{response_info}")
48
report_service(host: peer, port: rport, proto: "udp", name: "mdns", info: response_info)
49
found[peer][resp] = true
50
end
51
end
52
end
53
end
54
55