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,230 @@
|
|
1
|
+
# A user of metasploit-framework or metasploit-pro.
|
2
|
+
class Mdm::User < ApplicationRecord
|
3
|
+
extend MetasploitDataModels::SerializedPrefs
|
4
|
+
|
5
|
+
#
|
6
|
+
# Associations
|
7
|
+
#
|
8
|
+
|
9
|
+
# Automatic exploitation runs started by this user.
|
10
|
+
has_many :automatic_exploitation_runs,
|
11
|
+
class_name: 'MetasploitDataModels::AutomaticExploitation::Run',
|
12
|
+
inverse_of: :user
|
13
|
+
|
14
|
+
# Automatic exploitation match sets created by this user for {#automatic_exploitation_runs}.
|
15
|
+
has_many :automatic_exploitation_match_sets,
|
16
|
+
class_name: 'MetasploitDataModels::AutomaticExploitation::MatchSet',
|
17
|
+
inverse_of: :user
|
18
|
+
|
19
|
+
# {Mdm::Workspace Workspaces} owned by this user. Owned workspaces allow user complete permissions without the need
|
20
|
+
# or the user to be an {#admin administrator}.
|
21
|
+
has_many :owned_workspaces,
|
22
|
+
class_name: 'Mdm::Workspace',
|
23
|
+
foreign_key: 'owner_id',
|
24
|
+
inverse_of: :owner
|
25
|
+
|
26
|
+
# Runs of Metasploit Modules by this user.
|
27
|
+
has_many :module_runs,
|
28
|
+
class_name: 'MetasploitDataModels::ModuleRun',
|
29
|
+
inverse_of: :user
|
30
|
+
|
31
|
+
# Tags created by the user.
|
32
|
+
has_many :tags,
|
33
|
+
class_name: 'Mdm::Tag',
|
34
|
+
inverse_of: :user
|
35
|
+
|
36
|
+
# {Mdm::Workspace Workspace} where this user has access. If a user is an {#admin administrator} they have access
|
37
|
+
# to all workspaces even if they are not a member of that workspace.
|
38
|
+
has_and_belongs_to_many :workspaces,
|
39
|
+
-> { distinct },
|
40
|
+
class_name: 'Mdm::Workspace',
|
41
|
+
join_table: 'workspace_members'
|
42
|
+
|
43
|
+
#
|
44
|
+
# Attributes
|
45
|
+
#
|
46
|
+
|
47
|
+
# @!attribute admin
|
48
|
+
# Whether this user is an administrator. Administrator permissions are only enforced in metasploit-pro through the
|
49
|
+
# controllers.
|
50
|
+
#
|
51
|
+
# @return [false] if this is a normal user that must be added to each workspace.
|
52
|
+
# @return [true] if this user is an administrator and have access to all workspaces without being added to the
|
53
|
+
# workspace explicitly. User is also allowed to add other users to workspaces or make other users admins.
|
54
|
+
|
55
|
+
# @!attribute company
|
56
|
+
# Company at which user works.
|
57
|
+
#
|
58
|
+
# @return [String, nil]
|
59
|
+
|
60
|
+
# @!attribute created_at
|
61
|
+
# When the user was created.
|
62
|
+
#
|
63
|
+
# @return [DateTime]
|
64
|
+
|
65
|
+
# @!attribute crypted_password
|
66
|
+
# Hashed password (salted with {#password_salt}) by Authlogic in metasploit-pro.
|
67
|
+
#
|
68
|
+
# @return [String]
|
69
|
+
|
70
|
+
# @!attribute email
|
71
|
+
# The user's email address.
|
72
|
+
#
|
73
|
+
# @return [String, nil]
|
74
|
+
|
75
|
+
# @!attribute fullname
|
76
|
+
# The user's normal human name.
|
77
|
+
#
|
78
|
+
# @return [String, nil]
|
79
|
+
|
80
|
+
# @!attribute password_salt
|
81
|
+
# Salt used when hashing password into {#crypted_password} by Authlogic in metasploit-pro.
|
82
|
+
#
|
83
|
+
# @return [String]
|
84
|
+
|
85
|
+
# @!attribute persistence_token
|
86
|
+
# Token used for session and cookie when user is logged using Authlogic in metasploit-pro.
|
87
|
+
#
|
88
|
+
# @return [String]
|
89
|
+
|
90
|
+
# @!attribute phone
|
91
|
+
# Phone number for user.
|
92
|
+
#
|
93
|
+
# @return [String, nil]
|
94
|
+
|
95
|
+
# @!attribute updated_at
|
96
|
+
# When the user was last updated.
|
97
|
+
#
|
98
|
+
# @return [DateTime]
|
99
|
+
|
100
|
+
# @!attribute username
|
101
|
+
# Username for this user. Used to log into metasploit-pro.
|
102
|
+
#
|
103
|
+
# @return [String]
|
104
|
+
|
105
|
+
#
|
106
|
+
# Serialziations
|
107
|
+
#
|
108
|
+
|
109
|
+
# Hash of user preferences
|
110
|
+
#
|
111
|
+
# @return [Hash]
|
112
|
+
serialize :prefs, MetasploitDataModels::Base64Serializer.new
|
113
|
+
|
114
|
+
# @!attribute time_zone
|
115
|
+
# User's preferred time zone.
|
116
|
+
#
|
117
|
+
# @return [String, nil]
|
118
|
+
serialized_prefs_attr_accessor :time_zone
|
119
|
+
|
120
|
+
#
|
121
|
+
# @!group Duplicate Login Monitoring
|
122
|
+
#
|
123
|
+
|
124
|
+
# @!attribute last_login_address
|
125
|
+
# @note specifically NOT last_login_ip to prevent confusion with AuthLogic magic columns (which dont work for
|
126
|
+
# serialized fields)
|
127
|
+
#
|
128
|
+
# Last IP address from which this user logged in. Used to report currently active user session's IP when the user
|
129
|
+
# is logged off because theire `session[:session_id]` does not match {#session_key}.
|
130
|
+
#
|
131
|
+
# @return [String, nil]
|
132
|
+
serialized_prefs_attr_accessor :last_login_address
|
133
|
+
|
134
|
+
# @!attribute session_key
|
135
|
+
# Holds `session[:session_id]` so user can only be logged in once. Only enforced in metasploit-pro.
|
136
|
+
#
|
137
|
+
# @return [String, nil]
|
138
|
+
serialized_prefs_attr_accessor :session_key
|
139
|
+
|
140
|
+
#
|
141
|
+
# @!endgroup
|
142
|
+
#
|
143
|
+
|
144
|
+
#
|
145
|
+
# @!group HTTP Proxy
|
146
|
+
#
|
147
|
+
|
148
|
+
# @!attribute http_proxy_host
|
149
|
+
# Proxy host.
|
150
|
+
#
|
151
|
+
# @return [String, nil]
|
152
|
+
serialized_prefs_attr_accessor :http_proxy_host
|
153
|
+
|
154
|
+
# @!attribute http_proxy_pass
|
155
|
+
# Password used to login as {#http_proxy_user} to proxy.
|
156
|
+
#
|
157
|
+
# @return [String, nil]
|
158
|
+
serialized_prefs_attr_accessor :http_proxy_pass
|
159
|
+
|
160
|
+
# @!attribute http_proxy_port
|
161
|
+
# Port on which proxy run on {#http_proxy_host}.
|
162
|
+
#
|
163
|
+
# @return [String, Integer, nil]
|
164
|
+
serialized_prefs_attr_accessor :http_proxy_port
|
165
|
+
|
166
|
+
# @!attribute http_proxy_user
|
167
|
+
# User used to log into proxy.
|
168
|
+
#
|
169
|
+
# @return [String, nil]
|
170
|
+
serialized_prefs_attr_accessor :http_proxy_user
|
171
|
+
|
172
|
+
#
|
173
|
+
# @!endgroup
|
174
|
+
#
|
175
|
+
|
176
|
+
#
|
177
|
+
# @!group Nexpose
|
178
|
+
#
|
179
|
+
|
180
|
+
# @!attribute nexpose_host
|
181
|
+
# Host name for server running Nexpose.
|
182
|
+
#
|
183
|
+
# @return [String, nil]
|
184
|
+
serialized_prefs_attr_accessor :nexpose_host
|
185
|
+
|
186
|
+
# @!attribute nexpose_pass
|
187
|
+
# Password to log into Nexpose.
|
188
|
+
#
|
189
|
+
# @return [String, nil]
|
190
|
+
serialized_prefs_attr_accessor :nexpose_pass
|
191
|
+
|
192
|
+
# @!attribute nexpose_port
|
193
|
+
# Port on {#nexpose_host} on which Nexpose is running.
|
194
|
+
#
|
195
|
+
# @return [String, Integer. nil]
|
196
|
+
serialized_prefs_attr_accessor :nexpose_port
|
197
|
+
|
198
|
+
# @!attribute nexpose_user
|
199
|
+
# User used to log into Nexpose.
|
200
|
+
#
|
201
|
+
# @return [String, nil]
|
202
|
+
serialized_prefs_attr_accessor :nexpose_user
|
203
|
+
|
204
|
+
#
|
205
|
+
# @!endgroup
|
206
|
+
#
|
207
|
+
|
208
|
+
#
|
209
|
+
# @!group Nexpose Authenticated Scan Credentials
|
210
|
+
#
|
211
|
+
|
212
|
+
# @!attribute nexpose_creds_pass
|
213
|
+
# @return [String, nil]
|
214
|
+
serialized_prefs_attr_accessor :nexpose_creds_pass
|
215
|
+
|
216
|
+
# @!attribute nexpose_creds_type
|
217
|
+
# @return [String, nil]
|
218
|
+
serialized_prefs_attr_accessor :nexpose_creds_type
|
219
|
+
|
220
|
+
# @!attribute nexpose_creds_user
|
221
|
+
# @return [String, nil]
|
222
|
+
serialized_prefs_attr_accessor :nexpose_creds_user
|
223
|
+
|
224
|
+
#
|
225
|
+
# @!endgroup
|
226
|
+
#
|
227
|
+
|
228
|
+
Metasploit::Concern.run(self)
|
229
|
+
end
|
230
|
+
|
@@ -0,0 +1,204 @@
|
|
1
|
+
# A vulnerability found on a {#host} or {#service}.
|
2
|
+
class Mdm::Vuln < ApplicationRecord
|
3
|
+
|
4
|
+
#
|
5
|
+
# Associations
|
6
|
+
#
|
7
|
+
|
8
|
+
# @!attribute exploit_attempts
|
9
|
+
# Attempts to exploit this vulnerability.
|
10
|
+
#
|
11
|
+
# @return [ActiveRecord::Relation<Mdm::ExploitAttempt>]
|
12
|
+
has_many :exploit_attempts,
|
13
|
+
class_name: 'Mdm::ExploitAttempt',
|
14
|
+
inverse_of: :vuln
|
15
|
+
|
16
|
+
# @!attribute [rw] host
|
17
|
+
# The host with this vulnerability.
|
18
|
+
#
|
19
|
+
# @return [Mdm::Host]
|
20
|
+
belongs_to :host,
|
21
|
+
class_name: 'Mdm::Host',
|
22
|
+
counter_cache: :vuln_count,
|
23
|
+
inverse_of: :vulns
|
24
|
+
|
25
|
+
# @!attribute [rw] matches
|
26
|
+
# The matches for this vuln
|
27
|
+
#
|
28
|
+
# @return [ActiveRecord::Relation<MetasploitDataModels::AutomaticExploitation::Match>]
|
29
|
+
has_many :matches, class_name: "MetasploitDataModels::AutomaticExploitation::Match",
|
30
|
+
as: :matchable,
|
31
|
+
dependent: :destroy
|
32
|
+
|
33
|
+
# @!attribute [rw] service
|
34
|
+
# The service with the vulnerability.
|
35
|
+
#
|
36
|
+
# @return [Mdm::Service]
|
37
|
+
belongs_to :service,
|
38
|
+
class_name: 'Mdm::Service',
|
39
|
+
inverse_of: :vulns
|
40
|
+
|
41
|
+
# @!attribute [rw] origin
|
42
|
+
# A polymorphic association to the origin that found
|
43
|
+
# the vulnerability.
|
44
|
+
#
|
45
|
+
# @return [ActiveRecord::Relation<origin>]
|
46
|
+
belongs_to :origin,
|
47
|
+
polymorphic: true
|
48
|
+
|
49
|
+
# @!attribute [rw] vuln_attempts
|
50
|
+
# Attempts to exploit this vulnerability.
|
51
|
+
#
|
52
|
+
# @return [ActiveRecord::Relation<Mdm::VulnAttempt>]
|
53
|
+
has_many :vuln_attempts,
|
54
|
+
class_name: 'Mdm::VulnAttempt',
|
55
|
+
dependent: :destroy,
|
56
|
+
inverse_of: :vuln
|
57
|
+
|
58
|
+
# @!attribute [rw] vuln_details
|
59
|
+
# Additional information about this vulnerability.
|
60
|
+
#
|
61
|
+
# @return [ActiveRecord::Relation<Mdm::VulnDetail>]
|
62
|
+
has_many :vuln_details,
|
63
|
+
class_name: 'Mdm::VulnDetail',
|
64
|
+
dependent: :destroy,
|
65
|
+
inverse_of: :vuln
|
66
|
+
|
67
|
+
# @!attribute [rw] vulns_refs
|
68
|
+
# Join model that joins this vuln to its {Mdm::Ref external references}.
|
69
|
+
#
|
70
|
+
# @return [ActiveRecord::Relation<Mdm::VulnRef>]
|
71
|
+
has_many :vulns_refs,
|
72
|
+
class_name: 'Mdm::VulnRef',
|
73
|
+
dependent: :destroy,
|
74
|
+
inverse_of: :vuln
|
75
|
+
|
76
|
+
# @!attribute [rw] notes
|
77
|
+
# Notes about the vuln entered by a user with {Mdm::Note#created_at oldest notes} first.
|
78
|
+
#
|
79
|
+
# @return [<ActiveRecord::RelationMdm::Note>]
|
80
|
+
has_many :notes,
|
81
|
+
-> { order('notes.created_at') },
|
82
|
+
class_name: 'Mdm::Note',
|
83
|
+
inverse_of: :vuln,
|
84
|
+
dependent: :delete_all
|
85
|
+
|
86
|
+
|
87
|
+
#
|
88
|
+
# Through :vuln_refs
|
89
|
+
#
|
90
|
+
|
91
|
+
# @!attribute [r] refs
|
92
|
+
# External references to this vulnerability.
|
93
|
+
#
|
94
|
+
# @return [ActiveRecord::Relation<Mdm::Ref>]
|
95
|
+
has_many :refs, :class_name => 'Mdm::Ref', :through => :vulns_refs
|
96
|
+
|
97
|
+
#
|
98
|
+
# Through refs
|
99
|
+
#
|
100
|
+
|
101
|
+
# @!attribute [r] module_refs
|
102
|
+
# References in module that match {Mdm::Ref#name names} in {#refs}.
|
103
|
+
#
|
104
|
+
# @return [ActiveRecord::Relation<Mdm::Module::Ref>]
|
105
|
+
has_many :module_refs, :class_name => 'Mdm::Module::Ref', :through => :refs
|
106
|
+
|
107
|
+
|
108
|
+
# @!attribute [r] module_runs
|
109
|
+
# References to times that a module has been run to exercise this vuln
|
110
|
+
#
|
111
|
+
# @return [ActiveRecord::Relation<MetasploitDataModels::ModuleRun>]
|
112
|
+
has_many :module_runs,
|
113
|
+
class_name: 'MetasploitDataModels::ModuleRun',
|
114
|
+
as: :trackable
|
115
|
+
|
116
|
+
#
|
117
|
+
# Through module_refs
|
118
|
+
#
|
119
|
+
|
120
|
+
# @!attribute [r] module_details
|
121
|
+
# {Mdm::Module::Detail Modules} that share the same external references as this vuln.
|
122
|
+
#
|
123
|
+
# @return [ActiveRecord::Relation<Mdm::Module::Detail>]
|
124
|
+
has_many :module_details,
|
125
|
+
-> { distinct },
|
126
|
+
:class_name => 'Mdm::Module::Detail',
|
127
|
+
:source => :detail,
|
128
|
+
:through => :module_refs
|
129
|
+
|
130
|
+
|
131
|
+
#
|
132
|
+
# Attributes
|
133
|
+
#
|
134
|
+
|
135
|
+
# @!attribute [rw] exploited_at
|
136
|
+
# When the vulnerability was exploited
|
137
|
+
#
|
138
|
+
# @return [DateTime]
|
139
|
+
|
140
|
+
# @!attribute [rw] name
|
141
|
+
# The name of the vulnerability in metasploit-framework or from the import source.
|
142
|
+
#
|
143
|
+
# @return [String]
|
144
|
+
|
145
|
+
# @!attribute [rw] info
|
146
|
+
# Additional information about the vulnerability
|
147
|
+
#
|
148
|
+
# @return [String]
|
149
|
+
|
150
|
+
# @!attribute [rw] vuln_attempt_count
|
151
|
+
# Counter cache for number of {#vuln_attempts}.
|
152
|
+
#
|
153
|
+
# @return [Integer]
|
154
|
+
|
155
|
+
# @!attribute [rw] vuln_detail_count
|
156
|
+
# Counter cache for number of {#vuln_details}.
|
157
|
+
#
|
158
|
+
# @return [Integer]
|
159
|
+
|
160
|
+
#
|
161
|
+
# Callbacks
|
162
|
+
#
|
163
|
+
|
164
|
+
after_update :save_refs
|
165
|
+
|
166
|
+
#
|
167
|
+
# Scopes
|
168
|
+
#
|
169
|
+
|
170
|
+
scope :search, lambda { |query|
|
171
|
+
formatted_query = "%#{query}%"
|
172
|
+
where(
|
173
|
+
arel_table[:name].matches(formatted_query).or(
|
174
|
+
arel_table[:info].matches(formatted_query)
|
175
|
+
).or(
|
176
|
+
Mdm::Ref.arel_table[:name].matches(formatted_query)
|
177
|
+
).or(
|
178
|
+
Arel::Nodes::NamedFunction.new('CAST', [Mdm::Host.arel_table[:address].as('TEXT')]).matches(formatted_query)
|
179
|
+
).or(
|
180
|
+
Mdm::Host.arel_table[:name].matches(formatted_query)
|
181
|
+
)
|
182
|
+
).includes(
|
183
|
+
:refs, :host
|
184
|
+
).references(:refs,:host)
|
185
|
+
}
|
186
|
+
|
187
|
+
#
|
188
|
+
# Validations
|
189
|
+
#
|
190
|
+
|
191
|
+
validates :name, :presence => true
|
192
|
+
validates :name, length: {maximum: 255}
|
193
|
+
validates_associated :refs
|
194
|
+
|
195
|
+
private
|
196
|
+
|
197
|
+
def save_refs
|
198
|
+
refs.each { |ref| ref.save(:validate => false) }
|
199
|
+
end
|
200
|
+
|
201
|
+
public
|
202
|
+
|
203
|
+
Metasploit::Concern.run(self)
|
204
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# An attempt to exploit a {#vuln}.
|
2
|
+
class Mdm::VulnAttempt < ApplicationRecord
|
3
|
+
|
4
|
+
#
|
5
|
+
# Associations
|
6
|
+
#
|
7
|
+
|
8
|
+
# Loot gathered from this attempt.
|
9
|
+
#
|
10
|
+
# @return [Mdm::Loot] if {#exploited} is `true`.
|
11
|
+
# @return [nil] if {#exploited} is `false`.
|
12
|
+
belongs_to :loot,
|
13
|
+
class_name: 'Mdm::Loot',
|
14
|
+
inverse_of: :vuln_attempt
|
15
|
+
|
16
|
+
# The session opened by this attempt.
|
17
|
+
#
|
18
|
+
# @return [Mdm::Session] if {#exploited} is `true`.
|
19
|
+
# @return [nil] if {#exploited} is `false`.
|
20
|
+
belongs_to :session,
|
21
|
+
class_name: 'Mdm::Session',
|
22
|
+
inverse_of: :vuln_attempt
|
23
|
+
|
24
|
+
# The {Mdm::Vuln vulnerability} that this attempt was exploiting.
|
25
|
+
#
|
26
|
+
# @return [Mdm::Vuln]
|
27
|
+
belongs_to :vuln,
|
28
|
+
class_name: 'Mdm::Vuln',
|
29
|
+
counter_cache: :vuln_attempt_count,
|
30
|
+
inverse_of: :vuln_attempts
|
31
|
+
|
32
|
+
#
|
33
|
+
# Attributes
|
34
|
+
#
|
35
|
+
|
36
|
+
# @!attribute attempted_at
|
37
|
+
# When this attempt was made.
|
38
|
+
#
|
39
|
+
# @return [DateTime]
|
40
|
+
|
41
|
+
# @!attribute exploited
|
42
|
+
# Whether this attempt was successful.
|
43
|
+
#
|
44
|
+
# @return [true] if {#vuln} was exploited.
|
45
|
+
# @return [false] if {#vuln} was not exploited.
|
46
|
+
|
47
|
+
# @!attribute fail_detail
|
48
|
+
# Long details about why this attempt failed.
|
49
|
+
#
|
50
|
+
# @return [String] if {#exploited} is `false`.
|
51
|
+
# @return [nil] if {#exploited} is `true`.
|
52
|
+
|
53
|
+
# @!attribute fail_reason
|
54
|
+
# Short reason why this attempt failed.
|
55
|
+
#
|
56
|
+
# @return [String] if {#exploited} is `false`.
|
57
|
+
# @return [nil] if {#exploited} is `true`
|
58
|
+
|
59
|
+
# @!attribute module
|
60
|
+
# {Mdm::Module::Detail#fullname Full name of exploit Metasploit Module} that was used in this attempt.
|
61
|
+
#
|
62
|
+
# @return [String]
|
63
|
+
|
64
|
+
# @!attribute username
|
65
|
+
# The {Mdm::User#username name of the user} that made this attempt.
|
66
|
+
#
|
67
|
+
# @return [String]
|
68
|
+
|
69
|
+
#
|
70
|
+
# Validations
|
71
|
+
#
|
72
|
+
|
73
|
+
validates :vuln_id, :presence => true
|
74
|
+
|
75
|
+
Metasploit::Concern.run(self)
|
76
|
+
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
# {Mdm::Vuln Vulnerability details} supplied from an external source, such as Nexpose.
|
2
|
+
class Mdm::VulnDetail < ApplicationRecord
|
3
|
+
#
|
4
|
+
# Associations
|
5
|
+
#
|
6
|
+
|
7
|
+
# The vulnerability this detail is about.
|
8
|
+
belongs_to :vuln, class_name: 'Mdm::Vuln', counter_cache: :vuln_detail_count, inverse_of: :vuln_details
|
9
|
+
|
10
|
+
#
|
11
|
+
#
|
12
|
+
# Attributes
|
13
|
+
#
|
14
|
+
#
|
15
|
+
|
16
|
+
# @!attribute description
|
17
|
+
# Long description of this vulnerability.
|
18
|
+
#
|
19
|
+
# @return [String]
|
20
|
+
|
21
|
+
# @!attribute src
|
22
|
+
# Source of this vulnerability detail.
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
|
26
|
+
# @!attribute title
|
27
|
+
# Title of this vulnerability.
|
28
|
+
#
|
29
|
+
# @return [String]
|
30
|
+
|
31
|
+
# @!attribute proof
|
32
|
+
# Proof of this vulnerability existing on the target.
|
33
|
+
#
|
34
|
+
# @return [String]
|
35
|
+
|
36
|
+
# @!attribute solution
|
37
|
+
# Solution to fix this vulnerability.
|
38
|
+
#
|
39
|
+
# @return [String]
|
40
|
+
|
41
|
+
#
|
42
|
+
# @!group Common Vulnerability Scoring System
|
43
|
+
#
|
44
|
+
|
45
|
+
# @!attribute cvss_score
|
46
|
+
# Composite Common Vulnerability Scoring System (CVSS) Score
|
47
|
+
#
|
48
|
+
# @return [Float]
|
49
|
+
|
50
|
+
# @!attribute cvss_vector
|
51
|
+
# {#cvss_score} broken down into its encoded components
|
52
|
+
#
|
53
|
+
# @return [String]
|
54
|
+
# @see http://nvd.nist.gov/cvss.cfm?vectorinfo
|
55
|
+
|
56
|
+
#
|
57
|
+
# @!endgroup
|
58
|
+
#
|
59
|
+
|
60
|
+
#
|
61
|
+
# @!group Nexpose
|
62
|
+
#
|
63
|
+
|
64
|
+
# association is declared here so it can be in Nexpose group
|
65
|
+
|
66
|
+
# The Nexpose console that supplied this information.
|
67
|
+
belongs_to :nexpose_console,
|
68
|
+
class_name: 'Mdm::NexposeConsole',
|
69
|
+
foreign_key: :nx_console_id,
|
70
|
+
inverse_of: :vuln_details
|
71
|
+
|
72
|
+
# @!attribute nx_added
|
73
|
+
# When this vulnerability was added in Nexpose.
|
74
|
+
#
|
75
|
+
# @return [DateTime]
|
76
|
+
|
77
|
+
# @!attribute nx_device_id
|
78
|
+
# ID of target device in Nexpose.
|
79
|
+
#
|
80
|
+
# @return [Integer]
|
81
|
+
|
82
|
+
# @!attribute nx_modified
|
83
|
+
# The last time this vulnerability was modified in Nexpose.
|
84
|
+
#
|
85
|
+
# @return [DateTime]
|
86
|
+
|
87
|
+
# @!attribute nx_proof_key
|
88
|
+
# Key to {#proof} in Nexpose.
|
89
|
+
#
|
90
|
+
# @return [String]
|
91
|
+
|
92
|
+
# @!attribute nx_published
|
93
|
+
# When this vulnerability was published according to Nexpose.
|
94
|
+
#
|
95
|
+
# @return [DateTime]
|
96
|
+
|
97
|
+
# @!attribute nx_scan_id
|
98
|
+
# ID of scan that found this vulnerability in Nexpose.
|
99
|
+
#
|
100
|
+
# @return [Integer]
|
101
|
+
|
102
|
+
# @!attribute nx_tags
|
103
|
+
# Tags on this vulnerability in Nexpose.
|
104
|
+
#
|
105
|
+
# @return [String]
|
106
|
+
|
107
|
+
# @!attribute nx_vuln_id
|
108
|
+
# ID of this vulnerability in Nexpose.
|
109
|
+
#
|
110
|
+
# @return [String]
|
111
|
+
|
112
|
+
# @!attribute nx_vuln_status
|
113
|
+
# Status of this vulnerability in Nexpose.
|
114
|
+
#
|
115
|
+
# @return [String]
|
116
|
+
|
117
|
+
# @!attribute nx_vulnerable_since
|
118
|
+
# When this vulnerability was first identified for the target in Nexpose.
|
119
|
+
#
|
120
|
+
# @return [DateTime]
|
121
|
+
|
122
|
+
# @!attribute nx_severity
|
123
|
+
# Severity of this vulnerability according to Nexpose.
|
124
|
+
#
|
125
|
+
# @return [Float]
|
126
|
+
|
127
|
+
#
|
128
|
+
# @!endgroup
|
129
|
+
#
|
130
|
+
|
131
|
+
#
|
132
|
+
# @!group Nexpose PCI
|
133
|
+
#
|
134
|
+
|
135
|
+
# @!attribute nx_pci_compliance_status
|
136
|
+
# Status of PCI compliance with regards to this vulnerability according to Nexpose.
|
137
|
+
#
|
138
|
+
# @return [String]
|
139
|
+
|
140
|
+
# @!attribute nx_pci_severity
|
141
|
+
# The severity for the vulnerability under PCI according to Nexpose.
|
142
|
+
#
|
143
|
+
# @return [Float]
|
144
|
+
|
145
|
+
#
|
146
|
+
# @!endgroup
|
147
|
+
#
|
148
|
+
|
149
|
+
#
|
150
|
+
# Validations
|
151
|
+
#
|
152
|
+
|
153
|
+
validates :vuln_id, :presence => true
|
154
|
+
|
155
|
+
Metasploit::Concern.run(self)
|
156
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Join model between {Mdm::Vuln} and {Mdm::Ref}.
|
2
|
+
class Mdm::VulnRef < ApplicationRecord
|
3
|
+
self.table_name = 'vulns_refs'
|
4
|
+
|
5
|
+
#
|
6
|
+
# Associations
|
7
|
+
#
|
8
|
+
|
9
|
+
# {Mdm::Ref Reference} to {#vuln}.
|
10
|
+
belongs_to :ref,
|
11
|
+
class_name: 'Mdm::Ref',
|
12
|
+
inverse_of: :vulns_refs
|
13
|
+
|
14
|
+
# {Mdm::Vuln Vulnerability} imported or discovered by metasploit.
|
15
|
+
belongs_to :vuln,
|
16
|
+
class_name: 'Mdm::Vuln',
|
17
|
+
inverse_of: :vulns_refs
|
18
|
+
|
19
|
+
Metasploit::Concern.run(self)
|
20
|
+
end
|
21
|
+
|