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,25 @@
|
|
1
|
+
shared_examples_for 'Metasploit::Model::Architecture seed' do |attributes={}|
|
2
|
+
attributes.assert_valid_keys(:abbreviation, :bits, :endianness, :family, :summary)
|
3
|
+
|
4
|
+
context_abbreviation = attributes.fetch(:abbreviation)
|
5
|
+
|
6
|
+
context "with #{context_abbreviation}" do
|
7
|
+
subject do
|
8
|
+
seed
|
9
|
+
end
|
10
|
+
|
11
|
+
# put in a let so that `let(:seed)` has access to abbreviation.
|
12
|
+
let(:abbreviation) do
|
13
|
+
context_abbreviation
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should exist' do
|
17
|
+
seed.should_not be_nil
|
18
|
+
end
|
19
|
+
|
20
|
+
its(:bits) { should == attributes.fetch(:bits) }
|
21
|
+
its(:endianness) { should == attributes.fetch(:endianness) }
|
22
|
+
its(:family) { should == attributes.fetch(:family) }
|
23
|
+
its(:summary) { should == attributes.fetch(:summary) }
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Metasploit::Model::Spec.shared_examples_for 'Author' do
|
2
|
+
context 'factories' do
|
3
|
+
context author_factory do
|
4
|
+
subject(author_factory) do
|
5
|
+
FactoryGirl.build(author_factory)
|
6
|
+
end
|
7
|
+
|
8
|
+
it { should be_valid }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'mass assignment security' do
|
13
|
+
it { should allow_mass_assignment_of(:name) }
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'search' do
|
17
|
+
context 'attributes' do
|
18
|
+
it_should_behave_like 'search_attribute', :name, :type => :string
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'validations' do
|
23
|
+
context 'name' do
|
24
|
+
it { should validate_presence_of :name }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
Metasploit::Model::Spec.shared_examples_for 'Authority' do
|
2
|
+
full_authority_factory = "full_#{authority_factory}"
|
3
|
+
obsolete_authority_factory = "obsolete_#{authority_factory}"
|
4
|
+
|
5
|
+
context 'factories' do
|
6
|
+
context authority_factory do
|
7
|
+
subject(authority_factory) do
|
8
|
+
FactoryGirl.build(authority_factory)
|
9
|
+
end
|
10
|
+
|
11
|
+
it { should be_valid }
|
12
|
+
end
|
13
|
+
|
14
|
+
context full_authority_factory do
|
15
|
+
subject(full_authority_factory) do
|
16
|
+
FactoryGirl.build(full_authority_factory)
|
17
|
+
end
|
18
|
+
|
19
|
+
it { should be_valid }
|
20
|
+
|
21
|
+
its(:summary) { should_not be_nil }
|
22
|
+
its(:url) { should_not be_nil }
|
23
|
+
end
|
24
|
+
|
25
|
+
context obsolete_authority_factory do
|
26
|
+
subject(obsolete_authority_factory) do
|
27
|
+
FactoryGirl.build(obsolete_authority_factory)
|
28
|
+
end
|
29
|
+
|
30
|
+
it { should be_valid }
|
31
|
+
|
32
|
+
its(:obsolete) { should be_true }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'mass assignment security' do
|
37
|
+
it { should allow_mass_assignment_of(:abbreviation) }
|
38
|
+
it { should allow_mass_assignment_of(:obsolete) }
|
39
|
+
it { should allow_mass_assignment_of(:summary) }
|
40
|
+
it { should allow_mass_assignment_of(:url) }
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'search' do
|
44
|
+
context 'attributes' do
|
45
|
+
it_should_behave_like 'search_attribute', :abbreviation, :type => :string
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'seeds' do
|
50
|
+
it_should_behave_like 'Metasploit::Model::Authority seed',
|
51
|
+
:abbreviation => 'BID',
|
52
|
+
:extension_name => 'Metasploit::Model::Authority::Bid',
|
53
|
+
:obsolete => false,
|
54
|
+
:summary => 'BuqTraq ID',
|
55
|
+
:url => 'http://www.securityfocus.com/bid'
|
56
|
+
|
57
|
+
it_should_behave_like 'Metasploit::Model::Authority seed',
|
58
|
+
:abbreviation => 'CVE',
|
59
|
+
:extension_name => 'Metasploit::Model::Authority::Cve',
|
60
|
+
:obsolete => false,
|
61
|
+
:summary => 'Common Vulnerabilities and Exposures',
|
62
|
+
:url => 'http://cvedetails.com'
|
63
|
+
|
64
|
+
it_should_behave_like 'Metasploit::Model::Authority seed',
|
65
|
+
:abbreviation => 'MIL',
|
66
|
+
:extension_name => nil,
|
67
|
+
:obsolete => true,
|
68
|
+
:summary => 'milw0rm',
|
69
|
+
:url => 'https://en.wikipedia.org/wiki/Milw0rm'
|
70
|
+
|
71
|
+
it_should_behave_like 'Metasploit::Model::Authority seed',
|
72
|
+
:abbreviation => 'MSB',
|
73
|
+
:extension_name => 'Metasploit::Model::Authority::Msb',
|
74
|
+
:obsolete => false,
|
75
|
+
:summary => 'Microsoft Security Bulletin',
|
76
|
+
:url => 'http://www.microsoft.com/technet/security/bulletin'
|
77
|
+
|
78
|
+
it_should_behave_like 'Metasploit::Model::Authority seed',
|
79
|
+
:abbreviation => 'OSVDB',
|
80
|
+
:extension_name => 'Metasploit::Model::Authority::Osvdb',
|
81
|
+
:obsolete => false,
|
82
|
+
:summary => 'Open Sourced Vulnerability Database',
|
83
|
+
:url => 'http://osvdb.org'
|
84
|
+
|
85
|
+
it_should_behave_like 'Metasploit::Model::Authority seed',
|
86
|
+
:abbreviation => 'PMASA',
|
87
|
+
:extension_name => 'Metasploit::Model::Authority::Pmasa',
|
88
|
+
:obsolete => false,
|
89
|
+
:summary => 'phpMyAdmin Security Announcement',
|
90
|
+
:url => 'http://www.phpmyadmin.net/home_page/security/'
|
91
|
+
|
92
|
+
it_should_behave_like 'Metasploit::Model::Authority seed',
|
93
|
+
:abbreviation => 'SECUNIA',
|
94
|
+
:extension_name => 'Metasploit::Model::Authority::Secunia',
|
95
|
+
:obsolete => false,
|
96
|
+
:summary => 'Secunia',
|
97
|
+
:url => 'https://secunia.com/advisories'
|
98
|
+
|
99
|
+
it_should_behave_like 'Metasploit::Model::Authority seed',
|
100
|
+
:abbreviation => 'US-CERT-VU',
|
101
|
+
:extension_name => 'Metasploit::Model::Authority::UsCertVu',
|
102
|
+
:obsolete => false,
|
103
|
+
:summary => 'United States Computer Emergency Readiness Team Vulnerability Notes Database',
|
104
|
+
:url => 'http://www.kb.cert.org/vuls'
|
105
|
+
|
106
|
+
it_should_behave_like 'Metasploit::Model::Authority seed',
|
107
|
+
:abbreviation => 'waraxe',
|
108
|
+
:extension_name => 'Metasploit::Model::Authority::Waraxe',
|
109
|
+
:obsolete => false,
|
110
|
+
:summary => 'Waraxe Advisories',
|
111
|
+
:url => 'http://www.waraxe.us/content-cat-1.html'
|
112
|
+
|
113
|
+
it_should_behave_like 'Metasploit::Model::Authority seed',
|
114
|
+
abbreviation: 'ZDI',
|
115
|
+
extension_name: 'Metasploit::Model::Authority::Zdi',
|
116
|
+
obsolete: false,
|
117
|
+
summary: 'Zero Day Initiative',
|
118
|
+
url: 'http://www.zerodayinitiative.com/advisories'
|
119
|
+
end
|
120
|
+
|
121
|
+
context 'validations' do
|
122
|
+
it { should validate_presence_of(:abbreviation) }
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
shared_examples_for 'Metasploit::Model::Authority seed' do |attributes={}|
|
2
|
+
attributes.assert_valid_keys(:abbreviation, :extension_name, :obsolete, :summary, :url)
|
3
|
+
|
4
|
+
abbreviation = attributes.fetch(:abbreviation)
|
5
|
+
|
6
|
+
context "with #{abbreviation}" do
|
7
|
+
subject(:seed) do
|
8
|
+
seed_with_abbreviation(abbreviation)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should exist' do
|
12
|
+
seed.should_not be_nil
|
13
|
+
end
|
14
|
+
|
15
|
+
its(:obsolete) { should == attributes.fetch(:obsolete) }
|
16
|
+
its(:summary) { should == attributes.fetch(:summary) }
|
17
|
+
its(:url) { should == attributes.fetch(:url) }
|
18
|
+
|
19
|
+
extension_name = attributes.fetch(:extension_name)
|
20
|
+
|
21
|
+
if extension_name
|
22
|
+
context 'with extension' do
|
23
|
+
let(:designation) do
|
24
|
+
double('Designation')
|
25
|
+
end
|
26
|
+
|
27
|
+
let(:extension) do
|
28
|
+
extension_name.constantize
|
29
|
+
end
|
30
|
+
|
31
|
+
its(:extension) { should == extension }
|
32
|
+
|
33
|
+
it 'should have extension be a defined class' do
|
34
|
+
expect {
|
35
|
+
extension
|
36
|
+
}.to_not raise_error
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should delegate #designation_url to extension' do
|
40
|
+
extension.should_receive(:designation_url).with(designation)
|
41
|
+
|
42
|
+
seed.designation_url(designation)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
else
|
46
|
+
its(:extension) { should be_nil }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
shared_examples_for 'Metasploit::Model::Configuration::Parent#child' do |name, options={}|
|
2
|
+
options.assert_valid_keys(:class)
|
3
|
+
|
4
|
+
klass = options.fetch(:class)
|
5
|
+
class_attribute_name = "#{name}_class"
|
6
|
+
|
7
|
+
context "##{name}" do
|
8
|
+
subject(:child) do
|
9
|
+
configuration.send(name)
|
10
|
+
end
|
11
|
+
|
12
|
+
context "with default ##{class_attribute_name}" do
|
13
|
+
it { should be_a klass }
|
14
|
+
end
|
15
|
+
|
16
|
+
context "without default ##{class_attribute_name}" do
|
17
|
+
#
|
18
|
+
# lets
|
19
|
+
#
|
20
|
+
|
21
|
+
let(:non_default_class) do
|
22
|
+
Class.new do
|
23
|
+
attr_accessor :configuration
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# Callbacks
|
29
|
+
#
|
30
|
+
|
31
|
+
before(:each) do
|
32
|
+
configuration.send("#{class_attribute_name}=", non_default_class)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "is instance of ##{class_attribute_name}" do
|
36
|
+
expect(child).to be_a non_default_class
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context '#configuration' do
|
41
|
+
subject(:child_configuration) do
|
42
|
+
child.configuration
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'is this configuration' do
|
46
|
+
expect(child_configuration).to eq(configuration)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context "#{class_attribute_name}" do
|
52
|
+
subject(:child_class) do
|
53
|
+
configuration.send(class_attribute_name)
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'default' do
|
57
|
+
it { should be klass }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,220 @@
|
|
1
|
+
Metasploit::Model::Spec.shared_examples_for 'EmailAddress' do
|
2
|
+
context 'derivations' do
|
3
|
+
context 'with #full derived' do
|
4
|
+
before(:each) do
|
5
|
+
email_address.full = email_address.derived_full
|
6
|
+
end
|
7
|
+
|
8
|
+
it_should_behave_like 'derives', :domain, :validates => true
|
9
|
+
it_should_behave_like 'derives', :local, :validates => true
|
10
|
+
end
|
11
|
+
|
12
|
+
it_should_behave_like 'derives', :full, :validates => true
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'factories' do
|
16
|
+
context email_address_factory do
|
17
|
+
subject(email_address_factory) do
|
18
|
+
FactoryGirl.build(email_address_factory)
|
19
|
+
end
|
20
|
+
|
21
|
+
it { should be_valid }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'mass assignment security' do
|
26
|
+
it { should allow_mass_assignment_of(:domain) }
|
27
|
+
it { should allow_mass_assignment_of(:full) }
|
28
|
+
it { should allow_mass_assignment_of(:local) }
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'search' do
|
32
|
+
context 'attributes' do
|
33
|
+
it_should_behave_like 'search_attribute', :domain, :type => :string
|
34
|
+
it_should_behave_like 'search_attribute', :full, :type => :string
|
35
|
+
it_should_behave_like 'search_attribute', :local, :type => :string
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'validations' do
|
40
|
+
it { should validate_presence_of :domain }
|
41
|
+
it { should validate_presence_of :local }
|
42
|
+
end
|
43
|
+
|
44
|
+
context '#derived_domain' do
|
45
|
+
subject(:derived_domain) do
|
46
|
+
email_address.derived_domain
|
47
|
+
end
|
48
|
+
|
49
|
+
before(:each) do
|
50
|
+
email_address.full = full
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'with #full' do
|
54
|
+
let(:domain) do
|
55
|
+
FactoryGirl.generate :metasploit_model_email_address_domain
|
56
|
+
end
|
57
|
+
|
58
|
+
let(:local) do
|
59
|
+
FactoryGirl.generate :metasploit_model_email_address_local
|
60
|
+
end
|
61
|
+
|
62
|
+
context "with '@'" do
|
63
|
+
let(:full) do
|
64
|
+
"#{local}@#{domain}"
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
context 'with local before @' do
|
69
|
+
it "should be portion after '@'" do
|
70
|
+
derived_domain.should == domain
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'without local before @' do
|
75
|
+
let(:local) do
|
76
|
+
''
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should be portion after '@'" do
|
80
|
+
derived_domain.should == domain
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context "without '@'" do
|
86
|
+
let(:full) do
|
87
|
+
local
|
88
|
+
end
|
89
|
+
|
90
|
+
it { should be_nil }
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
context 'without #full' do
|
95
|
+
let(:full) do
|
96
|
+
''
|
97
|
+
end
|
98
|
+
|
99
|
+
it { should be_nil }
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context '#derived_full' do
|
104
|
+
subject(:derived_full) do
|
105
|
+
email_address.derived_full
|
106
|
+
end
|
107
|
+
|
108
|
+
before(:each) do
|
109
|
+
email_address.domain = domain
|
110
|
+
email_address.local = local
|
111
|
+
end
|
112
|
+
|
113
|
+
context 'with domain' do
|
114
|
+
let(:domain) do
|
115
|
+
FactoryGirl.generate :metasploit_model_email_address_domain
|
116
|
+
end
|
117
|
+
|
118
|
+
context 'with #local' do
|
119
|
+
let(:local) do
|
120
|
+
FactoryGirl.generate :metasploit_model_email_address_local
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'should <local>@<domain>' do
|
124
|
+
derived_full.should == "#{local}@#{domain}"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
context 'without #local' do
|
129
|
+
let(:local) do
|
130
|
+
''
|
131
|
+
end
|
132
|
+
|
133
|
+
it { should be_nil }
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
context 'without #domain' do
|
138
|
+
let(:domain) do
|
139
|
+
''
|
140
|
+
end
|
141
|
+
|
142
|
+
context 'with #local' do
|
143
|
+
let(:local) do
|
144
|
+
FactoryGirl.generate :metasploit_model_email_address_local
|
145
|
+
end
|
146
|
+
|
147
|
+
it { should be_nil }
|
148
|
+
end
|
149
|
+
|
150
|
+
context 'without #local' do
|
151
|
+
let(:local) do
|
152
|
+
''
|
153
|
+
end
|
154
|
+
|
155
|
+
it { should be_nil }
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context '#derived_local' do
|
161
|
+
subject(:derived_local) do
|
162
|
+
email_address.derived_local
|
163
|
+
end
|
164
|
+
|
165
|
+
before(:each) do
|
166
|
+
email_address.full = full
|
167
|
+
end
|
168
|
+
|
169
|
+
context 'with #full' do
|
170
|
+
let(:domain) do
|
171
|
+
FactoryGirl.generate :metasploit_model_email_address_domain
|
172
|
+
end
|
173
|
+
|
174
|
+
let(:local) do
|
175
|
+
FactoryGirl.generate :metasploit_model_email_address_local
|
176
|
+
end
|
177
|
+
|
178
|
+
context "with '@'" do
|
179
|
+
let(:full) do
|
180
|
+
"#{local}@#{domain}"
|
181
|
+
end
|
182
|
+
|
183
|
+
|
184
|
+
context "with domain after '@'" do
|
185
|
+
it "should be portion before '@'" do
|
186
|
+
derived_local.should == local
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
context "without domain after '@'" do
|
191
|
+
let(:local) do
|
192
|
+
''
|
193
|
+
end
|
194
|
+
|
195
|
+
it "should be portion before '@'" do
|
196
|
+
derived_local.should == local
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
context "without '@'" do
|
202
|
+
let(:full) do
|
203
|
+
local
|
204
|
+
end
|
205
|
+
|
206
|
+
it 'should be entirety of #full' do
|
207
|
+
derived_local.should == full
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
context 'without #full' do
|
213
|
+
let(:full) do
|
214
|
+
''
|
215
|
+
end
|
216
|
+
|
217
|
+
it { should be_nil }
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|