metasploit-model 0.24.1-java
Sign up to get free protection for your applications and to get access to all the features.
- 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,124 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IpFormatValidator do
|
4
|
+
subject(:ip_format_validator) do
|
5
|
+
described_class.new(
|
6
|
+
:attributes => attributes
|
7
|
+
)
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:attribute) do
|
11
|
+
:address
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:attributes) do
|
15
|
+
[
|
16
|
+
attribute
|
17
|
+
]
|
18
|
+
end
|
19
|
+
|
20
|
+
context '#validate_each' do
|
21
|
+
subject(:validate_each) do
|
22
|
+
ip_format_validator.validate_each(record, attribute, value)
|
23
|
+
end
|
24
|
+
|
25
|
+
let(:error) do
|
26
|
+
'must be a valid IPv4 or IPv6 address'
|
27
|
+
end
|
28
|
+
|
29
|
+
let(:record) do
|
30
|
+
record_class.new
|
31
|
+
end
|
32
|
+
|
33
|
+
let(:record_class) do
|
34
|
+
# capture for Class.new scope
|
35
|
+
attribute = self.attribute
|
36
|
+
|
37
|
+
Class.new do
|
38
|
+
include ActiveModel::Validations
|
39
|
+
|
40
|
+
#
|
41
|
+
# Validations
|
42
|
+
#
|
43
|
+
|
44
|
+
validates attribute,
|
45
|
+
:ip_format => true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'with value' do
|
50
|
+
context 'with IPv4 address' do
|
51
|
+
let(:value) do
|
52
|
+
'192.168.0.1'
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should not record any errors' do
|
56
|
+
validate_each
|
57
|
+
|
58
|
+
record.errors.should be_empty
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'with IPv6 address' do
|
63
|
+
let(:value) do
|
64
|
+
'::1'
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should not record any errors' do
|
68
|
+
validate_each
|
69
|
+
|
70
|
+
record.errors.should be_empty
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'with IPv4 range' do
|
75
|
+
let(:value) do
|
76
|
+
'127.0.0.1/8'
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should record error' do
|
80
|
+
validate_each
|
81
|
+
|
82
|
+
record.errors[attribute].should include("#{error} and not an IPv4 address range in CIDR or netmask notation")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'with IPv6 range' do
|
87
|
+
let(:value) do
|
88
|
+
'3ffe:505:2::1/48'
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'should record error' do
|
92
|
+
validate_each
|
93
|
+
|
94
|
+
record.errors[attribute].should include("#{error} and not an IPv6 address range in CIDR or netmask notation")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'without IPv4 or IPv6 address' do
|
99
|
+
let(:value) do
|
100
|
+
'localhost'
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'should record error' do
|
104
|
+
validate_each
|
105
|
+
|
106
|
+
record.errors[attribute].should include(error)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
context 'without value' do
|
113
|
+
let(:value) do
|
114
|
+
nil
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'should record error on attribute' do
|
118
|
+
validate_each
|
119
|
+
|
120
|
+
record.errors[attribute].should include(error)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NilValidator do
|
4
|
+
subject(:nil_validator) do
|
5
|
+
described_class.new(
|
6
|
+
:attributes => attributes
|
7
|
+
)
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:attribute) do
|
11
|
+
:nil_thing
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:attributes) do
|
15
|
+
[
|
16
|
+
attribute
|
17
|
+
]
|
18
|
+
end
|
19
|
+
|
20
|
+
context '#validate_each' do
|
21
|
+
subject(:validate_each) do
|
22
|
+
nil_validator.validate_each(record, attribute, value)
|
23
|
+
end
|
24
|
+
|
25
|
+
let(:record) do
|
26
|
+
record_class.new
|
27
|
+
end
|
28
|
+
|
29
|
+
let(:record_class) do
|
30
|
+
# capture attribute for Class.new scope
|
31
|
+
attribute = self.attribute
|
32
|
+
|
33
|
+
Class.new do
|
34
|
+
include ActiveModel::Validations
|
35
|
+
|
36
|
+
#
|
37
|
+
# Validations
|
38
|
+
#
|
39
|
+
|
40
|
+
validates attribute,
|
41
|
+
:nil => true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'with value' do
|
46
|
+
let(:value) do
|
47
|
+
''
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should record error on attribute' do
|
51
|
+
validate_each
|
52
|
+
|
53
|
+
record.errors[attribute].should include('must be nil')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'without value' do
|
58
|
+
let(:value) do
|
59
|
+
nil
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should not record any error' do
|
63
|
+
validate_each
|
64
|
+
|
65
|
+
record.errors.should be_empty
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,342 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ParametersValidator do
|
4
|
+
subject(:parameters_validator) do
|
5
|
+
described_class.new(
|
6
|
+
:attributes => attributes
|
7
|
+
)
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:attribute) do
|
11
|
+
:params
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:attributes) do
|
15
|
+
attribute
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:element) do
|
19
|
+
[]
|
20
|
+
end
|
21
|
+
|
22
|
+
let(:index) do
|
23
|
+
rand(100)
|
24
|
+
end
|
25
|
+
|
26
|
+
let(:type_signature_sentence) do
|
27
|
+
'Valid parameters are an Array<Array(String, String)>.'
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'CONSTANTS' do
|
31
|
+
it 'should define TYPE_SIGNATURE_SENTENCE' do
|
32
|
+
described_class::TYPE_SIGNATURE_SENTENCE.should == type_signature_sentence
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context '#error_at' do
|
37
|
+
subject(:error_at) do
|
38
|
+
parameters_validator.send(
|
39
|
+
:error_at,
|
40
|
+
:element => element,
|
41
|
+
:index => index,
|
42
|
+
:prefix => prefix
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
let(:prefix) do
|
47
|
+
'has a prefix'
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should include prefix' do
|
51
|
+
error_at.should include(prefix)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should include location_clause in same sentence as prefix' do
|
55
|
+
location_clause = parameters_validator.send(
|
56
|
+
:location_clause,
|
57
|
+
:element => element,
|
58
|
+
:index => index
|
59
|
+
)
|
60
|
+
|
61
|
+
error_at.should include("#{prefix} #{location_clause}.")
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should include TYPE_SIGNATURE_SENTENCE' do
|
65
|
+
error_at.should include(type_signature_sentence)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context '#length_error_at' do
|
70
|
+
subject(:length_error_at) do
|
71
|
+
parameters_validator.send(
|
72
|
+
:length_error_at,
|
73
|
+
:element => element,
|
74
|
+
:extreme => extreme,
|
75
|
+
:index => index
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
let(:extreme) do
|
80
|
+
[:few, :many].sample
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should include extreme in prefix' do
|
84
|
+
parameters_validator.should_receive(:error_at) do |*args|
|
85
|
+
options = args.first
|
86
|
+
options[:prefix].should include(extreme.to_s)
|
87
|
+
end
|
88
|
+
|
89
|
+
length_error_at
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context '#location_clause' do
|
94
|
+
subject(:location_clause) do
|
95
|
+
parameters_validator.send(
|
96
|
+
:location_clause,
|
97
|
+
:element => element,
|
98
|
+
:index => index
|
99
|
+
)
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'should include numerical index' do
|
103
|
+
location_clause.should include("at index #{index}")
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'should include inspect of element' do
|
107
|
+
location_clause.should include(element.inspect)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
context '#validate_each' do
|
112
|
+
subject(:errors) do
|
113
|
+
record.errors[attribute]
|
114
|
+
end
|
115
|
+
|
116
|
+
def validate_each
|
117
|
+
parameters_validator.validate_each(record, attribute, value)
|
118
|
+
end
|
119
|
+
|
120
|
+
let(:record) do
|
121
|
+
Object.new.tap { |object|
|
122
|
+
object.extend ActiveModel::Validations
|
123
|
+
}
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'with Array' do
|
127
|
+
let(:value) do
|
128
|
+
[]
|
129
|
+
end
|
130
|
+
|
131
|
+
context 'element' do
|
132
|
+
let(:value) do
|
133
|
+
[element]
|
134
|
+
end
|
135
|
+
|
136
|
+
context 'with Array' do
|
137
|
+
let(:element) do
|
138
|
+
[]
|
139
|
+
end
|
140
|
+
|
141
|
+
context 'with length < 2' do
|
142
|
+
let(:element) do
|
143
|
+
[]
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'should call #length_error_at with :extreme => :few' do
|
147
|
+
parameters_validator.should_receive(:length_error_at).with(
|
148
|
+
hash_including(
|
149
|
+
:extreme => :few
|
150
|
+
)
|
151
|
+
)
|
152
|
+
|
153
|
+
validate_each
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'should record error' do
|
157
|
+
validate_each
|
158
|
+
|
159
|
+
errors.should_not be_empty
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
context 'with length > 2' do
|
164
|
+
let(:element) do
|
165
|
+
['', '', '']
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'should call #length_error_at with :extreme => :many' do
|
169
|
+
parameters_validator.should_receive(:length_error_at).with(
|
170
|
+
hash_including(
|
171
|
+
:extreme => :many
|
172
|
+
)
|
173
|
+
)
|
174
|
+
|
175
|
+
validate_each
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'should record error' do
|
179
|
+
validate_each
|
180
|
+
|
181
|
+
errors.should_not be_empty
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
context 'with length == 2' do
|
186
|
+
let(:element) do
|
187
|
+
[parameter_name, parameter_value]
|
188
|
+
end
|
189
|
+
|
190
|
+
let(:parameter_name) do
|
191
|
+
'parameter_name'
|
192
|
+
end
|
193
|
+
|
194
|
+
let(:parameter_value) do
|
195
|
+
'parameter_value'
|
196
|
+
end
|
197
|
+
|
198
|
+
context 'parameter name' do
|
199
|
+
context 'with String' do
|
200
|
+
context 'with blank' do
|
201
|
+
let(:parameter_name) do
|
202
|
+
''
|
203
|
+
end
|
204
|
+
|
205
|
+
it 'should call error_at with blank parameter name prefix' do
|
206
|
+
parameters_validator.should_receive(:error_at).with(
|
207
|
+
hash_including(
|
208
|
+
:prefix => 'has blank parameter name'
|
209
|
+
)
|
210
|
+
)
|
211
|
+
|
212
|
+
validate_each
|
213
|
+
end
|
214
|
+
|
215
|
+
it 'should record error' do
|
216
|
+
validate_each
|
217
|
+
|
218
|
+
errors.should_not be_empty
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
context 'without blank' do
|
223
|
+
let(:parameter_name) do
|
224
|
+
'parameter_name'
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'should not record error' do
|
228
|
+
validate_each
|
229
|
+
|
230
|
+
errors.should be_blank
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
context 'without String' do
|
236
|
+
let(:parameter_name) do
|
237
|
+
:parameter_name
|
238
|
+
end
|
239
|
+
|
240
|
+
it 'should call error_at with non-String prefix' do
|
241
|
+
parameters_validator.should_receive(:error_at).with(
|
242
|
+
hash_including(
|
243
|
+
:prefix => "has non-String parameter name (#{parameter_name.inspect})"
|
244
|
+
)
|
245
|
+
)
|
246
|
+
|
247
|
+
validate_each
|
248
|
+
end
|
249
|
+
|
250
|
+
it 'should record error' do
|
251
|
+
validate_each
|
252
|
+
|
253
|
+
errors.should_not be_empty
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
context 'parameter value' do
|
259
|
+
context 'with String' do
|
260
|
+
let(:parameter_value) do
|
261
|
+
'parameter_value'
|
262
|
+
end
|
263
|
+
|
264
|
+
it 'should not record error' do
|
265
|
+
validate_each
|
266
|
+
|
267
|
+
errors.should be_blank
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
context 'without String' do
|
272
|
+
let(:parameter_value) do
|
273
|
+
0
|
274
|
+
end
|
275
|
+
|
276
|
+
it 'should call error_at with non-String prefix' do
|
277
|
+
parameters_validator.should_receive(:error_at).with(
|
278
|
+
hash_including(
|
279
|
+
:prefix => "has non-String parameter value (#{parameter_value.inspect})"
|
280
|
+
)
|
281
|
+
)
|
282
|
+
|
283
|
+
validate_each
|
284
|
+
end
|
285
|
+
|
286
|
+
it 'should record error' do
|
287
|
+
validate_each
|
288
|
+
|
289
|
+
errors.should_not be_empty
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
context 'without Array' do
|
297
|
+
let(:element) do
|
298
|
+
{}
|
299
|
+
end
|
300
|
+
|
301
|
+
it 'should use #error_at with has non-Array for prefix' do
|
302
|
+
parameters_validator.should_receive(:error_at).with(
|
303
|
+
hash_including(
|
304
|
+
:prefix => 'has non-Array'
|
305
|
+
)
|
306
|
+
)
|
307
|
+
|
308
|
+
validate_each
|
309
|
+
end
|
310
|
+
|
311
|
+
it 'should record error' do
|
312
|
+
validate_each
|
313
|
+
|
314
|
+
errors.should_not be_empty
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
context 'without Array' do
|
321
|
+
let(:value) do
|
322
|
+
''
|
323
|
+
end
|
324
|
+
|
325
|
+
before(:each) do
|
326
|
+
validate_each
|
327
|
+
end
|
328
|
+
|
329
|
+
it 'should error that attribute is not an array' do
|
330
|
+
errors.any? { |error|
|
331
|
+
error.include? 'is not an Array.'
|
332
|
+
}.should be_true
|
333
|
+
end
|
334
|
+
|
335
|
+
it 'should include TYPE_SIGNATURE_SENTENCE' do
|
336
|
+
errors.each do |error|
|
337
|
+
error.should include(type_signature_sentence)
|
338
|
+
end
|
339
|
+
end
|
340
|
+
end
|
341
|
+
end
|
342
|
+
end
|