wg-metasploit_data_models 4.1.4.01 → 4.1.4.02
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.github/workflows/verify.yml +68 -0
- data/.gitignore +29 -0
- data/.rspec +3 -0
- data/.simplecov +38 -0
- data/.yardopts +4 -0
- data/CHANGELOG.md +6 -0
- data/CONTRIBUTING.md +133 -0
- data/Gemfile +46 -0
- data/LICENSE +27 -0
- data/README.md +65 -0
- data/RELEASING.md +82 -0
- data/Rakefile +72 -0
- data/UPGRADING.md +1 -0
- data/app/models/mdm/api_key.rb +61 -0
- data/app/models/mdm/async_callback.rb +64 -0
- data/app/models/mdm/client.rb +50 -0
- data/app/models/mdm/cred.rb +205 -0
- data/app/models/mdm/event.rb +83 -0
- data/app/models/mdm/exploit_attempt.rb +105 -0
- data/app/models/mdm/exploited_host.rb +42 -0
- data/app/models/mdm/host.rb +619 -0
- data/app/models/mdm/host_detail.rb +62 -0
- data/app/models/mdm/host_tag.rb +49 -0
- data/app/models/mdm/listener.rb +82 -0
- data/app/models/mdm/loot.rb +161 -0
- data/app/models/mdm/macro.rb +62 -0
- data/app/models/mdm/mod_ref.rb +24 -0
- data/app/models/mdm/module/action.rb +33 -0
- data/app/models/mdm/module/arch.rb +28 -0
- data/app/models/mdm/module/author.rb +34 -0
- data/app/models/mdm/module/detail.rb +388 -0
- data/app/models/mdm/module/mixin.rb +31 -0
- data/app/models/mdm/module/platform.rb +29 -0
- data/app/models/mdm/module/ref.rb +42 -0
- data/app/models/mdm/module/target.rb +37 -0
- data/app/models/mdm/nexpose_console.rb +121 -0
- data/app/models/mdm/note.rb +125 -0
- data/app/models/mdm/payload.rb +103 -0
- data/app/models/mdm/profile.rb +45 -0
- data/app/models/mdm/ref.rb +48 -0
- data/app/models/mdm/route.rb +28 -0
- data/app/models/mdm/service.rb +267 -0
- data/app/models/mdm/session.rb +203 -0
- data/app/models/mdm/session_event.rb +44 -0
- data/app/models/mdm/tag.rb +114 -0
- data/app/models/mdm/task.rb +168 -0
- data/app/models/mdm/task_cred.rb +45 -0
- data/app/models/mdm/task_host.rb +41 -0
- data/app/models/mdm/task_service.rb +41 -0
- data/app/models/mdm/task_session.rb +41 -0
- data/app/models/mdm/user.rb +230 -0
- data/app/models/mdm/vuln.rb +204 -0
- data/app/models/mdm/vuln_attempt.rb +76 -0
- data/app/models/mdm/vuln_detail.rb +156 -0
- data/app/models/mdm/vuln_ref.rb +21 -0
- data/app/models/mdm/web_form.rb +53 -0
- data/app/models/mdm/web_page.rb +92 -0
- data/app/models/mdm/web_site.rb +113 -0
- data/app/models/mdm/web_vuln.rb +193 -0
- data/app/models/mdm/wmap_request.rb +101 -0
- data/app/models/mdm/wmap_target.rb +56 -0
- data/app/models/mdm/workspace.rb +286 -0
- data/app/models/metasploit_data_models/automatic_exploitation/match.rb +43 -0
- data/app/models/metasploit_data_models/automatic_exploitation/match_result.rb +71 -0
- data/app/models/metasploit_data_models/automatic_exploitation/match_set.rb +40 -0
- data/app/models/metasploit_data_models/automatic_exploitation/run.rb +29 -0
- data/app/models/metasploit_data_models/ip_address/v4/cidr.rb +14 -0
- data/app/models/metasploit_data_models/ip_address/v4/nmap.rb +14 -0
- data/app/models/metasploit_data_models/ip_address/v4/range.rb +12 -0
- data/app/models/metasploit_data_models/ip_address/v4/segment/nmap/list.rb +125 -0
- data/app/models/metasploit_data_models/ip_address/v4/segment/nmap/range.rb +12 -0
- data/app/models/metasploit_data_models/ip_address/v4/segment/single.rb +123 -0
- data/app/models/metasploit_data_models/ip_address/v4/segmented.rb +200 -0
- data/app/models/metasploit_data_models/ip_address/v4/single.rb +53 -0
- data/app/models/metasploit_data_models/module_run.rb +213 -0
- data/app/models/metasploit_data_models/search/operation/ip_address.rb +60 -0
- data/app/models/metasploit_data_models/search/operation/port/number.rb +25 -0
- data/app/models/metasploit_data_models/search/operation/port/range.rb +79 -0
- data/app/models/metasploit_data_models/search/operation/range.rb +56 -0
- data/app/models/metasploit_data_models/search/operator/ip_address.rb +33 -0
- data/app/models/metasploit_data_models/search/operator/multitext.rb +73 -0
- data/app/models/metasploit_data_models/search/operator/port/list.rb +67 -0
- data/app/models/metasploit_data_models/search/visitor/attribute.rb +17 -0
- data/app/models/metasploit_data_models/search/visitor/includes.rb +47 -0
- data/app/models/metasploit_data_models/search/visitor/joins.rb +67 -0
- data/app/models/metasploit_data_models/search/visitor/method.rb +16 -0
- data/app/models/metasploit_data_models/search/visitor/relation.rb +91 -0
- data/app/models/metasploit_data_models/search/visitor/where.rb +128 -0
- data/config/initializers/arel_helper.rb +5 -0
- data/config/initializers/ipaddr.rb +29 -0
- data/config/locales/en.yml +94 -0
- data/console_db.yml +9 -0
- data/db/migrate/000_create_tables.rb +79 -0
- data/db/migrate/001_add_wmap_tables.rb +35 -0
- data/db/migrate/002_add_workspaces.rb +36 -0
- data/db/migrate/003_move_notes.rb +20 -0
- data/db/migrate/004_add_events_table.rb +16 -0
- data/db/migrate/005_expand_info.rb +58 -0
- data/db/migrate/006_add_timestamps.rb +26 -0
- data/db/migrate/007_add_loots.rb +20 -0
- data/db/migrate/008_create_users.rb +16 -0
- data/db/migrate/009_add_loots_ctype.rb +10 -0
- data/db/migrate/010_add_alert_fields.rb +16 -0
- data/db/migrate/011_add_reports.rb +19 -0
- data/db/migrate/012_add_tasks.rb +24 -0
- data/db/migrate/013_add_tasks_result.rb +10 -0
- data/db/migrate/014_add_loots_fields.rb +12 -0
- data/db/migrate/015_rename_user.rb +16 -0
- data/db/migrate/016_add_host_purpose.rb +10 -0
- data/db/migrate/017_expand_info2.rb +58 -0
- data/db/migrate/018_add_workspace_user_info.rb +29 -0
- data/db/migrate/019_add_workspace_desc.rb +23 -0
- data/db/migrate/020_add_user_preferences.rb +11 -0
- data/db/migrate/021_standardize_info_and_data.rb +18 -0
- data/db/migrate/022_enlarge_event_info.rb +10 -0
- data/db/migrate/023_add_report_downloaded_at.rb +10 -0
- data/db/migrate/024_convert_service_info_to_text.rb +12 -0
- data/db/migrate/025_add_user_admin.rb +19 -0
- data/db/migrate/026_add_creds_table.rb +19 -0
- data/db/migrate/20100819123300_migrate_cred_data.rb +154 -0
- data/db/migrate/20100824151500_add_exploited_table.rb +16 -0
- data/db/migrate/20100908001428_add_owner_to_workspaces.rb +9 -0
- data/db/migrate/20100911122000_add_report_templates.rb +18 -0
- data/db/migrate/20100916151530_require_admin_flag.rb +15 -0
- data/db/migrate/20100916175000_add_campaigns_and_templates.rb +61 -0
- data/db/migrate/20100920012100_add_generate_exe_column.rb +8 -0
- data/db/migrate/20100926214000_add_template_prefs.rb +11 -0
- data/db/migrate/20101001000000_add_web_tables.rb +57 -0
- data/db/migrate/20101002000000_add_query.rb +10 -0
- data/db/migrate/20101007000000_add_vuln_info.rb +15 -0
- data/db/migrate/20101008111800_add_clients_to_campaigns.rb +10 -0
- data/db/migrate/20101009023300_add_campaign_attachments.rb +15 -0
- data/db/migrate/20101104135100_add_imported_creds.rb +17 -0
- data/db/migrate/20101203000000_fix_web_tables.rb +34 -0
- data/db/migrate/20101203000001_expand_host_comment.rb +12 -0
- data/db/migrate/20101206212033_add_limit_to_network_to_workspaces.rb +9 -0
- data/db/migrate/20110112154300_add_module_uuid_to_tasks.rb +9 -0
- data/db/migrate/20110204112800_add_host_tags.rb +28 -0
- data/db/migrate/20110317144932_add_session_table.rb +110 -0
- data/db/migrate/20110414180600_add_local_id_to_session_table.rb +11 -0
- data/db/migrate/20110415175705_add_routes_table.rb +18 -0
- data/db/migrate/20110422000000_convert_binary.rb +73 -0
- data/db/migrate/20110425095900_add_last_seen_to_sessions.rb +8 -0
- data/db/migrate/20110513143900_track_successful_exploits.rb +31 -0
- data/db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb +26 -0
- data/db/migrate/20110527000000_add_task_id_to_reports_table.rb +11 -0
- data/db/migrate/20110527000001_add_api_keys_table.rb +12 -0
- data/db/migrate/20110606000001_add_macros_table.rb +16 -0
- data/db/migrate/20110622000000_add_settings_to_tasks_table.rb +12 -0
- data/db/migrate/20110624000001_add_listeners_table.rb +19 -0
- data/db/migrate/20110625000001_add_macro_to_listeners_table.rb +12 -0
- data/db/migrate/20110630000001_add_nexpose_consoles_table.rb +21 -0
- data/db/migrate/20110630000002_add_name_to_nexpose_consoles_table.rb +12 -0
- data/db/migrate/20110717000001_add_profiles_table.rb +15 -0
- data/db/migrate/20110727163801_expand_cred_ptype_column.rb +9 -0
- data/db/migrate/20110730000001_add_initial_indexes.rb +85 -0
- data/db/migrate/20110812000001_prune_indexes.rb +23 -0
- data/db/migrate/20110922000000_expand_notes.rb +9 -0
- data/db/migrate/20110928101300_add_mod_ref_table.rb +17 -0
- data/db/migrate/20111011110000_add_display_name_to_reports_table.rb +24 -0
- data/db/migrate/20111203000000_inet_columns.rb +13 -0
- data/db/migrate/20111204000000_more_inet_columns.rb +17 -0
- data/db/migrate/20111210000000_add_scope_to_hosts.rb +9 -0
- data/db/migrate/20120126110000_add_virtual_host_to_hosts.rb +9 -0
- data/db/migrate/20120411173220_rename_workspace_members.rb +9 -0
- data/db/migrate/20120601152442_add_counter_caches_to_hosts.rb +21 -0
- data/db/migrate/20120625000000_add_vuln_details.rb +34 -0
- data/db/migrate/20120625000001_add_host_details.rb +16 -0
- data/db/migrate/20120625000002_expand_details.rb +16 -0
- data/db/migrate/20120625000003_expand_details2.rb +24 -0
- data/db/migrate/20120625000004_add_vuln_attempts.rb +19 -0
- data/db/migrate/20120625000005_add_vuln_and_host_counter_caches.rb +14 -0
- data/db/migrate/20120625000006_add_module_details.rb +118 -0
- data/db/migrate/20120625000007_add_exploit_attempts.rb +26 -0
- data/db/migrate/20120625000008_add_fail_message.rb +12 -0
- data/db/migrate/20120718202805_add_owner_and_payload_to_web_vulns.rb +13 -0
- data/db/migrate/20130228214900_change_required_columns_to_null_false_in_web_vulns.rb +19 -0
- data/db/migrate/20130412154159_change_foreign_key_in_module_actions.rb +25 -0
- data/db/migrate/20130412171844_change_foreign_key_in_module_archs.rb +25 -0
- data/db/migrate/20130412173121_change_foreign_key_in_module_authors.rb +25 -0
- data/db/migrate/20130412173640_change_foreign_key_in_module_mixins.rb +25 -0
- data/db/migrate/20130412174254_change_foreign_key_in_module_platforms.rb +25 -0
- data/db/migrate/20130412174719_change_foreign_key_in_module_refs.rb +25 -0
- data/db/migrate/20130412175040_change_foreign_key_in_module_targets.rb +25 -0
- data/db/migrate/20130423211152_add_creds_counter_cache.rb +24 -0
- data/db/migrate/20130430151353_change_required_columns_to_null_false_in_hosts.rb +11 -0
- data/db/migrate/20130430162145_enforce_address_uniqueness_in_workspace_in_hosts.rb +101 -0
- data/db/migrate/20130510021637_remove_campaigns.rb +11 -0
- data/db/migrate/20130515164311_change_web_vulns_confidence_to_integer.rb +48 -0
- data/db/migrate/20130515172727_valid_mdm_web_vuln_params.rb +30 -0
- data/db/migrate/20130516204810_making_vulns_refs_a_real_ar_model.rb +5 -0
- data/db/migrate/20130522001343_create_task_creds.rb +9 -0
- data/db/migrate/20130522032517_create_task_hosts.rb +9 -0
- data/db/migrate/20130522041110_create_task_services.rb +9 -0
- data/db/migrate/20130525015035_remove_campaign_id_from_clients.rb +9 -0
- data/db/migrate/20130525212420_drop_table_imported_creds.rb +14 -0
- data/db/migrate/20130531144949_making_host_tags_a_real_ar_model.rb +6 -0
- data/db/migrate/20130604145732_create_task_sessions.rb +9 -0
- data/db/migrate/20130717150737_remove_pname_validation.rb +7 -0
- data/db/migrate/20131002004641_create_automatic_exploitation_matches.rb +13 -0
- data/db/migrate/20131002164449_create_automatic_exploitation_match_sets.rb +12 -0
- data/db/migrate/20131008213344_create_automatic_exploitation_runs.rb +11 -0
- data/db/migrate/20131011184338_module_detail_on_automatic_exploitation_match.rb +10 -0
- data/db/migrate/20131017150735_create_automatic_exploitation_match_results.rb +11 -0
- data/db/migrate/20131021185657_make_match_polymorphic.rb +11 -0
- data/db/migrate/20140905031549_add_detected_arch_to_host.rb +5 -0
- data/db/migrate/20150112203945_remove_duplicate_services.rb +17 -0
- data/db/migrate/20150205192745_drop_service_uniqueness_index.rb +5 -0
- data/db/migrate/20150209195939_add_vuln_id_to_note.rb +6 -0
- data/db/migrate/20150212214222_remove_duplicate_services2.rb +17 -0
- data/db/migrate/20150219173821_create_module_runs.rb +23 -0
- data/db/migrate/20150219215039_add_module_run_to_session.rb +8 -0
- data/db/migrate/20150226151459_add_module_run_fk_to_loot.rb +8 -0
- data/db/migrate/20150312155312_add_module_full_name_to_match.rb +6 -0
- data/db/migrate/20150317145455_rename_module_indices.rb +29 -0
- data/db/migrate/20150326183742_add_missing_ae_indices.rb +13 -0
- data/db/migrate/20150421211719_rename_automatic_exploitation_index.rb +16 -0
- data/db/migrate/20150514182921_add_origin_to_mdm_vuln.rb +13 -0
- data/db/migrate/20160415153312_remove_not_null_from_web_vuln_p_arams.rb +5 -0
- data/db/migrate/20161004165612_add_fingerprinted_to_workspace.rb +5 -0
- data/db/migrate/20161227212223_add_os_family_to_hosts.rb +5 -0
- data/db/migrate/20180904120211_create_payloads.rb +21 -0
- data/db/migrate/20190308134512_create_async_callbacks.rb +13 -0
- data/db/migrate/20190507120211_remove_payload_workspaces.rb +5 -0
- data/lib/mdm/host/operating_system_normalization.rb +942 -0
- data/lib/mdm/module.rb +13 -0
- data/lib/mdm.rb +57 -0
- data/lib/metasploit_data_models/automatic_exploitation.rb +25 -0
- data/lib/metasploit_data_models/base64_serializer.rb +99 -0
- data/lib/metasploit_data_models/change_required_columns_to_null_false.rb +21 -0
- data/lib/metasploit_data_models/engine.rb +32 -0
- data/lib/metasploit_data_models/ip_address/cidr.rb +174 -0
- data/lib/metasploit_data_models/ip_address/range.rb +181 -0
- data/lib/metasploit_data_models/ip_address/v4/segment/nmap.rb +7 -0
- data/lib/metasploit_data_models/ip_address/v4/segment.rb +7 -0
- data/lib/metasploit_data_models/ip_address/v4.rb +11 -0
- data/lib/metasploit_data_models/ip_address.rb +9 -0
- data/lib/metasploit_data_models/match/child.rb +48 -0
- data/lib/metasploit_data_models/match/parent.rb +103 -0
- data/lib/metasploit_data_models/match.rb +8 -0
- data/lib/metasploit_data_models/search/operation/port.rb +9 -0
- data/lib/metasploit_data_models/search/operation.rb +9 -0
- data/lib/metasploit_data_models/search/operator/port.rb +6 -0
- data/lib/metasploit_data_models/search/operator.rb +8 -0
- data/lib/metasploit_data_models/search/visitor.rb +11 -0
- data/lib/metasploit_data_models/search.rb +8 -0
- data/lib/metasploit_data_models/serialized_prefs.rb +27 -0
- data/lib/metasploit_data_models/version.rb +13 -0
- data/lib/metasploit_data_models.rb +56 -0
- data/metasploit_data_models.gemspec +65 -0
- data/script/rails +8 -0
- data/spec/app/models/mdm/api_key_spec.rb +3 -0
- data/spec/app/models/mdm/client_spec.rb +43 -0
- data/spec/app/models/mdm/cred_spec.rb +346 -0
- data/spec/app/models/mdm/event_spec.rb +90 -0
- data/spec/app/models/mdm/exploit_attempt_spec.rb +59 -0
- data/spec/app/models/mdm/exploited_host_spec.rb +44 -0
- data/spec/app/models/mdm/host_detail_spec.rb +48 -0
- data/spec/app/models/mdm/host_spec.rb +1139 -0
- data/spec/app/models/mdm/host_tag_spec.rb +69 -0
- data/spec/app/models/mdm/listener_spec.rb +107 -0
- data/spec/app/models/mdm/loot_spec.rb +84 -0
- data/spec/app/models/mdm/macro_spec.rb +3 -0
- data/spec/app/models/mdm/mod_ref_spec.rb +3 -0
- data/spec/app/models/mdm/module/action_spec.rb +34 -0
- data/spec/app/models/mdm/module/arch_spec.rb +34 -0
- data/spec/app/models/mdm/module/author_spec.rb +52 -0
- data/spec/app/models/mdm/module/detail_spec.rb +746 -0
- data/spec/app/models/mdm/module/mixin_spec.rb +34 -0
- data/spec/app/models/mdm/module/platform_spec.rb +34 -0
- data/spec/app/models/mdm/module/ref_spec.rb +58 -0
- data/spec/app/models/mdm/module/target_spec.rb +36 -0
- data/spec/app/models/mdm/nexpose_console_spec.rb +146 -0
- data/spec/app/models/mdm/note_spec.rb +91 -0
- data/spec/app/models/mdm/profile_spec.rb +3 -0
- data/spec/app/models/mdm/ref_spec.rb +71 -0
- data/spec/app/models/mdm/route_spec.rb +35 -0
- data/spec/app/models/mdm/service_spec.rb +232 -0
- data/spec/app/models/mdm/session_event_spec.rb +42 -0
- data/spec/app/models/mdm/session_spec.rb +118 -0
- data/spec/app/models/mdm/tag_spec.rb +116 -0
- data/spec/app/models/mdm/task_cred_spec.rb +51 -0
- data/spec/app/models/mdm/task_host_spec.rb +50 -0
- data/spec/app/models/mdm/task_service_spec.rb +50 -0
- data/spec/app/models/mdm/task_session_spec.rb +46 -0
- data/spec/app/models/mdm/task_spec.rb +71 -0
- data/spec/app/models/mdm/user_spec.rb +50 -0
- data/spec/app/models/mdm/vuln_attempt_spec.rb +53 -0
- data/spec/app/models/mdm/vuln_detail_spec.rb +65 -0
- data/spec/app/models/mdm/vuln_ref_spec.rb +46 -0
- data/spec/app/models/mdm/vuln_spec.rb +299 -0
- data/spec/app/models/mdm/web_form_spec.rb +46 -0
- data/spec/app/models/mdm/web_page_spec.rb +101 -0
- data/spec/app/models/mdm/web_site_spec.rb +85 -0
- data/spec/app/models/mdm/web_vuln_spec.rb +312 -0
- data/spec/app/models/mdm/wmap_request_spec.rb +5 -0
- data/spec/app/models/mdm/wmap_target_spec.rb +5 -0
- data/spec/app/models/mdm/workspace_spec.rb +500 -0
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +86 -0
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +46 -0
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +37 -0
- data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +38 -0
- data/spec/app/models/metasploit_data_models/ip_address/v4/cidr_spec.rb +119 -0
- data/spec/app/models/metasploit_data_models/ip_address/v4/nmap_spec.rb +149 -0
- data/spec/app/models/metasploit_data_models/ip_address/v4/range_spec.rb +298 -0
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/list_spec.rb +276 -0
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/range_spec.rb +302 -0
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/segmented_spec.rb +27 -0
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/single_spec.rb +324 -0
- data/spec/app/models/metasploit_data_models/ip_address/v4/single_spec.rb +181 -0
- data/spec/app/models/metasploit_data_models/module_run_spec.rb +134 -0
- data/spec/app/models/metasploit_data_models/search/operation/ip_address_spec.rb +180 -0
- data/spec/app/models/metasploit_data_models/search/operation/port/number_spec.rb +39 -0
- data/spec/app/models/metasploit_data_models/search/operation/port/range_spec.rb +138 -0
- data/spec/app/models/metasploit_data_models/search/operation/range_spec.rb +233 -0
- data/spec/app/models/metasploit_data_models/search/operator/ip_address_spec.rb +17 -0
- data/spec/app/models/metasploit_data_models/search/operator/multitext_spec.rb +160 -0
- data/spec/app/models/metasploit_data_models/search/operator/port/list_spec.rb +162 -0
- data/spec/app/models/metasploit_data_models/search/visitor/attribute_spec.rb +96 -0
- data/spec/app/models/metasploit_data_models/search/visitor/includes_spec.rb +175 -0
- data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +396 -0
- data/spec/app/models/metasploit_data_models/search/visitor/method_spec.rb +49 -0
- data/spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb +925 -0
- data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +187 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/config/manifest.js +1 -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/.gitkeep +0 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +61 -0
- data/spec/dummy/config/boot.rb +4 -0
- data/spec/dummy/config/database.yml.example +22 -0
- data/spec/dummy/config/database.yml.github_actions +21 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +78 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/active_record_migrations.rb +4 -0
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/structure.sql +3430 -0
- data/spec/dummy/db/structure.sql.from_rails_3 +3403 -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/factories/mdm/addresses.rb +12 -0
- data/spec/factories/mdm/clients.rb +8 -0
- data/spec/factories/mdm/creds.rb +17 -0
- data/spec/factories/mdm/events.rb +15 -0
- data/spec/factories/mdm/exploit_attempts.rb +8 -0
- data/spec/factories/mdm/exploited_hosts.rb +7 -0
- data/spec/factories/mdm/fingerprints/nessus_fingerprints.rb +6 -0
- data/spec/factories/mdm/fingerprints/nexpose_fingerprints.rb +6 -0
- data/spec/factories/mdm/fingerprints/nmap_fingerprints.rb +6 -0
- data/spec/factories/mdm/fingerprints/retina_fingerprints.rb +6 -0
- data/spec/factories/mdm/fingerprints/session_fingerprints.rb +6 -0
- data/spec/factories/mdm/host_details.rb +8 -0
- data/spec/factories/mdm/host_tags.rb +9 -0
- data/spec/factories/mdm/hosts.rb +85 -0
- data/spec/factories/mdm/listeners.rb +12 -0
- data/spec/factories/mdm/loots.rb +11 -0
- data/spec/factories/mdm/module/actions.rb +14 -0
- data/spec/factories/mdm/module/archs.rb +14 -0
- data/spec/factories/mdm/module/authors.rb +22 -0
- data/spec/factories/mdm/module/details.rb +73 -0
- data/spec/factories/mdm/module/mixins.rb +14 -0
- data/spec/factories/mdm/module/platforms.rb +14 -0
- data/spec/factories/mdm/module/refs.rb +14 -0
- data/spec/factories/mdm/module/targets.rb +19 -0
- data/spec/factories/mdm/nexpose_consoles.rb +15 -0
- data/spec/factories/mdm/notes.rb +12 -0
- data/spec/factories/mdm/refs.rb +9 -0
- data/spec/factories/mdm/routes.rb +36 -0
- data/spec/factories/mdm/services.rb +41 -0
- data/spec/factories/mdm/session_events.rb +8 -0
- data/spec/factories/mdm/sessions.rb +13 -0
- data/spec/factories/mdm/tags.rb +14 -0
- data/spec/factories/mdm/task.rb +16 -0
- data/spec/factories/mdm/task_creds.rb +9 -0
- data/spec/factories/mdm/task_hosts.rb +9 -0
- data/spec/factories/mdm/task_services.rb +8 -0
- data/spec/factories/mdm/task_sessions.rb +8 -0
- data/spec/factories/mdm/users.rb +22 -0
- data/spec/factories/mdm/vuln_attempts.rb +8 -0
- data/spec/factories/mdm/vuln_details.rb +8 -0
- data/spec/factories/mdm/vuln_refs.rb +4 -0
- data/spec/factories/mdm/vulns.rb +20 -0
- data/spec/factories/mdm/web_forms.rb +33 -0
- data/spec/factories/mdm/web_pages.rb +64 -0
- data/spec/factories/mdm/web_sites.rb +8 -0
- data/spec/factories/mdm/web_vulns.rb +64 -0
- data/spec/factories/mdm/workspaces.rb +23 -0
- data/spec/factories/metasploit_data_models/automatic_exploitation/match_results.rb +7 -0
- data/spec/factories/metasploit_data_models/automatic_exploitation/match_sets.rb +8 -0
- data/spec/factories/metasploit_data_models/automatic_exploitation/matches.rb +7 -0
- data/spec/factories/metasploit_data_models/automatic_exploitation/runs.rb +6 -0
- data/spec/factories/module_runs.rb +40 -0
- data/spec/lib/base64_serializer_spec.rb +172 -0
- data/spec/lib/ipaddr_spec.rb +29 -0
- data/spec/lib/metasploit_data_models/ip_address/cidr_spec.rb +356 -0
- data/spec/lib/metasploit_data_models/ip_address/range_spec.rb +75 -0
- data/spec/lib/metasploit_data_models/match/child_spec.rb +59 -0
- data/spec/lib/metasploit_data_models/match/parent_spec.rb +153 -0
- data/spec/lib/metasploit_data_models_spec.rb +13 -0
- data/spec/spec_helper.rb +148 -0
- data/spec/support/matchers/match_regex_exactly.rb +28 -0
- data/spec/support/shared/contexts/rex/text.rb +15 -0
- data/spec/support/shared/examples/coerces_inet_column_type_to_string.rb +15 -0
- data/spec/support/shared/examples/mdm/module/detail/does_not_support_stance_with_mtype.rb +20 -0
- data/spec/support/shared/examples/mdm/module/detail/supports_stance_with_mtype.rb +36 -0
- data/spec/support/shared/examples/metasploit_data_models/search/operation/ipaddress/match.rb +109 -0
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb +38 -0
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_metasploit_model_search_operation_base.rb +26 -0
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb +50 -0
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_equality.rb +34 -0
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_metasploit_model_search_group_base.rb +51 -0
- metadata +444 -6
@@ -0,0 +1,388 @@
|
|
1
|
+
# Details about an Msf::Module. Metadata that can be an array is stored in associations in modules under the
|
2
|
+
# {Mdm::Module} namespace.
|
3
|
+
class Mdm::Module::Detail < ApplicationRecord
|
4
|
+
self.table_name = 'module_details'
|
5
|
+
|
6
|
+
#
|
7
|
+
# CONSTANTS
|
8
|
+
#
|
9
|
+
|
10
|
+
# The directory for a given {#mtype} is a not always the pluralization of {#mtype}, so this maps the {#mtype} to the
|
11
|
+
# type directory that is used to generate the {#file} from the {#mtype} and {#refname}.
|
12
|
+
DIRECTORY_BY_TYPE = {
|
13
|
+
'auxiliary' => 'auxiliary',
|
14
|
+
'encoder' => 'encoders',
|
15
|
+
'exploit' => 'exploits',
|
16
|
+
'nop' => 'nops',
|
17
|
+
'payload' => 'payloads',
|
18
|
+
'post' => 'post',
|
19
|
+
'evasion' => 'evasion'
|
20
|
+
}
|
21
|
+
|
22
|
+
# {#privileged} is Boolean so, valid values are just `true` and `false`, but since both the validation and
|
23
|
+
# factory need an array of valid values, this constant exists.
|
24
|
+
PRIVILEGES = [
|
25
|
+
false,
|
26
|
+
true
|
27
|
+
]
|
28
|
+
|
29
|
+
# Converts {#rank}, which is an Integer, to the name used for that rank.
|
30
|
+
RANK_BY_NAME = {
|
31
|
+
'Manual' => 0,
|
32
|
+
'Low' => 100,
|
33
|
+
'Average' => 200,
|
34
|
+
'Normal' => 300,
|
35
|
+
'Good' => 400,
|
36
|
+
'Great' => 500,
|
37
|
+
'Excellent' => 600
|
38
|
+
}
|
39
|
+
|
40
|
+
# Valid values for {#stance}.
|
41
|
+
STANCES = [
|
42
|
+
'aggressive',
|
43
|
+
'passive'
|
44
|
+
]
|
45
|
+
|
46
|
+
#
|
47
|
+
# Associations
|
48
|
+
#
|
49
|
+
|
50
|
+
# @!attribute [rw] actions
|
51
|
+
# Auxiliary actions to perform when this running this module.
|
52
|
+
#
|
53
|
+
# @return [ActiveRecord::Relation<Mdm::Module::Action>]
|
54
|
+
has_many :actions, :class_name => 'Mdm::Module::Action', :dependent => :destroy
|
55
|
+
|
56
|
+
# @!attribute [rw] archs
|
57
|
+
# Architectures supported by this module.
|
58
|
+
#
|
59
|
+
# @return [ActiveRecord::Relation<Mdm::Module::Arch>]
|
60
|
+
has_many :archs, :class_name => 'Mdm::Module::Arch', :dependent => :destroy
|
61
|
+
|
62
|
+
# @!attribute [rw] authors
|
63
|
+
# Authors (and their emails) of this module. Usually includes the original discoverer who wrote the
|
64
|
+
# proof-of-concept and then the people that ported the proof-of-concept to metasploit-framework.
|
65
|
+
#
|
66
|
+
# @return [ActiveRecord::Relation<Mdm::Module::Mixin>]
|
67
|
+
has_many :authors, :class_name => 'Mdm::Module::Author', :dependent => :destroy
|
68
|
+
|
69
|
+
# @!attribute [rw] matches
|
70
|
+
# Matches for this module
|
71
|
+
#
|
72
|
+
# @return [ActiveRecord::Relation<MetasploitDataModels::AutomaticExploitation::Match>]
|
73
|
+
has_many :matches,
|
74
|
+
:class_name => 'MetasploitDataModels::AutomaticExploitation::Match',
|
75
|
+
:primary_key => :fullname,
|
76
|
+
:foreign_key => :module_fullname,
|
77
|
+
:inverse_of => :module_detail
|
78
|
+
|
79
|
+
# @!attribute [rw] mixins
|
80
|
+
# Mixins used by this module.
|
81
|
+
#
|
82
|
+
# @return [ActiveRecord::Relation<Mdm::Module::Mixin>]
|
83
|
+
has_many :mixins, :class_name => 'Mdm::Module::Mixin', :dependent => :destroy
|
84
|
+
|
85
|
+
# @!attribute [rw] module_runs
|
86
|
+
# Records of times when this module has been used
|
87
|
+
#
|
88
|
+
# @return [ActiveRecord::Relation<MetasploitDataModels::ModuleRun>]
|
89
|
+
has_many :module_runs,
|
90
|
+
:class_name => 'MetasploitDataModels::ModuleRun',
|
91
|
+
:primary_key => :fullname,
|
92
|
+
:foreign_key => :module_fullname,
|
93
|
+
:inverse_of => :module_detail
|
94
|
+
|
95
|
+
# @!attribute [rw] platforms
|
96
|
+
# Platforms supported by this module.
|
97
|
+
#
|
98
|
+
# @return [ActiveRecord::Relation<Mdm::Module::Platform>]
|
99
|
+
has_many :platforms, :class_name => 'Mdm::Module::Platform', :dependent => :destroy
|
100
|
+
|
101
|
+
# @!attribute [rw] refs
|
102
|
+
# External references to the vulnerabilities this module exploits.
|
103
|
+
#
|
104
|
+
# @return [ActiveRecord::Relation<Mdm::Module::Ref>]
|
105
|
+
has_many :refs, :class_name => 'Mdm::Module::Ref', :dependent => :destroy
|
106
|
+
|
107
|
+
# @!attribute [rw] targets
|
108
|
+
# Names of targets with different configurations that can be exploited by this module.
|
109
|
+
#
|
110
|
+
# @return [ActiveRecord::Relation<Mdm::Module::Target>]
|
111
|
+
has_many :targets, :class_name => 'Mdm::Module::Target', :dependent => :destroy
|
112
|
+
|
113
|
+
#
|
114
|
+
# Attributes
|
115
|
+
#
|
116
|
+
|
117
|
+
# @!attribute [rw] default_action
|
118
|
+
# Name of the default action in {#actions}.
|
119
|
+
#
|
120
|
+
# @return [String] {Mdm::Module::Action#name}.
|
121
|
+
|
122
|
+
# @!attribute [rw] default_target
|
123
|
+
# Name of the default target in {#targets}.
|
124
|
+
#
|
125
|
+
# @return [String] {Mdm::Module::Target#name}.
|
126
|
+
|
127
|
+
# @!attribute [rw] description
|
128
|
+
# A long, paragraph description of what the module does.
|
129
|
+
#
|
130
|
+
# @return [String]
|
131
|
+
|
132
|
+
# @!attribute [rw] disclosure_date
|
133
|
+
# The date the vulnerability exploited by this module was disclosed to the public.
|
134
|
+
#
|
135
|
+
# @return [DateTime]
|
136
|
+
|
137
|
+
# @!attribute [rw] file
|
138
|
+
# The full path to the module file on-disk.
|
139
|
+
#
|
140
|
+
# @return [String]
|
141
|
+
|
142
|
+
# @!attribute [rw] fullname
|
143
|
+
# The full name of the module. The full name is "{#mtype}/{#refname}".
|
144
|
+
#
|
145
|
+
# @return [String]
|
146
|
+
|
147
|
+
# @!attribute [rw] license
|
148
|
+
# The name of the software license for the module's code.
|
149
|
+
#
|
150
|
+
# @return [String]
|
151
|
+
|
152
|
+
# @!attribute [rw] mtime
|
153
|
+
# The modification time of the module file on-disk.
|
154
|
+
#
|
155
|
+
# @return [DateTime]
|
156
|
+
|
157
|
+
# @!attribute [rw] mtype
|
158
|
+
# The type of the module.
|
159
|
+
#
|
160
|
+
# @return [String] key in {DIRECTORY_BY_TYPE}
|
161
|
+
|
162
|
+
# @!attribute [rw] name
|
163
|
+
# The human readable name of the module. It is unrelated to {#fullname} or {#refname} and is better thought of
|
164
|
+
# as a short summary of the {#description}.
|
165
|
+
#
|
166
|
+
# @return [String]
|
167
|
+
|
168
|
+
# @!attribute [rw] privileged
|
169
|
+
# Whether this module requires priveleged access to run.
|
170
|
+
#
|
171
|
+
# @return [Boolean]
|
172
|
+
|
173
|
+
# @!attribute [rw] rank
|
174
|
+
# The reliability of the module and likelyhood that the module won't knock over the service or host being exploited.
|
175
|
+
# Bigger values is better.
|
176
|
+
#
|
177
|
+
# @return [Integer]
|
178
|
+
|
179
|
+
# @!attribute [rw] ready
|
180
|
+
# Boolean indicating whether the metadata for the module has been updated from the on-disk module.
|
181
|
+
#
|
182
|
+
# @return [false] if the associations are still being updated.
|
183
|
+
# @return [true] if this detail and its associations are up-to-date.
|
184
|
+
|
185
|
+
# @!attribute [rw] refname
|
186
|
+
# The reference name of the module.
|
187
|
+
#
|
188
|
+
# @return [String]
|
189
|
+
|
190
|
+
# @!attribute [rw] stance
|
191
|
+
# Whether the module is active or passive. `nil` if the {#mtype module type} does not
|
192
|
+
# {#supports_stance? support stances}.
|
193
|
+
#
|
194
|
+
# @return ['active', 'passive', nil]
|
195
|
+
|
196
|
+
#
|
197
|
+
# Scopes
|
198
|
+
#
|
199
|
+
|
200
|
+
scope :module_arch, ->(values) {
|
201
|
+
joins(Mdm::Module::Detail.join_association(:archs,Arel::Nodes::OuterJoin)).
|
202
|
+
where(Mdm::Module::Arch[:name].matches_any(values))
|
203
|
+
}
|
204
|
+
|
205
|
+
scope :module_author, ->(values) {
|
206
|
+
joins(Mdm::Module::Detail.join_association(:authors, Arel::Nodes::OuterJoin)).
|
207
|
+
where(
|
208
|
+
Mdm::Module::Author[:email].matches_any(values).or(
|
209
|
+
Mdm::Module::Author[:name].matches_any(values)
|
210
|
+
)
|
211
|
+
)
|
212
|
+
}
|
213
|
+
|
214
|
+
scope :module_name, ->(values) {
|
215
|
+
where(
|
216
|
+
Mdm::Module::Detail[:fullname].matches_any(values).or(
|
217
|
+
Mdm::Module::Detail[:name].matches_any(values)
|
218
|
+
)
|
219
|
+
)
|
220
|
+
}
|
221
|
+
|
222
|
+
scope :module_os_or_platform, ->(values) {
|
223
|
+
joins(
|
224
|
+
Mdm::Module::Detail.join_association(:platforms, Arel::Nodes::OuterJoin),
|
225
|
+
Mdm::Module::Detail.join_association(:targets, Arel::Nodes::OuterJoin)
|
226
|
+
).where(
|
227
|
+
Mdm::Module::Platform[:name].matches_any(values).or(
|
228
|
+
Mdm::Module::Target[:name].matches_any(values)
|
229
|
+
)
|
230
|
+
)
|
231
|
+
}
|
232
|
+
|
233
|
+
scope :module_ref, ->(values) {
|
234
|
+
joins(Mdm::Module::Detail.join_association(:refs, Arel::Nodes::OuterJoin)).
|
235
|
+
where(Mdm::Module::Ref[:name].matches_any(values))
|
236
|
+
}
|
237
|
+
|
238
|
+
scope :module_stance, ->(values) { where(Mdm::Module::Detail[:stance].matches_any(values)) }
|
239
|
+
|
240
|
+
scope :module_text, ->(values) {
|
241
|
+
joins(
|
242
|
+
Mdm::Module::Detail.join_association(:actions, Arel::Nodes::OuterJoin),
|
243
|
+
Mdm::Module::Detail.join_association(:archs, Arel::Nodes::OuterJoin),
|
244
|
+
Mdm::Module::Detail.join_association(:authors, Arel::Nodes::OuterJoin),
|
245
|
+
Mdm::Module::Detail.join_association(:platforms, Arel::Nodes::OuterJoin),
|
246
|
+
Mdm::Module::Detail.join_association(:refs, Arel::Nodes::OuterJoin),
|
247
|
+
Mdm::Module::Detail.join_association(:targets, Arel::Nodes::OuterJoin)
|
248
|
+
).where(
|
249
|
+
Mdm::Module::Detail[:description].matches_any(values).or(
|
250
|
+
Mdm::Module::Detail[:fullname].matches_any(values).or(
|
251
|
+
Mdm::Module::Detail[:name].matches_any(values).or(
|
252
|
+
Mdm::Module::Action[:name].matches_any(values).or(
|
253
|
+
Mdm::Module::Arch[:name].matches_any(values).or(
|
254
|
+
Mdm::Module::Author[:name].matches_any(values).or(
|
255
|
+
Mdm::Module::Platform[:name].matches_any(values).or(
|
256
|
+
Mdm::Module::Ref[:name].matches_any(values).or(
|
257
|
+
Mdm::Module::Target[:name].matches_any(values)
|
258
|
+
)))))))))
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
scope :module_type, ->(values) { where(Mdm::Module::Detail[:mtype].matches_any(values)) }
|
263
|
+
|
264
|
+
#
|
265
|
+
# Validations
|
266
|
+
#
|
267
|
+
|
268
|
+
validates :mtype,
|
269
|
+
:inclusion => {
|
270
|
+
:in => DIRECTORY_BY_TYPE.keys
|
271
|
+
}
|
272
|
+
validates :privileged,
|
273
|
+
:inclusion => {
|
274
|
+
:in => PRIVILEGES
|
275
|
+
}
|
276
|
+
validates :rank,
|
277
|
+
:inclusion => {
|
278
|
+
:in => RANK_BY_NAME.values
|
279
|
+
},
|
280
|
+
:numericality => {
|
281
|
+
:only_integer => true
|
282
|
+
}
|
283
|
+
validates :refname, :presence => true
|
284
|
+
validates :stance,
|
285
|
+
:inclusion => {
|
286
|
+
:if => :supports_stance?,
|
287
|
+
:in => STANCES
|
288
|
+
}
|
289
|
+
|
290
|
+
validates_associated :actions
|
291
|
+
validates_associated :archs
|
292
|
+
validates_associated :authors
|
293
|
+
validates_associated :mixins
|
294
|
+
validates_associated :platforms
|
295
|
+
validates_associated :refs
|
296
|
+
validates_associated :targets
|
297
|
+
|
298
|
+
# Adds an {Mdm::Module::Action} with the given {Mdm::Module::Action#name} to {#actions} and immediately saves it to
|
299
|
+
# the database.
|
300
|
+
#
|
301
|
+
# @param name [String] {Mdm::Module::Action#name}.
|
302
|
+
# @return [true] if save was successful.
|
303
|
+
# @return [false] if save was unsucessful.
|
304
|
+
def add_action(name)
|
305
|
+
self.actions.build(:name => name).save
|
306
|
+
end
|
307
|
+
|
308
|
+
# Adds an {Mdm::Module::Arch} with the given {Mdm::Module::Arch#name} to {#archs} and immediately saves it to the
|
309
|
+
# database.
|
310
|
+
#
|
311
|
+
# @param name [String] {Mdm::Module::Arch#name}.
|
312
|
+
# @return [true] if save was successful.
|
313
|
+
# @return [false] if save was unsuccessful.
|
314
|
+
def add_arch(name)
|
315
|
+
self.archs.build(:name => name).save
|
316
|
+
end
|
317
|
+
|
318
|
+
# Adds an {Mdm::Module::Author} with the given {Mdm::Module::Author#name} and {Mdm::Module::Author#email} to
|
319
|
+
# {#authors} and immediately saves it to the database.
|
320
|
+
#
|
321
|
+
# @param name [String] {Mdm::Module::Author#name}.
|
322
|
+
# @param email [String] {Mdm::Module::Author#email}.
|
323
|
+
# @return [true] if save was successful.
|
324
|
+
# @return [false] if save was unsuccessful.
|
325
|
+
def add_author(name, email=nil)
|
326
|
+
self.authors.build(:name => name, :email => email).save
|
327
|
+
end
|
328
|
+
|
329
|
+
# Adds an {Mdm::Module::Mixin} with the given {Mdm::Module::Mixin#name} to {#mixins} and immediately saves it to the
|
330
|
+
# database.
|
331
|
+
#
|
332
|
+
# @param name [String] {Mdm::Module::Mixin#name}.
|
333
|
+
# @return [true] if save was successful.
|
334
|
+
# @return [false] if save was unsuccessful.
|
335
|
+
def add_mixin(name)
|
336
|
+
self.mixins.build(:name => name).save
|
337
|
+
end
|
338
|
+
|
339
|
+
# Adds an {Mdm::Module::Platform} with the given {Mdm::Module::Platform#name} to {#platforms} and immediately saves it
|
340
|
+
# to the database.
|
341
|
+
#
|
342
|
+
# @param name [String] {Mdm::Module::Platform#name}.
|
343
|
+
# @return [true] if save was successful.
|
344
|
+
# @return [false] if save was unsuccessful.
|
345
|
+
def add_platform(name)
|
346
|
+
self.platforms.build(:name => name).save
|
347
|
+
end
|
348
|
+
|
349
|
+
# Adds an {Mdm::Module::Ref} with the given {Mdm::Module::Ref#name} to {#refs} and immediately saves it to the
|
350
|
+
# database.
|
351
|
+
#
|
352
|
+
# @param name [String] {Mdm::Module::Ref#name}.
|
353
|
+
# @return [true] if save was successful.
|
354
|
+
# @return [false] if save was unsuccessful.
|
355
|
+
def add_ref(name)
|
356
|
+
self.refs.build(:name => name).save
|
357
|
+
end
|
358
|
+
|
359
|
+
# Adds an {Mdm::Module::Target} with the given {Mdm::Module::Target#index} and {Mdm::Module::Target#name} to
|
360
|
+
# {#targets} and immediately saves it to the database.
|
361
|
+
#
|
362
|
+
# @param index [Integer] index of target among other {#targets}.
|
363
|
+
# @param name [String] {Mdm::Module::Target#name}.
|
364
|
+
# @return [true] if save was successful.
|
365
|
+
# @return [false] if save was unsuccessful.
|
366
|
+
def add_target(index, name)
|
367
|
+
self.targets.build(:index => index, :name => name).save
|
368
|
+
end
|
369
|
+
|
370
|
+
# Returns whether this module supports a {#stance}. Only modules with {#mtype} `'auxiliary'` and `'exploit'` support
|
371
|
+
# a non-nil {#stance}.
|
372
|
+
#
|
373
|
+
# @return [true] if {#mtype} is `'auxiliary'` or `'exploit'`
|
374
|
+
# @return [false] otherwise
|
375
|
+
# @see https://github.com/rapid7/metasploit-framework/blob/a6070f8584ad9e48918b18c7e765d85f549cb7fd/lib/msf/core/db_manager.rb#L423
|
376
|
+
# @see https://github.com/rapid7/metasploit-framework/blob/a6070f8584ad9e48918b18c7e765d85f549cb7fd/lib/msf/core/db_manager.rb#L436
|
377
|
+
def supports_stance?
|
378
|
+
supports_stance = false
|
379
|
+
|
380
|
+
if ['auxiliary', 'exploit'].include? mtype
|
381
|
+
supports_stance = true
|
382
|
+
end
|
383
|
+
|
384
|
+
supports_stance
|
385
|
+
end
|
386
|
+
|
387
|
+
Metasploit::Concern.run(self)
|
388
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# @deprecated Never populated by metasploit-framework.
|
2
|
+
#
|
3
|
+
# Module mixed into a {#detail Metasploit Module}.
|
4
|
+
class Mdm::Module::Mixin < ApplicationRecord
|
5
|
+
self.table_name = 'module_mixins'
|
6
|
+
|
7
|
+
#
|
8
|
+
# Associations
|
9
|
+
#
|
10
|
+
|
11
|
+
# Metasploit Module the {#name named} `Module` was mixed in.
|
12
|
+
belongs_to :detail, :class_name => 'Mdm::Module::Detail'
|
13
|
+
|
14
|
+
#
|
15
|
+
# Attributes
|
16
|
+
#
|
17
|
+
|
18
|
+
# @!attribute name
|
19
|
+
# The `Module#name` of the mixed in `Module`.
|
20
|
+
#
|
21
|
+
# @return [String]
|
22
|
+
|
23
|
+
#
|
24
|
+
# Validation
|
25
|
+
#
|
26
|
+
|
27
|
+
validates :detail, :presence => true
|
28
|
+
validates :name, :presence => true
|
29
|
+
|
30
|
+
Metasploit::Concern.run(self)
|
31
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# {#name Platform} on which the {#detail Metasploit Module} can run.
|
2
|
+
class Mdm::Module::Platform < ApplicationRecord
|
3
|
+
self.table_name = 'module_platforms'
|
4
|
+
|
5
|
+
#
|
6
|
+
# Associations
|
7
|
+
#
|
8
|
+
|
9
|
+
# The Metasploit Module that can run on the {#name named} platform.
|
10
|
+
belongs_to :detail, :class_name => 'Mdm::Module::Detail'
|
11
|
+
|
12
|
+
#
|
13
|
+
# Attributes
|
14
|
+
#
|
15
|
+
|
16
|
+
# @!attribute name
|
17
|
+
# The name of the platform.
|
18
|
+
#
|
19
|
+
# @return [String]
|
20
|
+
|
21
|
+
#
|
22
|
+
# Validations
|
23
|
+
#
|
24
|
+
|
25
|
+
validates :detail, :presence => true
|
26
|
+
validates :name, :presence => true
|
27
|
+
|
28
|
+
Metasploit::Concern.run(self)
|
29
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# External references to the vulnerability exploited by this module.
|
2
|
+
class Mdm::Module::Ref < ApplicationRecord
|
3
|
+
self.table_name = 'module_refs'
|
4
|
+
|
5
|
+
#
|
6
|
+
# Associations
|
7
|
+
#
|
8
|
+
|
9
|
+
# @!attribute [rw] detail
|
10
|
+
# The root of the module metadata tree.
|
11
|
+
#
|
12
|
+
# @return [Mdm::Module::Detail]
|
13
|
+
belongs_to :detail, :class_name => 'Mdm::Module::Detail'
|
14
|
+
|
15
|
+
# @!attribute [r] refs
|
16
|
+
# References with the same name attached to {Mdm::Vuln Mdm::Vulns}.
|
17
|
+
#
|
18
|
+
# @return [Array<Mdm::Ref>]
|
19
|
+
has_many :refs,
|
20
|
+
:class_name => 'Mdm::Ref',
|
21
|
+
:foreign_key => :name,
|
22
|
+
:primary_key => :name
|
23
|
+
|
24
|
+
#
|
25
|
+
# Attributes
|
26
|
+
#
|
27
|
+
|
28
|
+
# @!attribute [rw] name
|
29
|
+
# Designation for external reference. May include a prefix for the authority, such as 'CVE-', in which case the
|
30
|
+
# rest of the name is the designation assigned by that authority.
|
31
|
+
#
|
32
|
+
# @return [String]
|
33
|
+
|
34
|
+
#
|
35
|
+
# Validations
|
36
|
+
#
|
37
|
+
|
38
|
+
validates :detail, :presence => true
|
39
|
+
validates :name, :presence => true
|
40
|
+
|
41
|
+
Metasploit::Concern.run(self)
|
42
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# A potential target for a {Mdm::Module::Detail exploit Metasploit Module}. Targets can change options including
|
2
|
+
# offsets for ROP chains to tune an exploit to work with different system libraries and versions.
|
3
|
+
class Mdm::Module::Target < ApplicationRecord
|
4
|
+
self.table_name = 'module_targets'
|
5
|
+
|
6
|
+
#
|
7
|
+
# Associations
|
8
|
+
#
|
9
|
+
|
10
|
+
# Exploit Metasploit Module with the {#name named} target at the given {#index}.
|
11
|
+
belongs_to :detail, :class_name => 'Mdm::Module::Detail'
|
12
|
+
|
13
|
+
#
|
14
|
+
# Attributes
|
15
|
+
#
|
16
|
+
|
17
|
+
# @!attribute index
|
18
|
+
# The index of this target in the {#detail exploit Metasploit Module}'s list of targets. The index is used for
|
19
|
+
# target selection.
|
20
|
+
#
|
21
|
+
# @return [Integer]
|
22
|
+
|
23
|
+
# @!attribute name
|
24
|
+
# The name of this target.
|
25
|
+
#
|
26
|
+
# @return [String]
|
27
|
+
|
28
|
+
#
|
29
|
+
# Validators
|
30
|
+
#
|
31
|
+
|
32
|
+
validates :detail, :presence => true
|
33
|
+
validates :index, :presence => true
|
34
|
+
validates :name, :presence => true
|
35
|
+
|
36
|
+
Metasploit::Concern.run(self)
|
37
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# A connection to Nexpose from Metasploit.
|
2
|
+
class Mdm::NexposeConsole < ApplicationRecord
|
3
|
+
#
|
4
|
+
# Associations
|
5
|
+
#
|
6
|
+
|
7
|
+
# Details for vulnerabilities supplied by this Nexpose console.
|
8
|
+
has_many :vuln_details,
|
9
|
+
class_name: 'Mdm::VulnDetail',
|
10
|
+
foreign_key: :nx_console_id,
|
11
|
+
inverse_of: :nexpose_console
|
12
|
+
|
13
|
+
#
|
14
|
+
# Attributes
|
15
|
+
#
|
16
|
+
|
17
|
+
# @!attribute address
|
18
|
+
# Address on which Nexpose is running.
|
19
|
+
#
|
20
|
+
# @return [String]
|
21
|
+
|
22
|
+
# @!attribute cert
|
23
|
+
# @return [String]
|
24
|
+
|
25
|
+
# @!attribute created_at
|
26
|
+
# When this Nexpose console was created.
|
27
|
+
#
|
28
|
+
# @return [DateTime]
|
29
|
+
|
30
|
+
# @!attribute enabled
|
31
|
+
# Whether metasploit tried to connect to this Nexpose console.
|
32
|
+
#
|
33
|
+
# @return [false] is not allowed to connect.
|
34
|
+
# @return [true] is allowed to connect.
|
35
|
+
|
36
|
+
# @!attribute name
|
37
|
+
# Name of this Nexpose console to differentiate from other Nexpose consoles.
|
38
|
+
#
|
39
|
+
# @return [String]
|
40
|
+
|
41
|
+
# @!attribute owner
|
42
|
+
# {Mdm::User#username Name of user} that setup this console.
|
43
|
+
#
|
44
|
+
# @return [String]
|
45
|
+
# @todo https://www.pivotaltracker.com/story/show/52413415
|
46
|
+
|
47
|
+
# @!attribute password
|
48
|
+
# Password used to authenticate to Nexpose.
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
# @todo https://www.pivotaltracker.com/story/show/52414551
|
52
|
+
|
53
|
+
# @!attribute port
|
54
|
+
# Port on {#address} that Nexpose is running.
|
55
|
+
#
|
56
|
+
# @return [Integer]
|
57
|
+
|
58
|
+
# @!attribute status
|
59
|
+
# Status of the connection to Nexpose.
|
60
|
+
#
|
61
|
+
# @return [String]
|
62
|
+
|
63
|
+
# @!attribute updated_at
|
64
|
+
# The last time this Nexpose console was updated.
|
65
|
+
#
|
66
|
+
# @return [DateTime]
|
67
|
+
|
68
|
+
# @!attribute username
|
69
|
+
# Username used to authenticate to Nexpose.
|
70
|
+
#
|
71
|
+
# @return [String]
|
72
|
+
|
73
|
+
# @!attribute version
|
74
|
+
# The version of Nexpose. Used to handle protocol difference in different versions of Nexpose.
|
75
|
+
#
|
76
|
+
# @return [String]
|
77
|
+
|
78
|
+
#
|
79
|
+
# Callbacks
|
80
|
+
#
|
81
|
+
|
82
|
+
before_validation :strip_protocol
|
83
|
+
|
84
|
+
#
|
85
|
+
# Serializations
|
86
|
+
#
|
87
|
+
|
88
|
+
# @!attribute [rw] cached_sites
|
89
|
+
# List of sites known to Nexpose.
|
90
|
+
#
|
91
|
+
# @return [Array<String>] Array of site names.
|
92
|
+
serialize :cached_sites, MetasploitDataModels::Base64Serializer.new
|
93
|
+
|
94
|
+
#
|
95
|
+
# Validations
|
96
|
+
#
|
97
|
+
|
98
|
+
validates :address, :presence => true, :address_format => true
|
99
|
+
|
100
|
+
validates :name, :presence => true
|
101
|
+
|
102
|
+
validates :password, :presence => true
|
103
|
+
|
104
|
+
validates :port, :numericality => { :only_integer => true }, :inclusion => {:in => 1..65535}
|
105
|
+
|
106
|
+
validates :username, :presence => true
|
107
|
+
|
108
|
+
#
|
109
|
+
# Instance Methdos
|
110
|
+
#
|
111
|
+
|
112
|
+
# Strips '`http://`' or `'https://'` from {#address}.
|
113
|
+
#
|
114
|
+
# @return [void]
|
115
|
+
def strip_protocol
|
116
|
+
self.address.gsub!(/^http(s)*:\/\//i,'') unless self.address.nil?
|
117
|
+
end
|
118
|
+
|
119
|
+
Metasploit::Concern.run(self)
|
120
|
+
end
|
121
|
+
|