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,49 @@
|
|
1
|
+
module Metasploit
|
2
|
+
module Model
|
3
|
+
# Allows registering the class name of assocations similar to ActiveRecord associations, so that ActiveModel
|
4
|
+
# associations can be reflected with the same API as ActiveRecord associations.
|
5
|
+
module Association
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
# Defines DSL for define associations on ActiveModels with {#association}, which can then be retrieved in bulk
|
9
|
+
# with {#association_by_name} or a single association's reflection by name with {#reflect_on_association}.
|
10
|
+
module ClassMethods
|
11
|
+
# Registers an association.
|
12
|
+
#
|
13
|
+
# @param name [to_sym] Name of the association
|
14
|
+
# @param options [Hash{Symbol => String}]
|
15
|
+
# @option options [String] :class_name Name of association's class.
|
16
|
+
# @return [Metasploit::Model::Association::Reflection] the reflection of the registered association.
|
17
|
+
# @raise [Metasploit::Model::Invalid] if name is blank.
|
18
|
+
# @raise [Metasploit::Model::Invalid] if :class_name is blank.
|
19
|
+
def association(name, options={})
|
20
|
+
association = Metasploit::Model::Association::Reflection.new(
|
21
|
+
:model => self,
|
22
|
+
:name => name.to_sym,
|
23
|
+
:class_name => options[:class_name]
|
24
|
+
)
|
25
|
+
association.valid!
|
26
|
+
|
27
|
+
association_by_name[association.name] = association
|
28
|
+
end
|
29
|
+
|
30
|
+
# Associations registered with {#association}.
|
31
|
+
#
|
32
|
+
# @return [Hash{Symbol => Metasploit::Model::Association::Reflection}] Maps
|
33
|
+
# {Metasploit::Model::Association::Reflection#name} to {Metasploit::Model::Association::Reflection}.
|
34
|
+
def association_by_name
|
35
|
+
@association_by_name ||= {}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Returns reflection for association with the given name.
|
39
|
+
#
|
40
|
+
# @param name [#to_sym] name of the association whose reflection to retrieve.
|
41
|
+
# @return [nil] if no association with the given `name`.
|
42
|
+
# @return [Metasploit::Model::Association::Reflection] if association with the given `name`.
|
43
|
+
def reflect_on_association(name)
|
44
|
+
association_by_name[name.to_sym]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Metasploit
|
2
|
+
module Model
|
3
|
+
module Association
|
4
|
+
# Error raised by {Metasploit::Model::Association::ClassMethods#reflect_on_association!}.
|
5
|
+
class Error < Metasploit::Model::Error
|
6
|
+
#
|
7
|
+
# Attributes
|
8
|
+
#
|
9
|
+
|
10
|
+
# @!attribute [r] model
|
11
|
+
# ActiveModel on which the association with {#name} was not found.
|
12
|
+
#
|
13
|
+
# @return [Class]
|
14
|
+
attr_reader :model
|
15
|
+
|
16
|
+
# @!attribute [r] name
|
17
|
+
# Name of association that was not registered on {#model}.
|
18
|
+
#
|
19
|
+
# @return [Symbol]
|
20
|
+
attr_reader :name
|
21
|
+
|
22
|
+
#
|
23
|
+
# Methods
|
24
|
+
#
|
25
|
+
|
26
|
+
# @param attributes [Hash{Symbol => Object}]
|
27
|
+
# @option attributes [Class] :model ActiveModel that is missing association with :name.
|
28
|
+
# @option attributes [Symbol] :name name of the association that is missing.
|
29
|
+
# @raise [KeyError] if :model is not given
|
30
|
+
# @raise [KeyError] if :name is not given
|
31
|
+
def initialize(attributes={})
|
32
|
+
@model = attributes.fetch(:model)
|
33
|
+
@name = attributes.fetch(:name)
|
34
|
+
|
35
|
+
super("#{model} does not have #{name} association.")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Metasploit
|
2
|
+
module Model
|
3
|
+
# Code shared between `Mdm::Author` and `Metasploit::Framework::Author`.
|
4
|
+
module Author
|
5
|
+
extend ActiveModel::Naming
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
include Metasploit::Model::Translation
|
9
|
+
|
10
|
+
included do
|
11
|
+
include ActiveModel::MassAssignmentSecurity
|
12
|
+
include ActiveModel::Validations
|
13
|
+
include Metasploit::Model::Search
|
14
|
+
|
15
|
+
#
|
16
|
+
# Mass Assignment Security
|
17
|
+
#
|
18
|
+
|
19
|
+
attr_accessible :name
|
20
|
+
|
21
|
+
#
|
22
|
+
# Search Attributes
|
23
|
+
#
|
24
|
+
|
25
|
+
search_attribute :name, :type => :string
|
26
|
+
|
27
|
+
#
|
28
|
+
# Validations
|
29
|
+
#
|
30
|
+
|
31
|
+
validates :name, :presence => true
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# Associations
|
36
|
+
#
|
37
|
+
|
38
|
+
# @!attribute [r] email_addresses
|
39
|
+
# Email addresses used by this author across all {#module_instances}.
|
40
|
+
#
|
41
|
+
# @return [Array<Metasploit::Model::EmailAddress>]
|
42
|
+
|
43
|
+
# @!attribute [r] module_instances
|
44
|
+
# Modules written by this author.
|
45
|
+
#
|
46
|
+
# @return [Array<Metasploit::Model::Module::Instance>]
|
47
|
+
|
48
|
+
#
|
49
|
+
# Attributes
|
50
|
+
#
|
51
|
+
|
52
|
+
# @!attribute [rw] name
|
53
|
+
# Full name (First + Last name) or handle of author.
|
54
|
+
#
|
55
|
+
# @return [String]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
module Metasploit
|
2
|
+
module Model
|
3
|
+
# Code shared between `Mdm::Authority` and `Metasploit::Framework::Authority`.
|
4
|
+
module Authority
|
5
|
+
extend ActiveModel::Naming
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
include Metasploit::Model::Translation
|
9
|
+
|
10
|
+
included do
|
11
|
+
include ActiveModel::MassAssignmentSecurity
|
12
|
+
include ActiveModel::Validations
|
13
|
+
include Metasploit::Model::Search
|
14
|
+
|
15
|
+
#
|
16
|
+
# Mass Assignment Security
|
17
|
+
#
|
18
|
+
|
19
|
+
attr_accessible :abbreviation
|
20
|
+
attr_accessible :obsolete
|
21
|
+
attr_accessible :summary
|
22
|
+
attr_accessible :url
|
23
|
+
|
24
|
+
#
|
25
|
+
# Search Attributes
|
26
|
+
#
|
27
|
+
|
28
|
+
search_attribute :abbreviation, :type => :string
|
29
|
+
|
30
|
+
#
|
31
|
+
# Validations
|
32
|
+
#
|
33
|
+
|
34
|
+
validates :abbreviation,
|
35
|
+
:presence => true
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Associations
|
40
|
+
#
|
41
|
+
|
42
|
+
# @!attribute [rw] references
|
43
|
+
# {Metasploit::Model::Reference References} that use this authority's scheme for their
|
44
|
+
# {Metasploit::Model::Reference#authority}.
|
45
|
+
#
|
46
|
+
# @return [Array<Metasploit::Model::Reference>]
|
47
|
+
|
48
|
+
# @!attribute [r] module_instances
|
49
|
+
# {Metasploit::Model::Module::Instance Modules} that have a reference with this authority.
|
50
|
+
#
|
51
|
+
# @return [Array<Metasploit::Model::Module::Instance>]
|
52
|
+
|
53
|
+
# @!attribute [r] vulns
|
54
|
+
# Vulnerabilities that have a reference under this authority.
|
55
|
+
#
|
56
|
+
# @return [Array<Metasploit::Model::Vuln>]
|
57
|
+
|
58
|
+
#
|
59
|
+
# Attributes
|
60
|
+
#
|
61
|
+
|
62
|
+
# @!attribute [rw] abbreviation
|
63
|
+
# Abbreviation or initialism for authority, such as CVE for 'Common Vulnerability and Exposures'.
|
64
|
+
#
|
65
|
+
# @return [String]
|
66
|
+
|
67
|
+
# @!attribute [rw] obsolete
|
68
|
+
# Whether this authority is obsolete and no longer exists on the internet.
|
69
|
+
#
|
70
|
+
# @return [false]
|
71
|
+
# @return [true] {#url} may be `nil` because authory no longer has a web site.
|
72
|
+
|
73
|
+
# @!attribute [rw] summary
|
74
|
+
# An expansion of the {#abbreviation}.
|
75
|
+
#
|
76
|
+
# @return [String, nil]
|
77
|
+
|
78
|
+
# @!attribute [rw] url
|
79
|
+
# URL to the authority's home page or root URL for their {#references} database.
|
80
|
+
#
|
81
|
+
# @return [String, nil]
|
82
|
+
|
83
|
+
#
|
84
|
+
# Instance Methods
|
85
|
+
#
|
86
|
+
|
87
|
+
# Returns the {Metasploit::Model::Reference#url URL} for a {Metasploit::Model::Reference#designation designation}.
|
88
|
+
#
|
89
|
+
# @param designation [String] {Metasploit::Model::Reference#designation}.
|
90
|
+
# @return [String] {Metasploit::Model::Reference#url}
|
91
|
+
# @return [nil] if this {Metasploit::Model::Authority} is {#obsolete}.
|
92
|
+
# @return [nil] if this {Metasploit::Model::Authority} does have a way to derive URLS from designations.
|
93
|
+
def designation_url(designation)
|
94
|
+
url = nil
|
95
|
+
|
96
|
+
if extension
|
97
|
+
url = extension.designation_url(designation)
|
98
|
+
end
|
99
|
+
|
100
|
+
url
|
101
|
+
end
|
102
|
+
|
103
|
+
# Returns module that include authority specific methods.
|
104
|
+
#
|
105
|
+
# @return [Module] if {#abbreviation} has a corresponding module under the Metasploit::Model::Authority namespace.
|
106
|
+
# @return [nil] otherwise.
|
107
|
+
def extension
|
108
|
+
begin
|
109
|
+
extension_name.constantize
|
110
|
+
rescue NameError
|
111
|
+
nil
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Returns name of module that includes authority specific methods.
|
116
|
+
#
|
117
|
+
# @return [String] unless {#abbreviation} is blank.
|
118
|
+
# @return [nil] if {#abbreviation} is blank.
|
119
|
+
def extension_name
|
120
|
+
extension_name = nil
|
121
|
+
|
122
|
+
unless abbreviation.blank?
|
123
|
+
# underscore before camelize to eliminate -'s
|
124
|
+
relative_model_name = abbreviation.underscore.camelize
|
125
|
+
# don't scope to self.class.name so that authority extension are always resolved the same in Mdm and
|
126
|
+
# Metasploit::Framework.
|
127
|
+
extension_name = "Metasploit::Model::Authority::#{relative_model_name}"
|
128
|
+
end
|
129
|
+
|
130
|
+
extension_name
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# BugTraq ID authority-specific code.
|
2
|
+
module Metasploit::Model::Authority::Bid
|
3
|
+
# Returns URL to {Metasploit::Model::Reference#designation BugTraq ID's} page on SecurityFocus' site.
|
4
|
+
#
|
5
|
+
# @param designation [String] N+ BugTraq ID.
|
6
|
+
# @return [String] URL
|
7
|
+
def self.designation_url(designation)
|
8
|
+
"http://www.securityfocus.com/bid/#{designation}"
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Common Vulnerabilities and Exposures authority-specific code.
|
2
|
+
module Metasploit::Model::Authority::Cve
|
3
|
+
# Returns URL to {Metasploit::Model::Reference#designation the CVE ID's} page on CVE Details.
|
4
|
+
#
|
5
|
+
# @param designation [String] YYYY-NNNN CVE ID.
|
6
|
+
# @return [String] URL
|
7
|
+
def self.designation_url(designation)
|
8
|
+
"http://cvedetails.com/cve/CVE-#{designation}"
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Microsoft Security Bulletin authority-specific code.
|
2
|
+
module Metasploit::Model::Authority::Msb
|
3
|
+
# Returns URL to {Metasploit::Model::Reference#designation the security bulletin's} page on Technet.
|
4
|
+
#
|
5
|
+
# @param designation [String] MSYY-NNN Security Bulletin ID.
|
6
|
+
# @return [String] URL
|
7
|
+
def self.designation_url(designation)
|
8
|
+
"http://www.microsoft.com/technet/security/bulletin/#{designation}"
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Open Sourced Vulnerability Database authority-specific code.
|
2
|
+
module Metasploit::Model::Authority::Osvdb
|
3
|
+
# Returns URL to {Metasploit::Model::Reference#designation OSVDB ID's} page.
|
4
|
+
#
|
5
|
+
# @param designation [String] N+ OSVDB ID.
|
6
|
+
# @return [String] URL
|
7
|
+
def self.designation_url(designation)
|
8
|
+
"http://www.osvdb.org/#{designation}/"
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# phpMyAdmin Security Announcement authority-specific code.
|
2
|
+
module Metasploit::Model::Authority::Pmasa
|
3
|
+
# Returns URL to {Metasploit::Model::Reference#designation phpMyAdmin Security Advisory's} page on phpMyAdmin's site.
|
4
|
+
#
|
5
|
+
# @param designation [String] YYYY-N phpMyAdmin Security Advisory ID.
|
6
|
+
# @return [String] URL
|
7
|
+
def self.designation_url(designation)
|
8
|
+
"http://www.phpmyadmin.net/home_page/security/PMASA-#{designation}.php"
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Secunia authority-specific code.
|
2
|
+
module Metasploit::Model::Authority::Secunia
|
3
|
+
# Returns URL to {Metasploit::Model::Reference#designation Secunia Advisory ID's} page on Secunia.
|
4
|
+
#
|
5
|
+
# @param designation [String] NNNNN Secunia Advisory ID.
|
6
|
+
# @return [String] URL
|
7
|
+
def self.designation_url(designation)
|
8
|
+
"https://secunia.com/advisories/#{designation}/"
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# United States Computer Emergency Readiness Team Vulnerability Notes Database authority-specific code.
|
2
|
+
module Metasploit::Model::Authority::UsCertVu
|
3
|
+
# Returns URL to {Metasploit::Model::Reference#designation Vul ID's} page on US CERT Notes Database.
|
4
|
+
#
|
5
|
+
# @param designation [String] N US CERT ID.
|
6
|
+
# @return [String] URL
|
7
|
+
def self.designation_url(designation)
|
8
|
+
"http://www.kb.cert.org/vuls/id/#{designation}"
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Waraxe authority-specific code.
|
2
|
+
module Metasploit::Model::Authority::Waraxe
|
3
|
+
#
|
4
|
+
# CONSTANTS
|
5
|
+
#
|
6
|
+
|
7
|
+
# Regular expression for breaking up designation into year and number
|
8
|
+
DESIGNATION_REGEXP = /\A(?<year>\d+)-SA#(?<number>\d+)\Z/
|
9
|
+
|
10
|
+
#
|
11
|
+
# Methods
|
12
|
+
#
|
13
|
+
|
14
|
+
# Returns URL to {Metasploit::Model::Reference#designation Waraxe Security Advisory's} page on Waraxe's site.
|
15
|
+
#
|
16
|
+
# @param designation [String] YYYY-SA#N+ Waraxe fully-qualified ID.
|
17
|
+
# @return [String] URL
|
18
|
+
# @return [nil] if designation does not match {DESIGNATION_REGEXP}.
|
19
|
+
def self.designation_url(designation)
|
20
|
+
match = DESIGNATION_REGEXP.match(designation)
|
21
|
+
url = nil
|
22
|
+
|
23
|
+
if match
|
24
|
+
number = match[:number]
|
25
|
+
|
26
|
+
url = "http://www.waraxe.us/advisory-#{number}.html"
|
27
|
+
end
|
28
|
+
|
29
|
+
url
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Zero Day Initiative authority-specific code.
|
2
|
+
module Metasploit::Model::Authority::Zdi
|
3
|
+
# Returns URL to {Metasploit::Model::Reference#designation the ZDI ID's} page on ZDI.
|
4
|
+
#
|
5
|
+
# @param designation [String] YY-NNNN ZDI ID.
|
6
|
+
# @return [String] URL
|
7
|
+
def self.designation_url(designation)
|
8
|
+
"http://www.zerodayinitiative.com/advisories/ZDI-#{designation}"
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Superclass for all Metasploit::Models. Just adds a default {#initialize} to make models mimic behavior of
|
2
|
+
# ActiveRecord::Base subclasses.
|
3
|
+
class Metasploit::Model::Base
|
4
|
+
include ActiveModel::Validations
|
5
|
+
|
6
|
+
# After ActiveModel::Validations so Metasploit::Model::Translation is favored over ActiveModel::Translation
|
7
|
+
include Metasploit::Model::Translation
|
8
|
+
|
9
|
+
# @param attributes [Hash{Symbol => String,nil}]
|
10
|
+
def initialize(attributes={})
|
11
|
+
attributes.each do |attribute, value|
|
12
|
+
public_send("#{attribute}=", value)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Validates the model.
|
17
|
+
#
|
18
|
+
# @return [void]
|
19
|
+
# @raise [Metasploit::Model::Invalid] if invalid
|
20
|
+
def valid!
|
21
|
+
unless valid?
|
22
|
+
raise Metasploit::Model::Invalid.new(self)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# @note This can't be a model in app/models because it is used to setup the autoload_path to app/models.
|
2
|
+
#
|
3
|
+
# Configuration for a gem's autoload and i18n load paths that works outside of the railties or rails engines systems.
|
4
|
+
class Metasploit::Model::Configuration
|
5
|
+
# no autoload paths yet, so have to explicitly require
|
6
|
+
require 'metasploit/model/configuration/parent'
|
7
|
+
extend Metasploit::Model::Configuration::Parent
|
8
|
+
|
9
|
+
#
|
10
|
+
# Attributes
|
11
|
+
#
|
12
|
+
|
13
|
+
# @!attribute [rw] root
|
14
|
+
# The root of the gem. All relative paths are resolved relative to {#root}.
|
15
|
+
#
|
16
|
+
# @return [Pathname]
|
17
|
+
|
18
|
+
#
|
19
|
+
# Children
|
20
|
+
#
|
21
|
+
|
22
|
+
# @!macro [attach] child
|
23
|
+
# @!attribute [rw] $1_class
|
24
|
+
# The `Class` used to create {#$1}.
|
25
|
+
#
|
26
|
+
# @return [Class]
|
27
|
+
#
|
28
|
+
# @!method $1
|
29
|
+
# The $1 configuration.
|
30
|
+
#
|
31
|
+
# @return [Object] an instance of {#$1_class}
|
32
|
+
#
|
33
|
+
# @!method $1_class
|
34
|
+
# The `Class` used to create {#$1}.
|
35
|
+
#
|
36
|
+
# @return [Class]
|
37
|
+
child :autoload
|
38
|
+
child :i18n
|
39
|
+
|
40
|
+
#
|
41
|
+
# Methods
|
42
|
+
#
|
43
|
+
|
44
|
+
# The root of the gem.
|
45
|
+
#
|
46
|
+
# @return [Pathname] root of gem
|
47
|
+
# @raise [Metasploit::Model::Configuration::Error] if {#root=} is not called prior to calling {#root}.
|
48
|
+
def root
|
49
|
+
unless instance_variable_defined?(:@root)
|
50
|
+
raise Metasploit::Model::Configuration::Error, "#{self.class}.root not set prior to use"
|
51
|
+
end
|
52
|
+
|
53
|
+
@root
|
54
|
+
end
|
55
|
+
|
56
|
+
# Sets root of this gem.
|
57
|
+
#
|
58
|
+
# @param root [Pathname, String]
|
59
|
+
# @return [String]
|
60
|
+
def root=(root)
|
61
|
+
@root = Pathname.new root
|
62
|
+
end
|
63
|
+
|
64
|
+
# Sets up {#autoload} and {#i18n}
|
65
|
+
#
|
66
|
+
# @return [void]
|
67
|
+
# @raise [Metasploit::Model::Invalid] if {#configuration} {Metasploit::Model::Configuration#root} is not set.
|
68
|
+
def setup
|
69
|
+
autoload.setup
|
70
|
+
i18n.setup
|
71
|
+
end
|
72
|
+
end
|