From b95cc7bbbeff7c95769eb149620fc64321d60f15 Mon Sep 17 00:00:00 2001 From: Jon Hart Date: Wed, 5 Oct 2016 09:51:31 -0700 Subject: [PATCH] Set correct default options; fix usage on OS X Fixes 7404 --- .../auxiliary/fuzzers/ntp/ntp_protocol_fuzzer.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/auxiliary/fuzzers/ntp/ntp_protocol_fuzzer.rb b/modules/auxiliary/fuzzers/ntp/ntp_protocol_fuzzer.rb index 3d7168f45e..1168560d9d 100644 --- a/modules/auxiliary/fuzzers/ntp/ntp_protocol_fuzzer.rb +++ b/modules/auxiliary/fuzzers/ntp/ntp_protocol_fuzzer.rb @@ -53,10 +53,10 @@ class MetasploitModule < Msf::Auxiliary register_advanced_options( [ OptString.new('VERSIONS', [false, 'Specific versions to fuzz (csv)', '2,3,4']), - OptString.new('MODES', [false, 'Modes to fuzz (csv)', nil]), - OptString.new('MODE_6_OPERATIONS', [false, 'Mode 6 operations to fuzz (csv)', nil]), - OptString.new('MODE_7_IMPLEMENTATIONS', [false, 'Mode 7 implementations to fuzz (csv)', nil]), - OptString.new('MODE_7_REQUEST_CODES', [false, 'Mode 7 request codes to fuzz (csv)', nil]) + OptString.new('MODES', [false, 'Modes to fuzz (csv)']), + OptString.new('MODE_6_OPERATIONS', [false, 'Mode 6 operations to fuzz (csv)']), + OptString.new('MODE_7_IMPLEMENTATIONS', [false, 'Mode 7 implementations to fuzz (csv)']), + OptString.new('MODE_7_REQUEST_CODES', [false, 'Mode 7 request codes to fuzz (csv)']) ], self.class) end @@ -68,7 +68,7 @@ class MetasploitModule < Msf::Auxiliary thing = setting.upcase const_name = thing.to_sym var_name = thing.downcase - if datastore.key?(thing) + if datastore[thing] instance_variable_set("@#{var_name}", datastore[thing].split(/[^\d]/).select { |v| !v.empty? }.map { |v| v.to_i }) unsupported_things = instance_variable_get("@#{var_name}") - Rex::Proto::NTP.const_get(const_name) fail "Unsupported #{thing}: #{unsupported_things}" unless unsupported_things.empty? @@ -178,7 +178,11 @@ class MetasploitModule < Msf::Auxiliary # Sends +message+ to +host+ on UDP port +port+, returning all replies def probe(host, port, message) replies = [] - udp_sock.sendto(message, host, port, 0) + begin + udp_sock.sendto(message, host, port, 0) + rescue ::Errno::EISCONN + udp_sock.write(message) + end reply = udp_sock.recvfrom(65535, datastore['WAIT'] / 1000.0) while reply && reply[1] replies << reply