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
:attribute
is allowed to be present for the given:module_type
. -
#dynamic_length_validation_options(options = {}) ⇒ Hash{Symbol => Integer}
The length validation options for the given
:attribute
and:module_type
. -
#stanced?(module_type) ⇒ true, false
Whether the
:module_type
requires 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.
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/metasploit/model/module/instance.rb', line 387 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
.
421 422 423 424 425 426 427 428 |
# File 'lib/metasploit/model/module/instance.rb', line 421 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
.
436 437 438 |
# File 'lib/metasploit/model/module/instance.rb', line 436 def stanced?(module_type) STANCED_MODULE_TYPES.include? module_type end |