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,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Metasploit::Model do
|
4
|
+
let(:root_pathname) do
|
5
|
+
spec_lib_metasploit_pathname = Pathname.new(__FILE__).parent
|
6
|
+
spec_lib_pathname = spec_lib_metasploit_pathname.parent
|
7
|
+
spec_pathname = spec_lib_pathname.parent
|
8
|
+
|
9
|
+
spec_pathname.parent
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should extend Metasploit::Model::Configured' do
|
13
|
+
described_class.singleton_class.should include Metasploit::Model::Configured
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'configuration' do
|
17
|
+
subject(:configuration) do
|
18
|
+
described_class.configuration
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'autoload' do
|
22
|
+
subject(:autoload) do
|
23
|
+
configuration.autoload
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'once_paths' do
|
27
|
+
subject(:once_paths) do
|
28
|
+
autoload.once_paths
|
29
|
+
end
|
30
|
+
|
31
|
+
it { should include root_pathname.join('lib').to_path }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'paths' do
|
35
|
+
subject(:paths) do
|
36
|
+
autoload.paths
|
37
|
+
end
|
38
|
+
|
39
|
+
it { should include root_pathname.join('app', 'models').to_path }
|
40
|
+
it { should include root_pathname.join('app', 'validators').to_path }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'i18n' do
|
45
|
+
subject(:i18n) do
|
46
|
+
configuration.i18n
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'paths' do
|
50
|
+
subject(:paths) do
|
51
|
+
i18n.paths
|
52
|
+
end
|
53
|
+
|
54
|
+
it { should include root_pathname.join('config', 'locales', 'en.yml').to_path }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'root' do
|
60
|
+
subject(:root) do
|
61
|
+
described_class.root
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should be top-level directory of metasploit-model project' do
|
65
|
+
root.should == root_pathname
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV['RAILS_ENV'] = 'test'
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'bundler'
|
6
|
+
Bundler.setup(:default, :test)
|
7
|
+
|
8
|
+
# Require simplecov before loading ..dummy/config/environment.rb because it will cause metasploit_data_models/lib to
|
9
|
+
# be loaded, which would result in Coverage not recording hits for any of the files.
|
10
|
+
require 'simplecov'
|
11
|
+
require 'coveralls'
|
12
|
+
|
13
|
+
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
14
|
+
|
15
|
+
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
16
|
+
require 'rspec/rails'
|
17
|
+
require 'rspec/autorun'
|
18
|
+
|
19
|
+
# full backtrace in logs so its easier to trace errors
|
20
|
+
Rails.backtrace_cleaner.remove_silencers!
|
21
|
+
|
22
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
23
|
+
# in spec/support/ and its subdirectories.
|
24
|
+
support_glob = Metasploit::Model.root.join('spec', 'support', '**', '*.rb')
|
25
|
+
|
26
|
+
Dir.glob(support_glob) do |path|
|
27
|
+
require path
|
28
|
+
end
|
29
|
+
|
30
|
+
RSpec.configure do |config|
|
31
|
+
config.before(:suite) do
|
32
|
+
# this must be explicitly set here because it should always be spec/tmp for w/e project is using
|
33
|
+
# Metasploit::Model::Spec to handle file system clean up.
|
34
|
+
Metasploit::Model::Spec.temporary_pathname = Metasploit::Model.root.join('spec', 'tmp')
|
35
|
+
# Clean up any left over files from a previously aborted suite
|
36
|
+
Metasploit::Model::Spec.remove_temporary_pathname
|
37
|
+
|
38
|
+
# catch missing translations
|
39
|
+
I18n.exception_handler = Metasploit::Model::Spec::I18nExceptionHandler.new
|
40
|
+
end
|
41
|
+
|
42
|
+
config.after(:each) do
|
43
|
+
Metasploit::Model::Spec.remove_temporary_pathname
|
44
|
+
end
|
45
|
+
|
46
|
+
config.mock_with :rspec
|
47
|
+
config.order = :random
|
48
|
+
end
|
data/spec/support/shared/contexts/metasploit/model/module/ancestor/contents/metasploit_module.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
shared_context 'Metasploit::Model::Module::Ancestor#contents metasploit_module' do
|
2
|
+
def namespace_module_metasploit_module(namespace_module)
|
3
|
+
constant = namespace_module_metasploit_module_constant(namespace_module)
|
4
|
+
namespace_module.const_get(constant)
|
5
|
+
end
|
6
|
+
|
7
|
+
def namespace_module_metasploit_module_constant(namespace_module)
|
8
|
+
namespace_module.constants.find { |constant|
|
9
|
+
constant.to_s =~ /Metasploit\d+/
|
10
|
+
}
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
shared_context 'Metasploit::Model::Module::Ancestor factory contents' do
|
2
|
+
subject(:contents) do
|
3
|
+
module_ancestor.contents
|
4
|
+
end
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
# need to validate so that real_path is derived so contents can be read
|
8
|
+
module_ancestor.valid?
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
shared_context 'Metasploit::Model::Module::Ancestor factory contents metasploit_module' do
|
2
|
+
include_context 'Metasploit::Model::Module::Ancestor#contents metasploit_module'
|
3
|
+
|
4
|
+
subject(:metasploit_module) do
|
5
|
+
namespace_module_metasploit_module(namespace_module)
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:namespace_module) do
|
9
|
+
Module.new
|
10
|
+
end
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
namespace_module.module_eval(contents)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
shared_context 'Metasploit::Model::Search::Operator::Union#children' do
|
2
|
+
subject(:children) do
|
3
|
+
operator.children(formatted_value)
|
4
|
+
end
|
5
|
+
|
6
|
+
def child(formatted_operator)
|
7
|
+
operator_name = formatted_operator.to_sym
|
8
|
+
|
9
|
+
children.find { |operation|
|
10
|
+
operation.operator.name == operator_name
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
shared_examples_for 'derives' do |attribute, options={}|
|
2
|
+
options.assert_valid_keys(:validates)
|
3
|
+
|
4
|
+
derived = "derived_#{attribute}"
|
5
|
+
validates = options.fetch(:validates)
|
6
|
+
|
7
|
+
context attribute do
|
8
|
+
it { should be_a Metasploit::Model::Derivation }
|
9
|
+
|
10
|
+
let(:validate) do
|
11
|
+
# don't use `described_class` as it won't be correct when testing mixin modules.
|
12
|
+
base_class.validate_by_derived_attribute[attribute]
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should declare #{attribute} is derived" do
|
16
|
+
validate.should_not be_nil
|
17
|
+
end
|
18
|
+
|
19
|
+
if validates
|
20
|
+
it "should validate #{attribute}" do
|
21
|
+
validate.should be_true
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'validation' do
|
25
|
+
before(:each) do
|
26
|
+
subject.send("#{attribute}=", value)
|
27
|
+
end
|
28
|
+
|
29
|
+
context "with #{attribute} matching #{derived}" do
|
30
|
+
let(:value) do
|
31
|
+
subject.send(derived)
|
32
|
+
end
|
33
|
+
|
34
|
+
it { should be_valid }
|
35
|
+
end
|
36
|
+
|
37
|
+
context "without #{attribute} matching #{derived}" do
|
38
|
+
let(:value) do
|
39
|
+
"not #{subject.send(derived)}"
|
40
|
+
end
|
41
|
+
|
42
|
+
it { should_not be_valid }
|
43
|
+
|
44
|
+
it "should record error on #{attribute}" do
|
45
|
+
subject.valid?
|
46
|
+
|
47
|
+
subject.errors[attribute].should include("must match its derivation")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
else
|
52
|
+
it "should not validate #{attribute}" do
|
53
|
+
validate.should be_false
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "##{derived}" do
|
58
|
+
it "should respond to #{derived}" do
|
59
|
+
subject.should respond_to(derived)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should not be nil or the spec that expect a change will fail' do
|
63
|
+
subject.send(derived).should_not be_nil
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'callbacks' do
|
68
|
+
context 'before validation' do
|
69
|
+
before(:each) do
|
70
|
+
subject.send("#{attribute}=", value)
|
71
|
+
end
|
72
|
+
|
73
|
+
context "with #{attribute}" do
|
74
|
+
let(:value) do
|
75
|
+
attribute_type = self.attribute_type(attribute)
|
76
|
+
|
77
|
+
case attribute_type
|
78
|
+
when :string, :text
|
79
|
+
'existing_value'
|
80
|
+
when :datetime
|
81
|
+
DateTime.new
|
82
|
+
else
|
83
|
+
raise ArgumentError,
|
84
|
+
"Don't know how to make valid existing value for attribute type (#{attribute_type.inspect})"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should not change #{attribute}" do
|
89
|
+
expect {
|
90
|
+
subject.valid?
|
91
|
+
}.to_not change {
|
92
|
+
subject.send(attribute)
|
93
|
+
}
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context "without #{attribute}" do
|
98
|
+
let(:value) do
|
99
|
+
nil
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should set #{attribute} to #{derived}" do
|
103
|
+
expect {
|
104
|
+
subject.valid?
|
105
|
+
}.to change {
|
106
|
+
subject.send(attribute)
|
107
|
+
}
|
108
|
+
|
109
|
+
subject.send(attribute).should == subject.send(derived)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,425 @@
|
|
1
|
+
Metasploit::Model::Spec.shared_examples_for 'Architecture' do
|
2
|
+
subject(:architecture) do
|
3
|
+
# Architecture, don't have a factory, they have a sequence and can't use sequence generated architectures because
|
4
|
+
# validators so tightly constraint values.
|
5
|
+
architecture_class.new
|
6
|
+
end
|
7
|
+
|
8
|
+
context 'CONSTANTS' do
|
9
|
+
context 'ABBREVIATIONS' do
|
10
|
+
subject(:abbreviations) do
|
11
|
+
described_class::ABBREVIATIONS
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should be an Array<String>' do
|
15
|
+
abbreviations.should be_an Array
|
16
|
+
|
17
|
+
abbreviations.each do |architecture|
|
18
|
+
architecture.should be_a String
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should include both endians of ARM' do
|
23
|
+
abbreviations.should include('armbe')
|
24
|
+
abbreviations.should include('armle')
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should include 32-bit and 64-bit versions of Cell Broadband Engine Architecture' do
|
28
|
+
abbreviations.should include('cbea')
|
29
|
+
abbreviations.should include('cbea64')
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should include cmd for command shell' do
|
33
|
+
abbreviations.should include('cmd')
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should include dalvik for Dalvik Virtual Machine in Google Android' do
|
37
|
+
abbreviations.should include('dalvik')
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should include firefox for Firefox privileged javascript API' do
|
41
|
+
expect(abbreviations).to include('firefox')
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should include java for Java Virtual Machine' do
|
45
|
+
abbreviations.should include('java')
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should include endian-ware MIPS' do
|
49
|
+
abbreviations.should include('mipsbe')
|
50
|
+
abbreviations.should include('mipsle')
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should include nodejs for javascript code that requires NodeJS extensions/libraries' do
|
54
|
+
expect(abbreviations).to include('nodejs')
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should include php for PHP code' do
|
58
|
+
abbreviations.should include('php')
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should include 32-bit and 64-bit PowerPC' do
|
62
|
+
abbreviations.should include('ppc')
|
63
|
+
abbreviations.should include('ppc64')
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should include python for Python code' do
|
67
|
+
abbreviations.should include('python')
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should include ruby for Ruby code' do
|
71
|
+
abbreviations.should include('ruby')
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should include sparc for Sparc' do
|
75
|
+
abbreviations.should include('sparc')
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'should include tty for Terminals' do
|
79
|
+
abbreviations.should include('tty')
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'should include 32-bit and 64-bit x86' do
|
83
|
+
abbreviations.should include('x86')
|
84
|
+
abbreviations.should include('x86_64')
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context 'BITS' do
|
89
|
+
subject(:bits) do
|
90
|
+
described_class::BITS
|
91
|
+
end
|
92
|
+
|
93
|
+
it { should include 32 }
|
94
|
+
it { should include 64 }
|
95
|
+
end
|
96
|
+
|
97
|
+
context 'ENDIANNESSES' do
|
98
|
+
subject(:endiannesses) do
|
99
|
+
described_class::ENDIANNESSES
|
100
|
+
end
|
101
|
+
|
102
|
+
it { should include 'big' }
|
103
|
+
it { should include 'little' }
|
104
|
+
end
|
105
|
+
|
106
|
+
context 'FAMILIES' do
|
107
|
+
subject(:families) do
|
108
|
+
described_class::FAMILIES
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'includes arm for big- and little-endian ARM' do
|
112
|
+
expect(families).to include('arm')
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'includes cbea for 32- and 64-bit Cell Broadband Engine Architecture' do
|
116
|
+
expect(families).to include('cbea')
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'includes javascript for NodeJS' do
|
120
|
+
expect(families).to include('javascript')
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'includes mips for big and little-endian MIPS' do
|
124
|
+
expect(families).to include('mips')
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'includes ppc for 32- and 64-bit PPC' do
|
128
|
+
expect(families).to include('ppc')
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'includes sparc for sparc' do
|
132
|
+
expect(families).to include('sparc')
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'includes x86 for x86 and x86_64' do
|
136
|
+
expect(families).to include('x86')
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
context 'search' do
|
142
|
+
context 'attributes' do
|
143
|
+
it_should_behave_like 'search_attribute',
|
144
|
+
:abbreviation,
|
145
|
+
type: {
|
146
|
+
set: :string
|
147
|
+
}
|
148
|
+
it_should_behave_like 'search_attribute',
|
149
|
+
:bits,
|
150
|
+
type: {
|
151
|
+
set: :integer
|
152
|
+
}
|
153
|
+
it_should_behave_like 'search_attribute',
|
154
|
+
:endianness,
|
155
|
+
type: {
|
156
|
+
set: :string
|
157
|
+
}
|
158
|
+
it_should_behave_like 'search_attribute',
|
159
|
+
:family,
|
160
|
+
type: {
|
161
|
+
set: :string
|
162
|
+
}
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
context 'seeds' do
|
167
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
168
|
+
:abbreviation => 'armbe',
|
169
|
+
:bits => 32,
|
170
|
+
:endianness => 'big',
|
171
|
+
:family => 'arm',
|
172
|
+
:summary => 'Little-endian ARM'
|
173
|
+
|
174
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
175
|
+
:abbreviation => 'armle',
|
176
|
+
:bits => 32,
|
177
|
+
:endianness => 'little',
|
178
|
+
:family => 'arm',
|
179
|
+
:summary => 'Big-endian ARM'
|
180
|
+
|
181
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
182
|
+
:abbreviation => 'cbea',
|
183
|
+
:bits => 32,
|
184
|
+
:endianness => 'big',
|
185
|
+
:family => 'cbea',
|
186
|
+
:summary => '32-bit Cell Broadband Engine Architecture'
|
187
|
+
|
188
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
189
|
+
:abbreviation => 'cbea64',
|
190
|
+
:bits => 64,
|
191
|
+
:endianness => 'big',
|
192
|
+
:family => 'cbea',
|
193
|
+
:summary => '64-bit Cell Broadband Engine Architecture'
|
194
|
+
|
195
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
196
|
+
:abbreviation => 'cmd',
|
197
|
+
:bits => nil,
|
198
|
+
:endianness => nil,
|
199
|
+
:family => nil,
|
200
|
+
:summary => 'Command Injection'
|
201
|
+
|
202
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
203
|
+
:abbreviation => 'dalvik',
|
204
|
+
:bits => nil,
|
205
|
+
:endianness => nil,
|
206
|
+
:family => nil,
|
207
|
+
:summary => 'Dalvik process virtual machine used in Google Android'
|
208
|
+
|
209
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
210
|
+
abbreviation: 'firefox',
|
211
|
+
bits: nil,
|
212
|
+
endianness: nil,
|
213
|
+
family: 'javascript',
|
214
|
+
summary: "Firefox's privileged javascript API"
|
215
|
+
|
216
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
217
|
+
:abbreviation => 'java',
|
218
|
+
:bits => nil,
|
219
|
+
:endianness => 'big',
|
220
|
+
:family => nil,
|
221
|
+
:summary => 'Java'
|
222
|
+
|
223
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
224
|
+
:abbreviation => 'mipsbe',
|
225
|
+
:bits => 32,
|
226
|
+
:endianness => 'big',
|
227
|
+
:family => 'mips',
|
228
|
+
:summary => 'Big-endian MIPS'
|
229
|
+
|
230
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
231
|
+
:abbreviation => 'mipsle',
|
232
|
+
:bits => 32,
|
233
|
+
:endianness => 'little',
|
234
|
+
:family => 'mips',
|
235
|
+
:summary => 'Little-endian MIPS'
|
236
|
+
|
237
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
238
|
+
:abbreviation => 'nodejs',
|
239
|
+
:bits => nil,
|
240
|
+
:endianness => nil,
|
241
|
+
:family => 'javascript',
|
242
|
+
:summary => 'NodeJS'
|
243
|
+
|
244
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
245
|
+
:abbreviation => 'php',
|
246
|
+
:bits => nil,
|
247
|
+
:endianness => nil,
|
248
|
+
:family => nil,
|
249
|
+
:summary => 'PHP'
|
250
|
+
|
251
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
252
|
+
:abbreviation => 'ppc',
|
253
|
+
:bits => 32,
|
254
|
+
:endianness => 'big',
|
255
|
+
:family => 'ppc',
|
256
|
+
:summary => '32-bit Peformance Optimization With Enhanced RISC - Performance Computing'
|
257
|
+
|
258
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
259
|
+
:abbreviation => 'ppc64',
|
260
|
+
:bits => 64,
|
261
|
+
:endianness => 'big',
|
262
|
+
:family => 'ppc',
|
263
|
+
:summary => '64-bit Performance Optimization With Enhanced RISC - Performance Computing'
|
264
|
+
|
265
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
266
|
+
:abbreviation => 'python',
|
267
|
+
:bits => nil,
|
268
|
+
:endianness => nil,
|
269
|
+
:family => nil,
|
270
|
+
:summary => 'Python'
|
271
|
+
|
272
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
273
|
+
:abbreviation => 'ruby',
|
274
|
+
:bits => nil,
|
275
|
+
:endianness => nil,
|
276
|
+
:family => nil,
|
277
|
+
:summary => 'Ruby'
|
278
|
+
|
279
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
280
|
+
:abbreviation => 'sparc',
|
281
|
+
:bits => nil,
|
282
|
+
:endianness => nil,
|
283
|
+
:family => 'sparc',
|
284
|
+
:summary => 'Scalable Processor ARChitecture'
|
285
|
+
|
286
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
287
|
+
:abbreviation => 'tty',
|
288
|
+
:bits => nil,
|
289
|
+
:endianness => nil,
|
290
|
+
:family => nil,
|
291
|
+
:summary => '*nix terminal'
|
292
|
+
|
293
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
294
|
+
:abbreviation => 'x86',
|
295
|
+
:bits => 32,
|
296
|
+
:endianness => 'little',
|
297
|
+
:family => 'x86',
|
298
|
+
:summary => '32-bit x86'
|
299
|
+
|
300
|
+
it_should_behave_like 'Metasploit::Model::Architecture seed',
|
301
|
+
:abbreviation => 'x86_64',
|
302
|
+
:bits => 64,
|
303
|
+
:endianness => 'little',
|
304
|
+
:family => 'x86',
|
305
|
+
:summary => '64-bit x86'
|
306
|
+
end
|
307
|
+
|
308
|
+
context 'validations' do
|
309
|
+
context 'abbreviation' do
|
310
|
+
# have to test inclusion validation manually because
|
311
|
+
# ensure_inclusion_of(:abbreviation).in_array(described_class::ABBREVIATIONS).allow_nil does not work with
|
312
|
+
# additional uniqueness validation.
|
313
|
+
context 'ensure inclusion of abbreviation in ABBREVIATIONS' do
|
314
|
+
let(:error) do
|
315
|
+
'is not included in the list'
|
316
|
+
end
|
317
|
+
|
318
|
+
abbreviations = [
|
319
|
+
'armbe',
|
320
|
+
'armle',
|
321
|
+
'cbea',
|
322
|
+
'cbea64',
|
323
|
+
'cmd',
|
324
|
+
'dalvik',
|
325
|
+
'firefox',
|
326
|
+
'java',
|
327
|
+
'mipsbe',
|
328
|
+
'mipsle',
|
329
|
+
'nodejs',
|
330
|
+
'php',
|
331
|
+
'ppc',
|
332
|
+
'ppc64',
|
333
|
+
'python',
|
334
|
+
'ruby',
|
335
|
+
'sparc',
|
336
|
+
'tty',
|
337
|
+
'x86',
|
338
|
+
'x86_64'
|
339
|
+
]
|
340
|
+
|
341
|
+
abbreviations.each do |abbreviation|
|
342
|
+
context "with #{abbreviation.inspect}" do
|
343
|
+
before(:each) do
|
344
|
+
architecture.abbreviation = abbreviation
|
345
|
+
|
346
|
+
architecture.valid?
|
347
|
+
end
|
348
|
+
|
349
|
+
it 'should not record error on abbreviation' do
|
350
|
+
architecture.errors[:abbreviation].should_not include(error)
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
it { should ensure_inclusion_of(:bits).in_array(described_class::BITS).allow_nil }
|
358
|
+
it { should ensure_inclusion_of(:endianness).in_array(described_class::ENDIANNESSES).allow_nil }
|
359
|
+
it { should ensure_inclusion_of(:family).in_array(described_class::FAMILIES).allow_nil }
|
360
|
+
it { should validate_presence_of(:summary) }
|
361
|
+
end
|
362
|
+
|
363
|
+
context 'abbreviation_set' do
|
364
|
+
subject(:abbreviation_set) do
|
365
|
+
architecture_class.abbreviation_set
|
366
|
+
end
|
367
|
+
|
368
|
+
it { should_not include nil }
|
369
|
+
it { should include 'armbe' }
|
370
|
+
it { should include 'armle' }
|
371
|
+
it { should include 'cbea' }
|
372
|
+
it { should include 'cbea64' }
|
373
|
+
it { should include 'cmd' }
|
374
|
+
it { should include 'dalvik' }
|
375
|
+
it { should include 'firefox' }
|
376
|
+
it { should include 'java' }
|
377
|
+
it { should include 'mipsbe' }
|
378
|
+
it { should include 'mipsle' }
|
379
|
+
it { should include 'nodejs' }
|
380
|
+
it { should include 'php' }
|
381
|
+
it { should include 'ppc' }
|
382
|
+
it { should include 'ppc64' }
|
383
|
+
it { should include 'python' }
|
384
|
+
it { should include 'ruby' }
|
385
|
+
it { should include 'sparc' }
|
386
|
+
it { should include 'tty' }
|
387
|
+
it { should include 'x86' }
|
388
|
+
it { should include 'x86_64' }
|
389
|
+
end
|
390
|
+
|
391
|
+
context 'bits_set' do
|
392
|
+
subject(:bits_set) do
|
393
|
+
architecture_class.bits_set
|
394
|
+
end
|
395
|
+
|
396
|
+
it { should_not include nil }
|
397
|
+
it { should include 32 }
|
398
|
+
it { should include 64 }
|
399
|
+
end
|
400
|
+
|
401
|
+
context 'endianness_set' do
|
402
|
+
subject(:endianness_set) do
|
403
|
+
architecture_class.endianness_set
|
404
|
+
end
|
405
|
+
|
406
|
+
it { should_not include nil }
|
407
|
+
it { should include 'big' }
|
408
|
+
it { should include 'little' }
|
409
|
+
end
|
410
|
+
|
411
|
+
context 'family_set' do
|
412
|
+
subject(:family_set) do
|
413
|
+
architecture_class.family_set
|
414
|
+
end
|
415
|
+
|
416
|
+
it { should_not include nil }
|
417
|
+
it { should include 'arm' }
|
418
|
+
it { should include 'cbea' }
|
419
|
+
it { should include 'mips' }
|
420
|
+
it { should include 'javascript' }
|
421
|
+
it { should include 'ppc' }
|
422
|
+
it { should include 'sparc' }
|
423
|
+
it { should include 'x86' }
|
424
|
+
end
|
425
|
+
end
|