metasploit-model 0.24.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -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 +31 -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 +747 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
# In-memory implementation of {Metasploit::Model::Module::Path} to allow testing of {Metasploit::Model::Module::Path} in
|
2
|
+
# an ActiveModel and use of factories.
|
3
|
+
class Dummy::Module::Path < Metasploit::Model::Base
|
4
|
+
include Metasploit::Model::Module::Path
|
5
|
+
|
6
|
+
#
|
7
|
+
# Attributes Methods - used to track changed attributes
|
8
|
+
#
|
9
|
+
|
10
|
+
define_attribute_method :gem
|
11
|
+
define_attribute_method :name
|
12
|
+
|
13
|
+
#
|
14
|
+
# Attributes
|
15
|
+
#
|
16
|
+
|
17
|
+
# @!attribute [rw] gem
|
18
|
+
# The gem that owns this path.
|
19
|
+
#
|
20
|
+
# @return [String, nil]
|
21
|
+
attr_accessor :gem
|
22
|
+
|
23
|
+
# @!attribute [rw] name
|
24
|
+
# The name of this path, scoped to {#gem}.
|
25
|
+
#
|
26
|
+
# @return [String, nil]
|
27
|
+
attr_accessor :name
|
28
|
+
|
29
|
+
# @!attribute [rw] real_path
|
30
|
+
# Real (absolute) path on-disk.
|
31
|
+
#
|
32
|
+
# @return [String]
|
33
|
+
attr_accessor :real_path
|
34
|
+
|
35
|
+
#
|
36
|
+
# Methods
|
37
|
+
#
|
38
|
+
|
39
|
+
# Updates {#gem} value and marks {#gem} as changed if `gem` differs from
|
40
|
+
# {#gem}.
|
41
|
+
#
|
42
|
+
# @param gem [String, nil] (see #gem)
|
43
|
+
# @return [String, nil] `gem`
|
44
|
+
def gem=(gem)
|
45
|
+
unless gem == @gem
|
46
|
+
gem_will_change!
|
47
|
+
end
|
48
|
+
|
49
|
+
@gem = gem
|
50
|
+
end
|
51
|
+
|
52
|
+
# Updates {#name} value and marks {#name} as changed if `name` differs
|
53
|
+
# from {#name}.
|
54
|
+
#
|
55
|
+
# @param name [String, nil] (see #name)
|
56
|
+
# @return [String, nil] `name`
|
57
|
+
def name=(name)
|
58
|
+
unless name == @name
|
59
|
+
name_will_change!
|
60
|
+
end
|
61
|
+
|
62
|
+
@name = name
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Dummy::Module::Platform < Metasploit::Model::Base
|
2
|
+
include Metasploit::Model::Module::Platform
|
3
|
+
|
4
|
+
#
|
5
|
+
# Associations
|
6
|
+
#
|
7
|
+
|
8
|
+
# @!attribute [rw] module_instance
|
9
|
+
# Module that supports {#platform}.
|
10
|
+
#
|
11
|
+
# @return [Dummy::Module::Instance]
|
12
|
+
attr_accessor :module_instance
|
13
|
+
|
14
|
+
# @!attribute [rw] platform
|
15
|
+
# Platform supported by {#module_instance}.
|
16
|
+
#
|
17
|
+
# @return [Dummy::Platform]
|
18
|
+
attr_accessor :platform
|
19
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Implementation of {Metasploit::Model::Module::Rank} to allow testing of {Metasploit::Model::Module::Rank}
|
2
|
+
# using an in-memory ActiveModel and use of factories.
|
3
|
+
class Dummy::Module::Rank < Metasploit::Model::Base
|
4
|
+
include Metasploit::Model::Module::Rank
|
5
|
+
|
6
|
+
#
|
7
|
+
# Attributes
|
8
|
+
#
|
9
|
+
|
10
|
+
# @!attribute [rw] name
|
11
|
+
# The name of the rank.
|
12
|
+
#
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :name
|
15
|
+
|
16
|
+
# @!attribute [rw] number
|
17
|
+
# The numerical value of the rank. Higher numbers are better.
|
18
|
+
#
|
19
|
+
# @return [Integer]
|
20
|
+
attr_accessor :number
|
21
|
+
|
22
|
+
# Keep single instance for each pair in {Metasploit::Model::Module::Rank::NUMBER_BY_NAME} to emulate unique database
|
23
|
+
# seeds in-memory.
|
24
|
+
#
|
25
|
+
# @param name [String] {#name}
|
26
|
+
# @return [Dummy::Module::Rank]
|
27
|
+
def self.with_name(name)
|
28
|
+
unless instance_variable_defined? :@instance_by_name
|
29
|
+
@instance_by_name = {}
|
30
|
+
|
31
|
+
NUMBER_BY_NAME.each do |instance_name, number|
|
32
|
+
instance = new(:name => instance_name, :number => number)
|
33
|
+
|
34
|
+
unless instance.valid?
|
35
|
+
raise Metasploit::Model::Invalid.new(instance)
|
36
|
+
end
|
37
|
+
|
38
|
+
@instance_by_name[instance_name] = instance
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
@instance_by_name.fetch(name)
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Dummy::Module::Reference < Metasploit::Model::Base
|
2
|
+
include Metasploit::Model::Module::Reference
|
3
|
+
|
4
|
+
#
|
5
|
+
# Associations
|
6
|
+
#
|
7
|
+
|
8
|
+
# @!attribute [rw] module_instance
|
9
|
+
# {Dummy::Module::Instance Module} with {#reference}.
|
10
|
+
#
|
11
|
+
# @return [Dummy::Module::Instance]
|
12
|
+
attr_accessor :module_instance
|
13
|
+
|
14
|
+
# @!attribute [rw] reference
|
15
|
+
# {Dummy::Reference reference} to exploit or proof-of-concept (PoC) code for {#module_instance}.
|
16
|
+
#
|
17
|
+
# @return [Dummy::Reference]
|
18
|
+
attr_accessor :reference
|
19
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Implementation of {Metasploit::Model::Module::Target} to allow testing of {Metasploit::Model::Module::Target}
|
2
|
+
# using an in-memory ActiveModel and use of factories.
|
3
|
+
class Dummy::Module::Target < Metasploit::Model::Base
|
4
|
+
include Metasploit::Model::Module::Target
|
5
|
+
|
6
|
+
#
|
7
|
+
# Associations
|
8
|
+
#
|
9
|
+
|
10
|
+
|
11
|
+
# @!attribute [r] architectures
|
12
|
+
# Architectures that this target supports, either by being declared specifically for this target or because
|
13
|
+
# this target did not override architectures and so inheritted the architecture set from the class.
|
14
|
+
#
|
15
|
+
# @return [Array<Metasploit::Model::Architecture>]
|
16
|
+
def architectures
|
17
|
+
target_architectures.map(&:architecture)
|
18
|
+
end
|
19
|
+
|
20
|
+
# @!attribute [rw] module_instance
|
21
|
+
# Module where this target was declared.
|
22
|
+
#
|
23
|
+
# @return [Dummy::Module::Instance]
|
24
|
+
attr_accessor :module_instance
|
25
|
+
|
26
|
+
# @!attribute [r] platforms
|
27
|
+
# Platforms that this target supports, either by being declared specifically for this target or because this
|
28
|
+
# target did not override platforms and so inheritted the platform set from the class.
|
29
|
+
#
|
30
|
+
# @return [Array<Metasploit::Model::Platform>]
|
31
|
+
def platforms
|
32
|
+
target_platforms.map(&:platform)
|
33
|
+
end
|
34
|
+
|
35
|
+
# @!attribute [rw] target_architectures
|
36
|
+
# Joins this target to its {#architectures}
|
37
|
+
#
|
38
|
+
# @return [Array<Metasploit::Model::Module::Target::Architecture]
|
39
|
+
def target_architectures
|
40
|
+
@target_architectures ||= []
|
41
|
+
end
|
42
|
+
attr_writer :target_architectures
|
43
|
+
|
44
|
+
# @!attribute [rw] target_platforms
|
45
|
+
# Joins this target to its {#platforms}
|
46
|
+
#
|
47
|
+
# @return [Array<Metasploit::Model::Module::Target::Platform>]
|
48
|
+
def target_platforms
|
49
|
+
@target_platforms ||= []
|
50
|
+
end
|
51
|
+
attr_writer :target_platforms
|
52
|
+
|
53
|
+
#
|
54
|
+
# Attributes
|
55
|
+
#
|
56
|
+
|
57
|
+
# @!attribute [rw] name
|
58
|
+
# The name of this target.
|
59
|
+
#
|
60
|
+
# @return [String]
|
61
|
+
attr_accessor :name
|
62
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Dummy::Module::Target::Architecture < Metasploit::Model::Base
|
2
|
+
include Metasploit::Model::Module::Target::Architecture
|
3
|
+
|
4
|
+
#
|
5
|
+
# Associations
|
6
|
+
#
|
7
|
+
|
8
|
+
# @!attribute [rw] architecture
|
9
|
+
# The architecture supported by the {#module_target}.
|
10
|
+
#
|
11
|
+
# @return [Dummy::Architecture]
|
12
|
+
attr_accessor :architecture
|
13
|
+
|
14
|
+
# @!attribute [rw] module_target
|
15
|
+
# The module target that supports {#architecture}.
|
16
|
+
#
|
17
|
+
# @return [Dummy::Module::Target]
|
18
|
+
attr_accessor :module_target
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Dummy::Module::Target::Platform < Metasploit::Model::Base
|
2
|
+
include Metasploit::Model::Module::Target::Platform
|
3
|
+
|
4
|
+
#
|
5
|
+
# Associations
|
6
|
+
#
|
7
|
+
|
8
|
+
# @!attribute [rw] module_target
|
9
|
+
# The module target that supports {#platform}.
|
10
|
+
#
|
11
|
+
# @return [Dummy::Module::Target]
|
12
|
+
attr_accessor :module_target
|
13
|
+
|
14
|
+
# @!attribute [rw] platform
|
15
|
+
# The platform supported by the {#module_target}.
|
16
|
+
#
|
17
|
+
# @return [Dummy::Platform]
|
18
|
+
attr_accessor :platform
|
19
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Implementation of {Metasploit::Model::Platform} to allow testing of {Metasploit::Model::Platform} using an in-memory
|
2
|
+
# ActiveModel and use of factories.
|
3
|
+
class Dummy::Platform < Metasploit::Model::Base
|
4
|
+
include Metasploit::Model::Platform
|
5
|
+
|
6
|
+
#
|
7
|
+
# Attributes
|
8
|
+
#
|
9
|
+
|
10
|
+
# @!attribute [rw] fully_qualified_name
|
11
|
+
# The fully qualified name of this platform, as would be used in the platform list in a metasploit-framework
|
12
|
+
# module.
|
13
|
+
#
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :fully_qualified_name
|
16
|
+
|
17
|
+
# @!attribute [rw] parent
|
18
|
+
# The parent platform of this platform. For example, Windows is parent of Windows 98, which is the parent of
|
19
|
+
# Windows 98 FE.
|
20
|
+
#
|
21
|
+
# @return [nil] if this is a top-level platform, such as Windows or Linux.
|
22
|
+
# @return [Metasploit::Model::Platform]
|
23
|
+
attr_accessor :parent
|
24
|
+
|
25
|
+
# @!attribute [rw] relative_name
|
26
|
+
# The name of this platform relative to the {#fully_qualified_name} of {#parent}.
|
27
|
+
#
|
28
|
+
# @return [String]
|
29
|
+
attr_accessor :relative_name
|
30
|
+
|
31
|
+
#
|
32
|
+
# Methods
|
33
|
+
#
|
34
|
+
|
35
|
+
def self.all
|
36
|
+
# cache so that Dummy::Platform can be compared by identity
|
37
|
+
unless instance_variable_defined? :@all
|
38
|
+
@all = []
|
39
|
+
|
40
|
+
Metasploit::Model::Platform.each_seed_attributes do |attributes|
|
41
|
+
child = new(attributes)
|
42
|
+
# validate to populate {#fully_qualified_name}
|
43
|
+
child.valid!
|
44
|
+
|
45
|
+
@all << child
|
46
|
+
|
47
|
+
# yieldreturn
|
48
|
+
child
|
49
|
+
end
|
50
|
+
|
51
|
+
# freeze objects to prevent specs from modifying them and interfering with other specs.
|
52
|
+
@all.map(&:freeze)
|
53
|
+
end
|
54
|
+
|
55
|
+
@all
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Implementation of {Metasploit::Model::Reference} to allow testing of {Metasploit::Model::Reference} using an in-memory
|
2
|
+
# ActiveModel and use of factories.
|
3
|
+
class Dummy::Reference < Metasploit::Model::Base
|
4
|
+
include Metasploit::Model::Reference
|
5
|
+
|
6
|
+
#
|
7
|
+
# Associations
|
8
|
+
#
|
9
|
+
|
10
|
+
# @!attribute [rw] authority
|
11
|
+
# The {Metasploit::Model::Authority authority} that assigned {#designation}.
|
12
|
+
#
|
13
|
+
# @return [Metasploit::Model::Authority, nil]
|
14
|
+
attr_accessor :authority
|
15
|
+
|
16
|
+
#
|
17
|
+
# Attributes
|
18
|
+
#
|
19
|
+
|
20
|
+
# @!attribute [rw] designation
|
21
|
+
# A designation (usually a string of numbers and dashes) assigned by {#authority}.
|
22
|
+
#
|
23
|
+
# @return [String, nil]
|
24
|
+
attr_accessor :designation
|
25
|
+
|
26
|
+
# @!attribute [rw] url
|
27
|
+
# URL to web page with information about referenced exploit.
|
28
|
+
#
|
29
|
+
# @return [String, nil]
|
30
|
+
attr_accessor :url
|
31
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
# require the engine being tested. In a non-dummy app this would be handled by the engine's gem being in the Gemfile
|
7
|
+
# for real app and Bundler.require requiring the gem.
|
8
|
+
require 'metasploit/model'
|
9
|
+
|
10
|
+
module Dummy
|
11
|
+
class Application < Rails::Application
|
12
|
+
# Settings in config/environments/* take precedence over those specified here.
|
13
|
+
# Application configuration should go into files in config/initializers
|
14
|
+
# -- all .rb files in that directory are automatically loaded.
|
15
|
+
|
16
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
17
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
18
|
+
|
19
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
20
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
21
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
22
|
+
|
23
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
24
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
25
|
+
# config.i18n.default_locale = :de
|
26
|
+
|
27
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
28
|
+
config.encoding = "utf-8"
|
29
|
+
|
30
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
31
|
+
config.filter_parameters += [:password]
|
32
|
+
|
33
|
+
# Enable escaping HTML in JSON.
|
34
|
+
config.active_support.escape_html_entities_in_json = true
|
35
|
+
|
36
|
+
# Enable the asset pipeline
|
37
|
+
config.assets.enabled = true
|
38
|
+
|
39
|
+
# Version of your assets, change this if you want to expire all your assets
|
40
|
+
config.assets.version = '1.0'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Print deprecation notices to the Rails logger
|
17
|
+
config.active_support.deprecation = :log
|
18
|
+
|
19
|
+
# Only use best-standards-support built into browsers
|
20
|
+
config.action_dispatch.best_standards_support = :builtin
|
21
|
+
|
22
|
+
# Do not compress assets
|
23
|
+
config.assets.compress = false
|
24
|
+
|
25
|
+
# Expands the lines which load the assets
|
26
|
+
config.assets.debug = true
|
27
|
+
end
|