2014-09-10 17:58:22 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2014-09-10 17:58:22 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2014-09-10 17:58:22 +00:00
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::UDPScanner
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'UDP Empty Prober',
|
|
|
|
'Description' => 'Detect UDP services that reply to empty probes',
|
2014-09-19 18:56:13 +00:00
|
|
|
'Author' => 'Jon Hart <jon_hart[at]rapid7.com>',
|
2014-09-10 17:58:22 +00:00
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
|
|
|
register_options([
|
2014-09-18 19:31:52 +00:00
|
|
|
OptString.new('PORTS', [true, 'Ports to probe', '1-1024,1194,2000,2049,4353,5060,5061,5351,8443'])
|
2014-09-10 17:58:22 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def setup
|
2014-09-19 18:12:14 +00:00
|
|
|
super
|
2014-09-10 17:58:22 +00:00
|
|
|
@ports = Rex::Socket.portspec_crack(datastore['PORTS'])
|
2014-09-19 18:12:14 +00:00
|
|
|
raise Msf::OptionValidateError.new(['PORTS']) if @ports.empty?
|
2014-09-10 17:58:22 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def scanner_prescan(batch)
|
2014-09-18 19:31:52 +00:00
|
|
|
print_status("Sending #{@ports.length} empty probes to #{batch[0]}->#{batch[-1]} (#{batch.length} hosts)")
|
2014-09-10 17:58:22 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def scan_host(ip)
|
|
|
|
@ports.each do |port|
|
|
|
|
scanner_send('', ip, port)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def scanner_process(data, shost, sport)
|
|
|
|
print_good("Received #{data.inspect} from #{shost}:#{sport}/udp")
|
2014-09-19 17:45:06 +00:00
|
|
|
report_service(:host => shost, :port => sport, :proto => 'udp', :info => data.inspect)
|
2014-09-10 17:58:22 +00:00
|
|
|
end
|
|
|
|
end
|