metasploit-framework/modules/auxiliary/scanner/discovery/empty_udp.rb

45 lines
1.2 KiB
Ruby
Raw Normal View History

##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Auxiliary
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>',
'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'])
], self.class)
end
def setup
2014-09-19 18:12:14 +00:00
super
@ports = Rex::Socket.portspec_crack(datastore['PORTS'])
2014-09-19 18:12:14 +00:00
raise Msf::OptionValidateError.new(['PORTS']) if @ports.empty?
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)")
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")
report_service(:host => shost, :port => sport, :proto => 'udp', :info => data.inspect)
end
end