Land #5314, set snmp defaults for constrained values

This commit is contained in:
Brent Cook 2015-05-06 16:27:41 -05:00
commit 78c58088fe
No known key found for this signature in database
GPG Key ID: 1FFAA0B24B708F96
2 changed files with 7 additions and 4 deletions

View File

@ -11,7 +11,10 @@ module Metasploit
class SNMP
include Metasploit::Framework::LoginScanner::Base
DEFAULT_TIMEOUT = 2
DEFAULT_PORT = 161
DEFAULT_RETRIES = 0
DEFAULT_VERSION = 'all'
LIKELY_PORTS = [ 161, 162 ]
LIKELY_SERVICE_NAMES = [ 'snmp' ]
PRIVATE_TYPES = [ :password ]
@ -112,11 +115,13 @@ module Metasploit
end
# Sets the connection timeout approrpiately for SNMP
# Sets the connection timeout appropriately for SNMP
# if the user did not set it.
def set_sane_defaults
self.connection_timeout = 2 if self.connection_timeout.nil?
self.connection_timeout = DEFAULT_TIMEOUT if self.connection_timeout.nil?
self.port = DEFAULT_PORT if self.port.nil?
self.retries = DEFAULT_RETRIES if self.retries.nil?
self.version = DEFAULT_VERSION if self.version.nil?
end
# This method takes an snmp client and tests whether

View File

@ -37,8 +37,6 @@ describe Metasploit::Framework::LoginScanner::SNMP do
snmp_scanner.host = '127.0.0.1'
snmp_scanner.port = 161
snmp_scanner.connection_timeout = 1
snmp_scanner.retries = 0
snmp_scanner.version = 'all'
snmp_scanner.stop_on_success = true
snmp_scanner.cred_details = detail_group
end