CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/auxiliary/scanner/mdns/query.rb
Views: 1904
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
[
22
'Jon Hart <jon_hart[at]rapid7.com>'
23
],
24
'License' => MSF_LICENSE
25
)
26
)
27
end
28
29
def scanner_prescan(batch)
30
print_status("Sending mDNS #{query_type_name} #{query_class_name} queries for " \
31
"#{query_name} to #{batch[0]}->#{batch[-1]} port #{rport} (#{batch.length} hosts)")
32
@results = {}
33
end
34
35
def scanner_postscan(_batch)
36
found = {}
37
@results.each_pair do |peer, resps|
38
resps.each do |resp|
39
found[peer] ||= {}
40
next if found[peer][resp]
41
response_info = describe_response(resp)
42
print_good("#{peer} responded with #{response_info}")
43
report_service(host: peer, port: rport, proto: "udp", name: "mdns", info: response_info)
44
found[peer][resp] = true
45
end
46
end
47
end
48
end
49
50