2014-10-09 02:03:07 +00:00
|
|
|
# -*- coding: binary -*-
|
|
|
|
require 'rex/proto/llmnr'
|
|
|
|
require 'msf/core/exploit'
|
|
|
|
module Msf
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# This module provides methods for working with LLMNR
|
|
|
|
#
|
|
|
|
###
|
|
|
|
module Auxiliary::LLMNR
|
|
|
|
|
2014-10-21 19:59:54 +00:00
|
|
|
include Auxiliary::UDPScanner
|
2014-10-09 02:03:07 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Initializes an instance of an auxiliary module that uses LLMNR
|
|
|
|
#
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super
|
|
|
|
register_options(
|
|
|
|
[
|
2014-10-21 19:59:54 +00:00
|
|
|
OptAddressRange.new('RHOSTS', [true, 'The multicast address or CIDR range of targets to query', '224.0.0.252']),
|
2014-10-31 23:20:10 +00:00
|
|
|
Opt::RPORT(5355),
|
|
|
|
OptString.new('NAME', [true, 'The name to query', 'localhost']),
|
2014-11-03 19:07:08 +00:00
|
|
|
OptString.new('TYPE', [true, 'The query type (name, # or TYPE#)', 'A']),
|
|
|
|
OptString.new('CLASS', [true, 'The query class (name, # or CLASS#)', 'IN'])
|
2014-10-09 02:03:07 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
2014-10-31 23:20:10 +00:00
|
|
|
|
|
|
|
def setup
|
|
|
|
query_class_name
|
|
|
|
query_type_name
|
|
|
|
end
|
|
|
|
|
|
|
|
def query_class
|
2014-11-03 19:07:08 +00:00
|
|
|
if datastore['CLASS'] =~ /^\d+$/
|
|
|
|
datastore['CLASS'].to_i
|
2014-10-31 23:20:10 +00:00
|
|
|
else
|
2014-11-03 19:07:08 +00:00
|
|
|
datastore['CLASS'].upcase
|
2014-10-31 23:20:10 +00:00
|
|
|
end
|
2014-11-03 19:07:08 +00:00
|
|
|
end
|
2014-10-31 23:20:10 +00:00
|
|
|
|
2014-11-03 19:07:08 +00:00
|
|
|
def query_class_name
|
|
|
|
Net::DNS::RR::Classes.new(query_class).to_s
|
2014-10-31 23:20:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def query_class_num
|
2014-11-03 19:07:08 +00:00
|
|
|
Net::DNS::RR::Classes.new(query_class).to_i
|
2014-10-31 23:20:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def query_type
|
2014-11-03 19:07:08 +00:00
|
|
|
if datastore['TYPE'] =~ /^\d+$/
|
|
|
|
datastore['TYPE'].to_i
|
2014-10-31 23:20:10 +00:00
|
|
|
else
|
2014-11-03 19:07:08 +00:00
|
|
|
datastore['TYPE'].upcase
|
2014-10-31 23:20:10 +00:00
|
|
|
end
|
2014-11-03 19:07:08 +00:00
|
|
|
end
|
2014-10-31 23:20:10 +00:00
|
|
|
|
2014-11-03 19:07:08 +00:00
|
|
|
def query_type_name
|
|
|
|
Net::DNS::RR::Types.new(query_type).to_s
|
2014-10-31 23:20:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def query_type_num
|
2014-11-03 19:07:08 +00:00
|
|
|
Net::DNS::RR::Types.new(query_type).to_i
|
2014-10-31 23:20:10 +00:00
|
|
|
end
|
2014-10-09 02:03:07 +00:00
|
|
|
end
|
|
|
|
end
|