Module: Metasploit::Model::Module::Instance::ClassMethods
- Included in:
- Metasploit::Model::Module::Instance
- Defined in:
- lib/metasploit/model/module/instance.rb
Overview
Module Methods
Instance Method Summary collapse
-
#allows?(options = {}) ⇒ true
Whether the given
:attributeis allowed to be present for the given:module_type. -
#dynamic_length_validation_options(options = {}) ⇒ Hash{Symbol => Integer}
The length validation options for the given
:attributeand:module_type. -
#stanced?(module_type) ⇒ true, false
Whether the
:module_typerequires stance to be in Stance::ALL or if it must benil.
Instance Method Details
#allows?(options = {}) ⇒ true
Whether the given :attribute is allowed to be present for the given :module_type. An attribute is
considered allowed if it allows greatrr than 0 elements for a collection.
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/metasploit/model/module/instance.rb', line 381 def allows?(={}) allowed = false = () is = [:is] if is if is > 0 allowed = true end else maximum = [:maximum] if maximum if maximum > 0 allowed = true end else # if there is no maximum, then it's treated as infinite allowed = true end end allowed end |
#dynamic_length_validation_options(options = {}) ⇒ Hash{Symbol => Integer}
The length validation options for the given :attribute and :module_type.
415 416 417 418 419 420 421 422 |
# File 'lib/metasploit/model/module/instance.rb', line 415 def (={}) .assert_valid_keys(:attribute, :module_type) attribute = .fetch(:attribute) module_type = .fetch(:module_type) = DYNAMIC_LENGTH_VALIDATION_OPTIONS_BY_MODULE_TYPE_BY_ATTRIBUTE.fetch(attribute) .fetch(module_type) end |
#stanced?(module_type) ⇒ true, false
Whether the :module_type requires stance to be in Stance::ALL or if it must
be nil.
430 431 432 |
# File 'lib/metasploit/model/module/instance.rb', line 430 def stanced?(module_type) STANCED_MODULE_TYPES.include? module_type end |