metasploit-model 0.24.1.pre.semantic.pre.versioning.pre.2.pre.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +27 -0
- data/.rspec +4 -0
- data/.simplecov +38 -0
- data/.travis.yml +6 -0
- data/.yardopts +5 -0
- data/Gemfile +43 -0
- data/LICENSE +27 -0
- data/README.md +33 -0
- data/Rakefile +52 -0
- data/app/models/metasploit/model/association/reflection.rb +46 -0
- data/app/models/metasploit/model/module/ancestor/spec/template.rb +125 -0
- data/app/models/metasploit/model/module/class/spec/template.rb +92 -0
- data/app/models/metasploit/model/module/instance/spec/template.rb +97 -0
- data/app/models/metasploit/model/search/group/base.rb +21 -0
- data/app/models/metasploit/model/search/group/intersection.rb +4 -0
- data/app/models/metasploit/model/search/group/union.rb +4 -0
- data/app/models/metasploit/model/search/operation/base.rb +39 -0
- data/app/models/metasploit/model/search/operation/boolean.rb +36 -0
- data/app/models/metasploit/model/search/operation/date.rb +37 -0
- data/app/models/metasploit/model/search/operation/integer.rb +14 -0
- data/app/models/metasploit/model/search/operation/null.rb +26 -0
- data/app/models/metasploit/model/search/operation/set.rb +34 -0
- data/app/models/metasploit/model/search/operation/set/integer.rb +5 -0
- data/app/models/metasploit/model/search/operation/set/string.rb +5 -0
- data/app/models/metasploit/model/search/operation/string.rb +11 -0
- data/app/models/metasploit/model/search/operation/union.rb +59 -0
- data/app/models/metasploit/model/search/operator/association.rb +43 -0
- data/app/models/metasploit/model/search/operator/attribute.rb +60 -0
- data/app/models/metasploit/model/search/operator/base.rb +34 -0
- data/app/models/metasploit/model/search/operator/delegation.rb +40 -0
- data/app/models/metasploit/model/search/operator/deprecated/app.rb +27 -0
- data/app/models/metasploit/model/search/operator/deprecated/author.rb +33 -0
- data/app/models/metasploit/model/search/operator/deprecated/authority.rb +43 -0
- data/app/models/metasploit/model/search/operator/deprecated/platform.rb +45 -0
- data/app/models/metasploit/model/search/operator/deprecated/ref.rb +50 -0
- data/app/models/metasploit/model/search/operator/deprecated/text.rb +32 -0
- data/app/models/metasploit/model/search/operator/null.rb +44 -0
- data/app/models/metasploit/model/search/operator/single.rb +98 -0
- data/app/models/metasploit/model/search/operator/union.rb +33 -0
- data/app/models/metasploit/model/search/query.rb +171 -0
- data/app/models/metasploit/model/spec/template.rb +273 -0
- data/app/models/metasploit/model/visitation/visitor.rb +69 -0
- data/app/validators/derivation_validator.rb +17 -0
- data/app/validators/dynamic_length_validator.rb +45 -0
- data/app/validators/ip_format_validator.rb +31 -0
- data/app/validators/nil_validator.rb +16 -0
- data/app/validators/parameters_validator.rb +147 -0
- data/app/validators/password_is_strong_validator.rb +115 -0
- data/config/locales/en.yml +209 -0
- data/lib/metasploit/model.rb +38 -0
- data/lib/metasploit/model/architecture.rb +346 -0
- data/lib/metasploit/model/association.rb +49 -0
- data/lib/metasploit/model/association/error.rb +40 -0
- data/lib/metasploit/model/author.rb +58 -0
- data/lib/metasploit/model/authority.rb +134 -0
- data/lib/metasploit/model/authority/bid.rb +10 -0
- data/lib/metasploit/model/authority/cve.rb +10 -0
- data/lib/metasploit/model/authority/msb.rb +10 -0
- data/lib/metasploit/model/authority/osvdb.rb +10 -0
- data/lib/metasploit/model/authority/pmasa.rb +10 -0
- data/lib/metasploit/model/authority/secunia.rb +10 -0
- data/lib/metasploit/model/authority/us_cert_vu.rb +10 -0
- data/lib/metasploit/model/authority/waraxe.rb +31 -0
- data/lib/metasploit/model/authority/zdi.rb +10 -0
- data/lib/metasploit/model/base.rb +25 -0
- data/lib/metasploit/model/configuration.rb +72 -0
- data/lib/metasploit/model/configuration/autoload.rb +109 -0
- data/lib/metasploit/model/configuration/child.rb +12 -0
- data/lib/metasploit/model/configuration/error.rb +4 -0
- data/lib/metasploit/model/configuration/i18n.rb +54 -0
- data/lib/metasploit/model/configuration/parent.rb +50 -0
- data/lib/metasploit/model/configured.rb +46 -0
- data/lib/metasploit/model/derivation.rb +110 -0
- data/lib/metasploit/model/derivation/full_name.rb +25 -0
- data/lib/metasploit/model/email_address.rb +128 -0
- data/lib/metasploit/model/engine.rb +34 -0
- data/lib/metasploit/model/error.rb +7 -0
- data/lib/metasploit/model/file.rb +49 -0
- data/lib/metasploit/model/invalid.rb +17 -0
- data/lib/metasploit/model/module.rb +8 -0
- data/lib/metasploit/model/module/action.rb +58 -0
- data/lib/metasploit/model/module/ancestor.rb +494 -0
- data/lib/metasploit/model/module/architecture.rb +40 -0
- data/lib/metasploit/model/module/author.rb +47 -0
- data/lib/metasploit/model/module/class.rb +406 -0
- data/lib/metasploit/model/module/handler.rb +35 -0
- data/lib/metasploit/model/module/instance.rb +626 -0
- data/lib/metasploit/model/module/path.rb +165 -0
- data/lib/metasploit/model/module/platform.rb +38 -0
- data/lib/metasploit/model/module/rank.rb +91 -0
- data/lib/metasploit/model/module/reference.rb +38 -0
- data/lib/metasploit/model/module/stance.rb +22 -0
- data/lib/metasploit/model/module/target.rb +80 -0
- data/lib/metasploit/model/module/target/architecture.rb +42 -0
- data/lib/metasploit/model/module/target/platform.rb +42 -0
- data/lib/metasploit/model/module/type.rb +44 -0
- data/lib/metasploit/model/nilify_blanks.rb +53 -0
- data/lib/metasploit/model/platform.rb +250 -0
- data/lib/metasploit/model/real_pathname.rb +18 -0
- data/lib/metasploit/model/reference.rb +108 -0
- data/lib/metasploit/model/search.rb +63 -0
- data/lib/metasploit/model/search/association.rb +32 -0
- data/lib/metasploit/model/search/attribute.rb +51 -0
- data/lib/metasploit/model/search/operation.rb +31 -0
- data/lib/metasploit/model/search/operation/integer/value.rb +33 -0
- data/lib/metasploit/model/search/operation/string/value.rb +14 -0
- data/lib/metasploit/model/search/operator.rb +10 -0
- data/lib/metasploit/model/search/operator/help.rb +47 -0
- data/lib/metasploit/model/search/with.rb +40 -0
- data/lib/metasploit/model/spec.rb +140 -0
- data/lib/metasploit/model/spec/error.rb +9 -0
- data/lib/metasploit/model/spec/i18n_exception_handler.rb +19 -0
- data/lib/metasploit/model/spec/pathname_collision.rb +28 -0
- data/lib/metasploit/model/spec/template/write.rb +42 -0
- data/lib/metasploit/model/spec/temporary_pathname.rb +59 -0
- data/lib/metasploit/model/translation.rb +31 -0
- data/lib/metasploit/model/version.rb +33 -0
- data/lib/metasploit/model/visitation.rb +9 -0
- data/lib/metasploit/model/visitation/visit.rb +103 -0
- data/lib/tasks/yard.rake +30 -0
- data/metasploit-model.gemspec +39 -0
- data/script/rails +9 -0
- data/spec/app/models/metasploit/model/association/reflection_spec.rb +48 -0
- data/spec/app/models/metasploit/model/module/ancestor/spec/template_spec.rb +174 -0
- data/spec/app/models/metasploit/model/module/class/spec/template_spec.rb +222 -0
- data/spec/app/models/metasploit/model/module/instance/spec/template_spec.rb +201 -0
- data/spec/app/models/metasploit/model/search/group/base_spec.rb +5 -0
- data/spec/app/models/metasploit/model/search/group/intersection_spec.rb +5 -0
- data/spec/app/models/metasploit/model/search/group/union_spec.rb +5 -0
- data/spec/app/models/metasploit/model/search/operation/base_spec.rb +70 -0
- data/spec/app/models/metasploit/model/search/operation/boolean_spec.rb +56 -0
- data/spec/app/models/metasploit/model/search/operation/date_spec.rb +89 -0
- data/spec/app/models/metasploit/model/search/operation/integer_spec.rb +9 -0
- data/spec/app/models/metasploit/model/search/operation/null_spec.rb +64 -0
- data/spec/app/models/metasploit/model/search/operation/set/integer_spec.rb +7 -0
- data/spec/app/models/metasploit/model/search/operation/set/string_spec.rb +7 -0
- data/spec/app/models/metasploit/model/search/operation/set_spec.rb +126 -0
- data/spec/app/models/metasploit/model/search/operation/string_spec.rb +9 -0
- data/spec/app/models/metasploit/model/search/operation/union_spec.rb +124 -0
- data/spec/app/models/metasploit/model/search/operator/association_spec.rb +108 -0
- data/spec/app/models/metasploit/model/search/operator/attribute_spec.rb +104 -0
- data/spec/app/models/metasploit/model/search/operator/base_spec.rb +34 -0
- data/spec/app/models/metasploit/model/search/operator/delegation_spec.rb +108 -0
- data/spec/app/models/metasploit/model/search/operator/deprecated/app_spec.rb +62 -0
- data/spec/app/models/metasploit/model/search/operator/deprecated/author_spec.rb +161 -0
- data/spec/app/models/metasploit/model/search/operator/deprecated/authority_spec.rb +123 -0
- data/spec/app/models/metasploit/model/search/operator/deprecated/platform_spec.rb +112 -0
- data/spec/app/models/metasploit/model/search/operator/deprecated/ref_spec.rb +327 -0
- data/spec/app/models/metasploit/model/search/operator/deprecated/text_spec.rb +357 -0
- data/spec/app/models/metasploit/model/search/operator/null_spec.rb +41 -0
- data/spec/app/models/metasploit/model/search/operator/single_spec.rb +327 -0
- data/spec/app/models/metasploit/model/search/operator/union_spec.rb +92 -0
- data/spec/app/models/metasploit/model/search/query_spec.rb +742 -0
- data/spec/app/models/metasploit/model/spec/template_spec.rb +23 -0
- data/spec/app/models/metasploit/model/visitation/visitor_spec.rb +45 -0
- data/spec/app/validators/derivation_validator_spec.rb +92 -0
- data/spec/app/validators/dynamic_length_validator_spec.rb +293 -0
- data/spec/app/validators/ip_format_validator_spec.rb +124 -0
- data/spec/app/validators/nil_validator_spec.rb +69 -0
- data/spec/app/validators/parameters_validator_spec.rb +342 -0
- data/spec/app/validators/password_is_strong_validator_spec.rb +250 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/dummy/architecture.rb +92 -0
- data/spec/dummy/app/models/dummy/author.rb +15 -0
- data/spec/dummy/app/models/dummy/authority.rb +130 -0
- data/spec/dummy/app/models/dummy/email_address.rb +27 -0
- data/spec/dummy/app/models/dummy/module/action.rb +25 -0
- data/spec/dummy/app/models/dummy/module/ancestor.rb +67 -0
- data/spec/dummy/app/models/dummy/module/architecture.rb +19 -0
- data/spec/dummy/app/models/dummy/module/author.rb +28 -0
- data/spec/dummy/app/models/dummy/module/class.rb +69 -0
- data/spec/dummy/app/models/dummy/module/instance.rb +209 -0
- data/spec/dummy/app/models/dummy/module/path.rb +64 -0
- data/spec/dummy/app/models/dummy/module/platform.rb +19 -0
- data/spec/dummy/app/models/dummy/module/rank.rb +44 -0
- data/spec/dummy/app/models/dummy/module/reference.rb +19 -0
- data/spec/dummy/app/models/dummy/module/target.rb +62 -0
- data/spec/dummy/app/models/dummy/module/target/architecture.rb +19 -0
- data/spec/dummy/app/models/dummy/module/target/platform.rb +19 -0
- data/spec/dummy/app/models/dummy/platform.rb +58 -0
- data/spec/dummy/app/models/dummy/reference.rb +31 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +43 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +27 -0
- data/spec/dummy/config/environments/production.rb +63 -0
- data/spec/dummy/config/environments/test.rb +29 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +9 -0
- data/spec/dummy/config/locales/en.yml +1 -0
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/dummy/db/schema.rb +707 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/spec/factories/dummy/architectures.rb +13 -0
- data/spec/dummy/spec/factories/dummy/authorities.rb +32 -0
- data/spec/dummy/spec/factories/dummy/authors.rb +8 -0
- data/spec/dummy/spec/factories/dummy/email_addresses.rb +8 -0
- data/spec/dummy/spec/factories/dummy/module/actions.rb +13 -0
- data/spec/dummy/spec/factories/dummy/module/ancestors.rb +45 -0
- data/spec/dummy/spec/factories/dummy/module/architectures.rb +35 -0
- data/spec/dummy/spec/factories/dummy/module/authors.rb +10 -0
- data/spec/dummy/spec/factories/dummy/module/classes.rb +40 -0
- data/spec/dummy/spec/factories/dummy/module/instances.rb +86 -0
- data/spec/dummy/spec/factories/dummy/module/paths.rb +16 -0
- data/spec/dummy/spec/factories/dummy/module/platforms.rb +35 -0
- data/spec/dummy/spec/factories/dummy/module/ranks.rb +14 -0
- data/spec/dummy/spec/factories/dummy/module/references.rb +17 -0
- data/spec/dummy/spec/factories/dummy/module/target/architectures.rb +40 -0
- data/spec/dummy/spec/factories/dummy/module/target/platforms.rb +41 -0
- data/spec/dummy/spec/factories/dummy/module/targets.rb +46 -0
- data/spec/dummy/spec/factories/dummy/platforms.rb +3 -0
- data/spec/dummy/spec/factories/dummy/references.rb +26 -0
- data/spec/factories/metasploit/model/architectures.rb +6 -0
- data/spec/factories/metasploit/model/association/reflections.rb +9 -0
- data/spec/factories/metasploit/model/authorities.rb +28 -0
- data/spec/factories/metasploit/model/authors.rb +9 -0
- data/spec/factories/metasploit/model/bases.rb +10 -0
- data/spec/factories/metasploit/model/email_addresses.rb +14 -0
- data/spec/factories/metasploit/model/module/actions.rb +9 -0
- data/spec/factories/metasploit/model/module/ancestors.rb +180 -0
- data/spec/factories/metasploit/model/module/architectures.rb +15 -0
- data/spec/factories/metasploit/model/module/classes.rb +47 -0
- data/spec/factories/metasploit/model/module/handlers.rb +3 -0
- data/spec/factories/metasploit/model/module/instances.rb +83 -0
- data/spec/factories/metasploit/model/module/paths.rb +51 -0
- data/spec/factories/metasploit/model/module/platforms.rb +15 -0
- data/spec/factories/metasploit/model/module/ranks.rb +9 -0
- data/spec/factories/metasploit/model/module/references.rb +11 -0
- data/spec/factories/metasploit/model/module/stances.rb +3 -0
- data/spec/factories/metasploit/model/module/targets.rb +22 -0
- data/spec/factories/metasploit/model/module/types.rb +5 -0
- data/spec/factories/metasploit/model/references.rb +88 -0
- data/spec/factories/metasploit/model/search/operator/associations.rb +5 -0
- data/spec/factories/metasploit/model/search/operator/attributes.rb +7 -0
- data/spec/factories/metasploit/model/search/operator/bases.rb +5 -0
- data/spec/lib/metasploit/model/architecture_spec.rb +52 -0
- data/spec/lib/metasploit/model/association/error_spec.rb +48 -0
- data/spec/lib/metasploit/model/association_spec.rb +145 -0
- data/spec/lib/metasploit/model/author_spec.rb +6 -0
- data/spec/lib/metasploit/model/authority/bid_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/cve_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/msb_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/osvdb_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/pmasa_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/secunia_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/us_cert_vu_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/waraxe_spec.rb +51 -0
- data/spec/lib/metasploit/model/authority/zdi_spec.rb +21 -0
- data/spec/lib/metasploit/model/authority_spec.rb +10 -0
- data/spec/lib/metasploit/model/base_spec.rb +58 -0
- data/spec/lib/metasploit/model/configuration/autoload_spec.rb +165 -0
- data/spec/lib/metasploit/model/configuration/child_spec.rb +24 -0
- data/spec/lib/metasploit/model/configuration/error_spec.rb +5 -0
- data/spec/lib/metasploit/model/configuration/i18n_spec.rb +103 -0
- data/spec/lib/metasploit/model/configuration_spec.rb +106 -0
- data/spec/lib/metasploit/model/configured_spec.rb +41 -0
- data/spec/lib/metasploit/model/derivation/full_name_spec.rb +75 -0
- data/spec/lib/metasploit/model/derivation_spec.rb +217 -0
- data/spec/lib/metasploit/model/email_address_spec.rb +19 -0
- data/spec/lib/metasploit/model/engine_spec.rb +84 -0
- data/spec/lib/metasploit/model/file_spec.rb +43 -0
- data/spec/lib/metasploit/model/invalid_spec.rb +54 -0
- data/spec/lib/metasploit/model/module/action_spec.rb +6 -0
- data/spec/lib/metasploit/model/module/ancestor_spec.rb +6 -0
- data/spec/lib/metasploit/model/module/architecture_spec.rb +9 -0
- data/spec/lib/metasploit/model/module/author_spec.rb +6 -0
- data/spec/lib/metasploit/model/module/class_spec.rb +19 -0
- data/spec/lib/metasploit/model/module/handler_spec.rb +61 -0
- data/spec/lib/metasploit/model/module/instance_spec.rb +183 -0
- data/spec/lib/metasploit/model/module/path_spec.rb +6 -0
- data/spec/lib/metasploit/model/module/platform_spec.rb +9 -0
- data/spec/lib/metasploit/model/module/rank_spec.rb +29 -0
- data/spec/lib/metasploit/model/module/reference_spec.rb +9 -0
- data/spec/lib/metasploit/model/module/stance_spec.rb +30 -0
- data/spec/lib/metasploit/model/module/target/architecture_spec.rb +9 -0
- data/spec/lib/metasploit/model/module/target/platform_spec.rb +9 -0
- data/spec/lib/metasploit/model/module/target_spec.rb +9 -0
- data/spec/lib/metasploit/model/module/type_spec.rb +125 -0
- data/spec/lib/metasploit/model/nilify_blanks_spec.rb +156 -0
- data/spec/lib/metasploit/model/platform_spec.rb +100 -0
- data/spec/lib/metasploit/model/reference_spec.rb +21 -0
- data/spec/lib/metasploit/model/search/association_spec.rb +33 -0
- data/spec/lib/metasploit/model/search/attribute_spec.rb +99 -0
- data/spec/lib/metasploit/model/search/operation/integer/value_spec.rb +20 -0
- data/spec/lib/metasploit/model/search/operation/string/value_spec.rb +20 -0
- data/spec/lib/metasploit/model/search/operation_spec.rb +144 -0
- data/spec/lib/metasploit/model/search/operator/help_spec.rb +41 -0
- data/spec/lib/metasploit/model/search/with_spec.rb +81 -0
- data/spec/lib/metasploit/model/search_spec.rb +230 -0
- data/spec/lib/metasploit/model/spec/error_spec.rb +5 -0
- data/spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb +42 -0
- data/spec/lib/metasploit/model/spec/pathname_collision_spec.rb +55 -0
- data/spec/lib/metasploit/model/spec_spec.rb +114 -0
- data/spec/lib/metasploit/model/translation_spec.rb +82 -0
- data/spec/lib/metasploit/model/version_spec.rb +141 -0
- data/spec/lib/metasploit/model/visitation/visit_spec.rb +316 -0
- data/spec/lib/metasploit/model_spec.rb +68 -0
- data/spec/spec_helper.rb +48 -0
- data/spec/support/shared/contexts/metasploit/model/configuration.rb +11 -0
- data/spec/support/shared/contexts/metasploit/model/module/ancestor/contents/metasploit_module.rb +12 -0
- data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents.rb +10 -0
- data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents/metasploit_module.rb +15 -0
- data/spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb +13 -0
- data/spec/support/shared/examples/derives.rb +115 -0
- data/spec/support/shared/examples/metasploit/model/architecture.rb +425 -0
- data/spec/support/shared/examples/metasploit/model/architecture/seed.rb +25 -0
- data/spec/support/shared/examples/metasploit/model/author.rb +27 -0
- data/spec/support/shared/examples/metasploit/model/authority.rb +124 -0
- data/spec/support/shared/examples/metasploit/model/authority/seed.rb +49 -0
- data/spec/support/shared/examples/metasploit/model/configuration/parent/child.rb +60 -0
- data/spec/support/shared/examples/metasploit/model/email_address.rb +220 -0
- data/spec/support/shared/examples/metasploit/model/module/action.rb +26 -0
- data/spec/support/shared/examples/metasploit/model/module/ancestor.rb +2004 -0
- data/spec/support/shared/examples/metasploit/model/module/ancestor/payload_factory.rb +63 -0
- data/spec/support/shared/examples/metasploit/model/module/architecture.rb +36 -0
- data/spec/support/shared/examples/metasploit/model/module/author.rb +29 -0
- data/spec/support/shared/examples/metasploit/model/module/class.rb +1514 -0
- data/spec/support/shared/examples/metasploit/model/module/handler.rb +21 -0
- data/spec/support/shared/examples/metasploit/model/module/instance.rb +1384 -0
- data/spec/support/shared/examples/metasploit/model/module/instance/class_methods.rb +537 -0
- data/spec/support/shared/examples/metasploit/model/module/instance/is_not_stanced_with_module_type.rb +22 -0
- data/spec/support/shared/examples/metasploit/model/module/instance/is_stanced_with_module_type.rb +38 -0
- data/spec/support/shared/examples/metasploit/model/module/instance/validates/dynamic_length_of.rb +131 -0
- data/spec/support/shared/examples/metasploit/model/module/path.rb +493 -0
- data/spec/support/shared/examples/metasploit/model/module/platform.rb +36 -0
- data/spec/support/shared/examples/metasploit/model/module/rank.rb +92 -0
- data/spec/support/shared/examples/metasploit/model/module/reference.rb +16 -0
- data/spec/support/shared/examples/metasploit/model/module/target.rb +29 -0
- data/spec/support/shared/examples/metasploit/model/module/target/architecture.rb +56 -0
- data/spec/support/shared/examples/metasploit/model/module/target/platform.rb +56 -0
- data/spec/support/shared/examples/metasploit/model/platform.rb +213 -0
- data/spec/support/shared/examples/metasploit/model/real_pathname.rb +29 -0
- data/spec/support/shared/examples/metasploit/model/reference.rb +410 -0
- data/spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb +79 -0
- data/spec/support/shared/examples/metasploit/model/search/operation/string/value.rb +53 -0
- data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +134 -0
- data/spec/support/shared/examples/metasploit/model/translation.rb +37 -0
- data/spec/support/shared/examples/search/query.rb +43 -0
- data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/app.rb +44 -0
- data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb +60 -0
- data/spec/support/shared/examples/search_association.rb +13 -0
- data/spec/support/shared/examples/search_attribute.rb +27 -0
- data/spec/support/shared/examples/search_with.rb +36 -0
- data/spec/support/shared/matchers/allow_attribute.rb +17 -0
- data/spec/support/templates/metasploit/model/module/ancestors/_attributes.rb.erb +9 -0
- data/spec/support/templates/metasploit/model/module/ancestors/_methods.rb.erb +8 -0
- data/spec/support/templates/metasploit/model/module/ancestors/_validations.rb.erb +6 -0
- data/spec/support/templates/metasploit/model/module/ancestors/base.rb.erb +3 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_auxiliary.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_encoder.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_exploit.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_non_payload.rb.erb +5 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_nop.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_payload.rb.erb +4 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_post.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_handled.rb.erb +20 -0
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_single.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stage.rb.erb +0 -0
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stager.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/classes/_methods.rb.erb +9 -0
- metadata +748 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
module Metasploit
|
2
|
+
module Model
|
3
|
+
# DSL to define associations and attributes that can be searched. Making an association searchable, will expose
|
4
|
+
# the attributes that association's class defined as searchable.
|
5
|
+
module Search
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
include Metasploit::Model::Search::Association
|
9
|
+
include Metasploit::Model::Search::Attribute
|
10
|
+
include Metasploit::Model::Search::With
|
11
|
+
|
12
|
+
# Allows operators registered with {Metasploit::Model::Search::Association::ClassMethods#search_association} and
|
13
|
+
# {Metasploit::Model::Search::Attribute::ClassMethods#search_attribute} to be looked up by name.
|
14
|
+
module ClassMethods
|
15
|
+
# Collects all search attributes from search associations and all attributes from this class to show the valid
|
16
|
+
# search operators to search.
|
17
|
+
#
|
18
|
+
# @return [Hash{Symbol => Metasploit::Model::Search::Operator}] Maps
|
19
|
+
# {Metasploit::Model::Search::Operator::Base#name} to {Metasploit::Model::Search::Operator::Base#name}.
|
20
|
+
def search_operator_by_name
|
21
|
+
unless instance_variable_defined? :@search_operator_by_name
|
22
|
+
@search_operator_by_name = {}
|
23
|
+
|
24
|
+
search_with_operator_by_name.each_value do |operator|
|
25
|
+
@search_operator_by_name[operator.name] = operator
|
26
|
+
end
|
27
|
+
|
28
|
+
search_association_set.each do |association|
|
29
|
+
begin
|
30
|
+
reflection = reflect_on_association(association)
|
31
|
+
rescue NameError
|
32
|
+
raise NameError,
|
33
|
+
"#{self} does not respond to reflect_on_association. " \
|
34
|
+
"It can be added to ActiveModels by including Metasploit::Model::Association into the class."
|
35
|
+
end
|
36
|
+
|
37
|
+
unless reflection
|
38
|
+
raise Metasploit::Model::Association::Error.new(:model => self, :name => association)
|
39
|
+
end
|
40
|
+
|
41
|
+
association_class = reflection.klass
|
42
|
+
|
43
|
+
# don't use search_operator_by_name as association operators on operators won't work
|
44
|
+
association_class.search_with_operator_by_name.each_value do |with_operator|
|
45
|
+
# non-attribute operators on association are assumed not to work
|
46
|
+
if with_operator.respond_to? :attribute
|
47
|
+
association_operator = Metasploit::Model::Search::Operator::Association.new(
|
48
|
+
:association => association,
|
49
|
+
:attribute_operator => with_operator,
|
50
|
+
:klass => self
|
51
|
+
)
|
52
|
+
@search_operator_by_name[association_operator.name] = association_operator
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
@search_operator_by_name
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Metasploit
|
2
|
+
module Model
|
3
|
+
module Search
|
4
|
+
# Registers associations that can be searched.
|
5
|
+
module Association
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
# Adds {#search_association} DSL to make {Metasploit::Model::Search::Operator::Association association search
|
9
|
+
# operators}.
|
10
|
+
module ClassMethods
|
11
|
+
# Registers association for search.
|
12
|
+
#
|
13
|
+
# @param association [#to_sym] name of association to search.
|
14
|
+
# @return [void]
|
15
|
+
def search_association(association)
|
16
|
+
search_association_set.add(association.to_sym)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Set of all associations that are searchable.
|
20
|
+
#
|
21
|
+
# @example Adding association to search
|
22
|
+
# search_association :things
|
23
|
+
#
|
24
|
+
# @return [Set<Symbol>]
|
25
|
+
def search_association_set
|
26
|
+
@search_association_set ||= Set.new
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Metasploit
|
2
|
+
module Model
|
3
|
+
module Search
|
4
|
+
# Registers attributes that can be searched.
|
5
|
+
module Attribute
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
include Metasploit::Model::Search::With
|
9
|
+
|
10
|
+
# Adds {#search_attribute} DSL to make {Metasploit::Model::Search::Operator::Attribute attribute search
|
11
|
+
# operators}.
|
12
|
+
module ClassMethods
|
13
|
+
# Registers attribute for search. Help for the operator supports i18n.
|
14
|
+
#
|
15
|
+
# @example defining help
|
16
|
+
# # lib/metasploit/model/module/instance.rb
|
17
|
+
# module Metasploit::Model::Module::Instance
|
18
|
+
# include Metasploit::Model::Search
|
19
|
+
#
|
20
|
+
# included do
|
21
|
+
# search_attribute :description, :type => :string
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# # config/locales/en.yml
|
26
|
+
# en:
|
27
|
+
# metasploit:
|
28
|
+
# model:
|
29
|
+
# module:
|
30
|
+
# instance:
|
31
|
+
# search_attribute:
|
32
|
+
# description:
|
33
|
+
# help: "A long, paragraph description of what the module does."
|
34
|
+
#
|
35
|
+
# @param attribute [#to_sym] name of attribute to search.
|
36
|
+
# @param options [Hash{Symbol => String}]
|
37
|
+
# @option options [Symbol] :type The type of the attribute. Used to determine how to parse the search values
|
38
|
+
# and which modifiers are supported.
|
39
|
+
# @return (see Metasploit::Model::Search::With::ClassMethods#search_with)
|
40
|
+
# @raise [Metasploit::Model::Invalid] unless attribute is present
|
41
|
+
# @raise [Metasploit::Model::Invalid] unless :type is present
|
42
|
+
def search_attribute(attribute, options={})
|
43
|
+
search_with Metasploit::Model::Search::Operator::Attribute,
|
44
|
+
:attribute => attribute,
|
45
|
+
:type => options[:type]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Metasploit
|
2
|
+
module Model
|
3
|
+
module Search
|
4
|
+
# Namespace for search operations. {parse} acts as a factory to parse a `String` and return a type-specific
|
5
|
+
# operation.
|
6
|
+
module Operation
|
7
|
+
# @param options [Hash{Symbol => Object}]
|
8
|
+
# @option options [Metasploit::Module::Search::Query] :query The query that the parsed operation is a part.
|
9
|
+
# @option options [String] :formatted_operation A '<operator>:<value>' string.
|
10
|
+
# @return [Metasploit::Model::Search::Operation::Base, Array<Metasploit::Model::Search::Operation::Base>]
|
11
|
+
# operation(s) parsed from the formatted operation.
|
12
|
+
# @raise [KeyError] unless :formatted_operation is given.
|
13
|
+
# @raise [KeyError] unless :query is given.
|
14
|
+
def self.parse(options={})
|
15
|
+
formatted_operation = options.fetch(:formatted_operation)
|
16
|
+
query = options.fetch(:query)
|
17
|
+
|
18
|
+
formatted_operator, formatted_value = formatted_operation.split(':', 2)
|
19
|
+
operator = query.parse_operator(formatted_operator)
|
20
|
+
|
21
|
+
# formatted_value will be nil if formatted_operation did not contain a ':', it should be treated the same
|
22
|
+
# as nothing after the ':'.
|
23
|
+
formatted_value ||= ''
|
24
|
+
operation_or_operations = operator.operate_on(formatted_value)
|
25
|
+
|
26
|
+
operation_or_operations
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Concerns type casting of a raw value to an `Integer`.
|
2
|
+
module Metasploit::Model::Search::Operation::Integer::Value
|
3
|
+
#
|
4
|
+
# Attributes
|
5
|
+
#
|
6
|
+
|
7
|
+
# @!attribute [r] value_before_type_cast
|
8
|
+
# The formatted version of {#value} before it was type cast when calling {#value=}.
|
9
|
+
#
|
10
|
+
# @return [Object]
|
11
|
+
attr_reader :value_before_type_cast
|
12
|
+
|
13
|
+
#
|
14
|
+
# Methods
|
15
|
+
#
|
16
|
+
|
17
|
+
# Sets {Metasploit::Model::Search::Operation::Base#value} by type casting String to Integer.
|
18
|
+
#
|
19
|
+
# @param formatted_value [#to_s]
|
20
|
+
# @return [Integer] if `formatted_value` contains only an Integer#to_s
|
21
|
+
# @return [#to_s] `formatted_value` if it does not contain an Integer#to_s
|
22
|
+
def value=(formatted_value)
|
23
|
+
@value_before_type_cast = formatted_value
|
24
|
+
|
25
|
+
begin
|
26
|
+
# use Integer() instead of String#to_i as String#to_i will ignore trailing letters (i.e. '1two' -> 1) and turn all
|
27
|
+
# string without an integer in it to 0.
|
28
|
+
@value = Integer(formatted_value.to_s)
|
29
|
+
rescue ArgumentError
|
30
|
+
@value = formatted_value
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Concerns type casting of a raw value to a `String`.
|
2
|
+
module Metasploit::Model::Search::Operation::String::Value
|
3
|
+
#
|
4
|
+
# Methods
|
5
|
+
#
|
6
|
+
|
7
|
+
# Sets {Metasploit::Model::Search::Operation::Base#value} by type casting to a String.
|
8
|
+
#
|
9
|
+
# @param formatted_value [#to_s]
|
10
|
+
# @return [String]
|
11
|
+
def value=(formatted_value)
|
12
|
+
@value = formatted_value.to_s
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Metasploit
|
2
|
+
module Model
|
3
|
+
module Search
|
4
|
+
module Operator
|
5
|
+
# Methods to lookup help text for an operator with a given `#name` registered to a given `#klass`.
|
6
|
+
module Help
|
7
|
+
# @note This uses I18n.translate along with {Metasploit::Model::Translation#search_i18n_scope},
|
8
|
+
# the value is not cached to support changing the I18n.locale and getting the correct help message for that
|
9
|
+
# locale.
|
10
|
+
#
|
11
|
+
# The help for this operator.
|
12
|
+
#
|
13
|
+
# @see https://github.com/rails/rails/blob/6c2810b8ed692004dca43e554982cdfdb8517b80/activemodel/lib/active_model/errors.rb#L408-L435
|
14
|
+
def help
|
15
|
+
defaults = []
|
16
|
+
klass_i18n_scope = klass.i18n_scope
|
17
|
+
|
18
|
+
klass.lookup_ancestors.each do |ancestor|
|
19
|
+
# a specific operator for a given Class#ancestors member
|
20
|
+
defaults << :"#{klass_i18n_scope}.ancestors.#{ancestor.model_name.i18n_key}.search.operator.names.#{name}.help"
|
21
|
+
end
|
22
|
+
|
23
|
+
operator_class = self.class
|
24
|
+
operator_i18n_scope = operator_class.i18n_scope
|
25
|
+
|
26
|
+
operator_class.lookup_ancestors.each do |ancestor|
|
27
|
+
# a specific name for a given operator
|
28
|
+
defaults << :"#{operator_i18n_scope}.search.operator.ancestors.#{ancestor.model_name.i18n_key}.names.#{name}.help"
|
29
|
+
# a specific operator class
|
30
|
+
defaults << :"#{operator_i18n_scope}.search.operator.ancestors.#{ancestor.model_name.i18n_key}.help"
|
31
|
+
end
|
32
|
+
|
33
|
+
# use first default as key because it is most specific default, that is closest to klass.
|
34
|
+
key = defaults.shift
|
35
|
+
options = {
|
36
|
+
default: defaults,
|
37
|
+
model: klass.model_name.human,
|
38
|
+
name: name
|
39
|
+
}
|
40
|
+
|
41
|
+
::I18n.translate(key, options)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Metasploit
|
2
|
+
module Model
|
3
|
+
module Search
|
4
|
+
# Generalizes operators from attributes to anything directly registered as an operator on a class.
|
5
|
+
module With
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
# Defines `search_with` DSL, which is a lower-level way than search_attribute to add operators. `search_with`
|
9
|
+
# allows instance of arbitrary operator_classes to be registered in {#search_with_operator_by_name}.
|
10
|
+
module ClassMethods
|
11
|
+
# Declares that this class should be search with an instance of the given `operator_class`.
|
12
|
+
#
|
13
|
+
# @param operator_class [Class<Metasploit::Model::Search::Operator::Base>] a class to initialize.
|
14
|
+
# @param options [Hash] Options passed to `operator_class.new` along with `{:klass => self}`, so that the
|
15
|
+
# `operator_class` instance knows it was registered as search this class.
|
16
|
+
# @return [Metasploit::Model::Search::Operator::Base]
|
17
|
+
# @raise (see Metasploit::Model::Base#invalid!)
|
18
|
+
def search_with(operator_class, options={})
|
19
|
+
merged_operations = options.merge(
|
20
|
+
:klass => self
|
21
|
+
)
|
22
|
+
operator = operator_class.new(merged_operations)
|
23
|
+
operator.valid!
|
24
|
+
|
25
|
+
search_with_operator_by_name[operator.name] = operator
|
26
|
+
end
|
27
|
+
|
28
|
+
# Operators registered with {#search_with}.
|
29
|
+
#
|
30
|
+
# @return [Hash{Symbol => Metasploit::Model::Search::Operator::Base}] Maps
|
31
|
+
# {Metasploit::Model::Search::Operator::Base#name} keys to {Metasploit::Model::Search::Operator::Base#name}
|
32
|
+
# values.
|
33
|
+
def search_with_operator_by_name
|
34
|
+
@search_with_operator_by_name ||= {}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
require 'rspec/core/shared_example_group'
|
2
|
+
|
3
|
+
module Metasploit
|
4
|
+
module Model
|
5
|
+
# Helper methods for running specs for metasploit-model.
|
6
|
+
module Spec
|
7
|
+
extend Metasploit::Model::Spec::TemporaryPathname
|
8
|
+
# without this, Module.shared_examples_for will be used and RSpec will count shared_examples created with
|
9
|
+
# {shared_examples_for} to not be declared at the top-level.
|
10
|
+
extend RSpec::Core::SharedExampleGroup::TopLevelDSL
|
11
|
+
|
12
|
+
# Defines a shared examples for a `Module` under the {Metasploit::Model} namespace. This `Module` is assumed to
|
13
|
+
# be a mixin that can be mixed into an ActiveModel in metasploit-framework or an ActiveRecord in
|
14
|
+
# metasploit_data_models. Shared examples declared using this method get access to boiler plate methods used
|
15
|
+
# for all the {Metasploit::Model} mixin `Modules`:
|
16
|
+
#
|
17
|
+
# * <relative_variable_name>_class
|
18
|
+
# * <relative_variable_name>_factory
|
19
|
+
# * factory_namespace
|
20
|
+
# * relative_variable_name
|
21
|
+
# * #<relative_variable_name>_class
|
22
|
+
# * #<relative_variable_name>_factory
|
23
|
+
#
|
24
|
+
# @example boiler plate methods for Module::Ancestor
|
25
|
+
# # defined shared example's name will be 'Metasploit::Model::Module::Ancestor', but you only need to give the
|
26
|
+
# # name relative to 'Metasploit::Model'.
|
27
|
+
# Metasploit::Model::Spec.shared_examples_for 'Module::Ancestor' do
|
28
|
+
# module_ancestor_class # '<namespace_name>::Module::Ancestor'
|
29
|
+
# module_ancestor_factory # '<factory_namespace>_module_ancestor'
|
30
|
+
# factory_namespace # namespace_name converted to underscore with / replaced by _
|
31
|
+
# relative_variable_name # 'module_ancestor'
|
32
|
+
#
|
33
|
+
# let(:base_class) do # automatically defined for you
|
34
|
+
# module_ancestor_class # same as class method module_ancestor_class
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# context 'factories' do # have to define this yourself since not all mixins use factories.
|
38
|
+
# context module_ancestor_factory do # using class method
|
39
|
+
# subject(module_ancestor_factory) do # using class method
|
40
|
+
# FactoryGirl.build(module_ancestor_factory) # using instance method
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# @example Using shared example
|
47
|
+
# describe Metasploit::Model::Module::Ancestor do
|
48
|
+
# it_should_behave_like 'Metasploit::Model::Module::Ancestor',
|
49
|
+
# namespace_name: 'Dummy'
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# @param relative_name [String] name relative to 'Metasploit::Model' prefix. For example, to declare
|
53
|
+
# 'Metasploit::Model::Module::Ancestor' shared example, `relative_name` would be just 'Module::Ancestor'.
|
54
|
+
# @yield Body of shared examples.
|
55
|
+
# @yieldreturn [void]
|
56
|
+
# @return [void]
|
57
|
+
def self.shared_examples_for(relative_name, &block)
|
58
|
+
fully_qualified_name = "Metasploit::Model::#{relative_name}"
|
59
|
+
|
60
|
+
relative_variable_name = relative_name.underscore.gsub('/', '_')
|
61
|
+
class_method_name = "#{relative_variable_name}_class"
|
62
|
+
factory_method_name = "#{relative_variable_name}_factory"
|
63
|
+
|
64
|
+
# capture block to pass to super so that source_location can be overridden to be block's source_location so that
|
65
|
+
# errors are reported correctly from RSpec.
|
66
|
+
wrapper = ->(options={}) {
|
67
|
+
options.assert_valid_keys(:namespace_name)
|
68
|
+
namespace_name = options.fetch(:namespace_name)
|
69
|
+
|
70
|
+
class_name = "#{namespace_name}::#{relative_name}"
|
71
|
+
|
72
|
+
#
|
73
|
+
# Singleton methods to emulate local variable used to define examples and lets
|
74
|
+
#
|
75
|
+
|
76
|
+
define_singleton_method(class_method_name) do
|
77
|
+
class_name.constantize
|
78
|
+
end
|
79
|
+
|
80
|
+
define_singleton_method(factory_method_name) do
|
81
|
+
"#{factory_namespace}_#{relative_variable_name}"
|
82
|
+
end
|
83
|
+
|
84
|
+
define_singleton_method(:factory_namespace) do
|
85
|
+
namespace_name.underscore.gsub('/', '_')
|
86
|
+
end
|
87
|
+
|
88
|
+
define_singleton_method(:namespace_name) do
|
89
|
+
namespace_name
|
90
|
+
end
|
91
|
+
|
92
|
+
define_singleton_method(:relative_variable_name) do
|
93
|
+
relative_variable_name
|
94
|
+
end
|
95
|
+
|
96
|
+
#
|
97
|
+
# Defines to emulate local variable used inside lets
|
98
|
+
#
|
99
|
+
|
100
|
+
define_method(class_method_name) do
|
101
|
+
self.class.send(class_method_name)
|
102
|
+
end
|
103
|
+
|
104
|
+
define_method(factory_method_name) do
|
105
|
+
self.class.send(factory_method_name)
|
106
|
+
end
|
107
|
+
|
108
|
+
#
|
109
|
+
# Default subject uses factory
|
110
|
+
#
|
111
|
+
|
112
|
+
subject(relative_variable_name) do
|
113
|
+
FactoryGirl.build(send(factory_method_name))
|
114
|
+
end
|
115
|
+
|
116
|
+
#
|
117
|
+
# lets
|
118
|
+
#
|
119
|
+
|
120
|
+
let(:base_class) do
|
121
|
+
self.class.send(class_method_name)
|
122
|
+
end
|
123
|
+
|
124
|
+
it_should_behave_like 'Metasploit::Model::Translation',
|
125
|
+
metasploit_model_ancestor: fully_qualified_name.constantize
|
126
|
+
|
127
|
+
module_eval(&block)
|
128
|
+
}
|
129
|
+
|
130
|
+
# Delegate source_location so that RSpec will report block's source_location as the declaration location of
|
131
|
+
# the shared location instead of this method.
|
132
|
+
wrapper.define_singleton_method(:source_location) do
|
133
|
+
block.source_location
|
134
|
+
end
|
135
|
+
|
136
|
+
super(fully_qualified_name, &wrapper)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|