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,203 @@
|
|
1
|
+
# A session opened on a {#host} using an {#via_exploit exploit} and controlled through a {#via_payload payload} to
|
2
|
+
# connect back to the local host using meterpreter or a cmd shell.
|
3
|
+
class Mdm::Session < ApplicationRecord
|
4
|
+
|
5
|
+
#
|
6
|
+
# Associations
|
7
|
+
#
|
8
|
+
|
9
|
+
# @!attribute [rw] events
|
10
|
+
# Events that occurred when this session was open.
|
11
|
+
#
|
12
|
+
# @return [Array<Mdm::Event>]
|
13
|
+
has_many :events,
|
14
|
+
-> { order('created_at') },
|
15
|
+
class_name: 'Mdm::SessionEvent',
|
16
|
+
dependent: :delete_all,
|
17
|
+
inverse_of: :session
|
18
|
+
|
19
|
+
# @!attribute exploit_attempt
|
20
|
+
# Exploit attempt that created this session.
|
21
|
+
#
|
22
|
+
# @return [Mdm::ExploitAttempt]
|
23
|
+
has_one :exploit_attempt,
|
24
|
+
class_name: 'Mdm::ExploitAttempt',
|
25
|
+
inverse_of: :session
|
26
|
+
|
27
|
+
# @!attribute [rw] host
|
28
|
+
# {Mdm::Host Host} on which this session was opened.
|
29
|
+
#
|
30
|
+
# @return [Mdm::Host]
|
31
|
+
belongs_to :host,
|
32
|
+
class_name: 'Mdm::Host',
|
33
|
+
inverse_of: :sessions
|
34
|
+
|
35
|
+
# @!attribute [rw] routes
|
36
|
+
# Routes tunneled throug this session.
|
37
|
+
#
|
38
|
+
# @return [ActiveRecord::Relation<Mdm::Route>]
|
39
|
+
has_many :routes,
|
40
|
+
class_name: 'Mdm::Route',
|
41
|
+
dependent: :delete_all,
|
42
|
+
inverse_of: :session
|
43
|
+
|
44
|
+
# @!attribute [rw] originating_module_run
|
45
|
+
# Records the Metasploit modules run that created this session
|
46
|
+
#
|
47
|
+
# @return [MetasploitDataModels::ModuleRun]
|
48
|
+
belongs_to :originating_module_run,
|
49
|
+
class_name: 'MetasploitDataModels::ModuleRun',
|
50
|
+
foreign_key: :module_run_id,
|
51
|
+
inverse_of: :spawned_session
|
52
|
+
|
53
|
+
# @!attribute [rw] target_module_runs
|
54
|
+
# Records the Metasploit modules run on this session
|
55
|
+
#
|
56
|
+
# @return [ActiveRecord::Relation<MetasploitDataModels::ModuleRun>]
|
57
|
+
has_many :target_module_runs,
|
58
|
+
class_name: 'MetasploitDataModels::ModuleRun',
|
59
|
+
inverse_of: :target_session
|
60
|
+
|
61
|
+
# @!attribute vuln_attempt
|
62
|
+
# Vulnerability attempt that created this session.
|
63
|
+
#
|
64
|
+
# @return [Mdm::VulnAttempt]
|
65
|
+
has_one :vuln_attempt,
|
66
|
+
class_name: 'Mdm::VulnAttempt',
|
67
|
+
inverse_of: :session
|
68
|
+
|
69
|
+
#
|
70
|
+
# Through :host
|
71
|
+
#
|
72
|
+
|
73
|
+
# @!attribute [r] workspace
|
74
|
+
# The workspace in which this session exists.
|
75
|
+
#
|
76
|
+
# @return [Mdm::Workspace]
|
77
|
+
has_one :workspace, :through => :host, :class_name => 'Mdm::Workspace'
|
78
|
+
|
79
|
+
# @!attribute [rw] task_sessions
|
80
|
+
# Details about sessions this task touched
|
81
|
+
#
|
82
|
+
# @return [Array<Mdm::TaskSession>]
|
83
|
+
has_many :task_sessions, :dependent => :destroy, :class_name => 'Mdm::TaskSession'
|
84
|
+
|
85
|
+
# @!attribute [rw] task
|
86
|
+
# Session this task touched
|
87
|
+
#
|
88
|
+
# @return [Mdm::Session]
|
89
|
+
has_many :tasks, :through => :task_sessions, :class_name => 'Mdm::Task'
|
90
|
+
|
91
|
+
#
|
92
|
+
# Attributes
|
93
|
+
#
|
94
|
+
|
95
|
+
# @!attribute [rw] closed_at
|
96
|
+
# When the session was closed on {#host}.
|
97
|
+
#
|
98
|
+
# @return [DateTime]
|
99
|
+
|
100
|
+
# @!attribute [rw] close_reason
|
101
|
+
# Why the session was closed. Used to differentiate between user killing it local and the session being killed on
|
102
|
+
# the remote end.
|
103
|
+
#
|
104
|
+
# @return [String]
|
105
|
+
|
106
|
+
# @!attribute [rw] datastore
|
107
|
+
# Options for {#via_exploit exploit} and {#via_payload} modules.
|
108
|
+
#
|
109
|
+
# @return [Hash]
|
110
|
+
|
111
|
+
# @!attribute [rw] desc
|
112
|
+
# Description of session.
|
113
|
+
#
|
114
|
+
# @return [String]
|
115
|
+
|
116
|
+
# @!attribute [rw] last_seen
|
117
|
+
# The last time the session was checked to see that it was still open.
|
118
|
+
#
|
119
|
+
# @return [DateTime]
|
120
|
+
|
121
|
+
# @!attribute [rw] local_id
|
122
|
+
# The ID number of the in-memory session.
|
123
|
+
#
|
124
|
+
# @return [Integer]
|
125
|
+
|
126
|
+
# @!attribute [rw] opened_at
|
127
|
+
# When the session was opened on {#host}.
|
128
|
+
#
|
129
|
+
# @return [DateTime]
|
130
|
+
|
131
|
+
# @!attribute [rw] platform
|
132
|
+
# The {#host} platform.
|
133
|
+
#
|
134
|
+
# @return [String]
|
135
|
+
|
136
|
+
# @!attribute [rw] port
|
137
|
+
# The remote port on which this session is running on {#host}.
|
138
|
+
#
|
139
|
+
# @return [Integer]
|
140
|
+
|
141
|
+
# @!attribute [rw] stype
|
142
|
+
# The type of the session.
|
143
|
+
#
|
144
|
+
# @return [String]
|
145
|
+
|
146
|
+
# @!attribute [rw] via_exploit
|
147
|
+
# The {Mdm::Module::Detail#fullname full name} of the exploit module that opened this session.
|
148
|
+
#
|
149
|
+
# @return [String]
|
150
|
+
|
151
|
+
# @!attribute [rw] via_payload
|
152
|
+
# The {Mdm::Module::Detail#fullname full name} if the payload module that's running this session.
|
153
|
+
#
|
154
|
+
# @return [String]
|
155
|
+
|
156
|
+
#
|
157
|
+
# Callbacks
|
158
|
+
#
|
159
|
+
|
160
|
+
before_destroy :stop
|
161
|
+
|
162
|
+
#
|
163
|
+
# Scopes
|
164
|
+
#
|
165
|
+
|
166
|
+
scope :alive, -> { where('closed_at IS NULL') }
|
167
|
+
scope :dead, -> { where('closed_at IS NOT NULL') }
|
168
|
+
scope :upgradeable, -> { where("closed_at IS NULL AND stype = 'shell' and platform ILIKE '%win%'") }
|
169
|
+
|
170
|
+
#
|
171
|
+
# Serializations
|
172
|
+
#
|
173
|
+
|
174
|
+
serialize :datastore, ::MetasploitDataModels::Base64Serializer.new
|
175
|
+
|
176
|
+
# Returns whether the session can be upgraded to a meterpreter session from a shell session on Windows.
|
177
|
+
#
|
178
|
+
# @return [true] if {#platform} is some version of Windows and {#stype} is `'shell'`.
|
179
|
+
# @return [false] otherwise.
|
180
|
+
def upgradeable?
|
181
|
+
if (self.platform =~ /win/i and self.stype == 'shell')
|
182
|
+
return true
|
183
|
+
else
|
184
|
+
return false
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
private
|
189
|
+
|
190
|
+
# Stops and closes the session.
|
191
|
+
#
|
192
|
+
# @todo https://www.pivotaltracker.com/story/show/49026497
|
193
|
+
# @return [void]
|
194
|
+
def stop
|
195
|
+
c = Pro::Client.get rescue nil
|
196
|
+
# ignore exceptions (XXX - ideally, stopped an already-stopped session wouldn't throw XMLRPCException)
|
197
|
+
c.session_stop(self.local_id) rescue nil
|
198
|
+
end
|
199
|
+
|
200
|
+
public
|
201
|
+
|
202
|
+
Metasploit::Concern.run(self)
|
203
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Events that occurred when using a {#session}.
|
2
|
+
class Mdm::SessionEvent < ApplicationRecord
|
3
|
+
|
4
|
+
#
|
5
|
+
# Associations
|
6
|
+
#
|
7
|
+
|
8
|
+
# The session in which the event occurred.
|
9
|
+
belongs_to :session,
|
10
|
+
class_name: 'Mdm::Session',
|
11
|
+
inverse_of: :events
|
12
|
+
|
13
|
+
# @!attribute command
|
14
|
+
# The command that was run through the session that triggered this event.
|
15
|
+
#
|
16
|
+
# @return [String]
|
17
|
+
|
18
|
+
# @!attribute created_at
|
19
|
+
# When this event occurred.
|
20
|
+
#
|
21
|
+
# @return [DateTime]
|
22
|
+
|
23
|
+
# @!attribute etype
|
24
|
+
# The type of the event.
|
25
|
+
#
|
26
|
+
# @return [String]
|
27
|
+
|
28
|
+
# @!attribute local_path
|
29
|
+
# The current local directory when {#command} was run.
|
30
|
+
#
|
31
|
+
# @return [String]
|
32
|
+
|
33
|
+
# @!attribute output
|
34
|
+
# The {#output} of running {#command}.
|
35
|
+
#
|
36
|
+
# @return [String]
|
37
|
+
|
38
|
+
# @!attribute remote_path
|
39
|
+
# The current remote directory when {#command} was run.
|
40
|
+
#
|
41
|
+
# @return [String]
|
42
|
+
|
43
|
+
Metasploit::Concern.run(self)
|
44
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# Tag {#hosts_tags assigned} to {#hosts}. Tags can be used to group together hosts for targeting and reporting.
|
2
|
+
class Mdm::Tag < ApplicationRecord
|
3
|
+
include Metasploit::Model::Search
|
4
|
+
|
5
|
+
#
|
6
|
+
# Associations
|
7
|
+
#
|
8
|
+
|
9
|
+
# Joins {#hosts} to this tag.
|
10
|
+
has_many :hosts_tags,
|
11
|
+
class_name: 'Mdm::HostTag',
|
12
|
+
dependent: :destroy,
|
13
|
+
inverse_of: :tag
|
14
|
+
|
15
|
+
# User that created this tag.
|
16
|
+
belongs_to :user,
|
17
|
+
class_name: 'Mdm::User',
|
18
|
+
inverse_of: :tags
|
19
|
+
|
20
|
+
#
|
21
|
+
# through: :hosts_tags
|
22
|
+
#
|
23
|
+
|
24
|
+
# Hosts that are tagged with this tag.
|
25
|
+
has_many :hosts, :through => :hosts_tags, :class_name => 'Mdm::Host'
|
26
|
+
|
27
|
+
#
|
28
|
+
# Attributes
|
29
|
+
#
|
30
|
+
|
31
|
+
# @!attribute created_at
|
32
|
+
# When this tag was created by {#user}.
|
33
|
+
#
|
34
|
+
# @return [DateTime]
|
35
|
+
|
36
|
+
# @!attribute critical
|
37
|
+
# Whether this tag represents a critical finding about the {#hosts}.
|
38
|
+
#
|
39
|
+
# @return [true] this tag is critical.
|
40
|
+
# @return [false] this tag is non-critical.
|
41
|
+
|
42
|
+
# @!attribute desc
|
43
|
+
# Longer description of what this tag should be used for or means when applied to a {#hosts host}.
|
44
|
+
#
|
45
|
+
# @return [String]
|
46
|
+
|
47
|
+
# @!attribute name
|
48
|
+
# The name of the tag. The name is what a user actually enters to tag a {#hosts host}.
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
|
52
|
+
# @!attribute report_detail
|
53
|
+
# Whether to include this tag in a report details section.
|
54
|
+
#
|
55
|
+
# @return [true] include this tag in the report details section.
|
56
|
+
# @return [false] do not include this tag in the report details section.
|
57
|
+
|
58
|
+
# @!attribute report_summary
|
59
|
+
# Whether to include this tag in a report summary section.
|
60
|
+
#
|
61
|
+
# @return [true] include this tag in the report summary section.
|
62
|
+
# @return [false] do not include this tag in the report summary section.
|
63
|
+
|
64
|
+
# @!attribute updated_at
|
65
|
+
# The last time this tag was updated.
|
66
|
+
#
|
67
|
+
# @return [DateTime]
|
68
|
+
|
69
|
+
#
|
70
|
+
# Search
|
71
|
+
#
|
72
|
+
|
73
|
+
search_attribute :desc,
|
74
|
+
type: :string
|
75
|
+
search_attribute :name,
|
76
|
+
type: :string
|
77
|
+
|
78
|
+
#
|
79
|
+
# Validations
|
80
|
+
#
|
81
|
+
|
82
|
+
validates :desc,
|
83
|
+
:length => {
|
84
|
+
:maximum => ((8 * (2 ** 10)) - 1),
|
85
|
+
:message => I18n.t('activerecord.ancestors.mdm/tag.model.errors.messages.length')
|
86
|
+
}
|
87
|
+
validates :name,
|
88
|
+
:format => {
|
89
|
+
:with => /\A[A-Za-z0-9\x2e\x2d_]+\z/, :message => I18n.t('activerecord.ancestors.mdm/tag.model.errors.messages.character')
|
90
|
+
},
|
91
|
+
:presence => true
|
92
|
+
|
93
|
+
#
|
94
|
+
# Instance Methods
|
95
|
+
#
|
96
|
+
|
97
|
+
# Destroy this tag if it has no {#hosts_tags}
|
98
|
+
#
|
99
|
+
# @return [void]
|
100
|
+
def destroy_if_orphaned
|
101
|
+
self.class.transaction do
|
102
|
+
if hosts_tags.empty?
|
103
|
+
destroy
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# (see #name)
|
109
|
+
def to_s
|
110
|
+
name
|
111
|
+
end
|
112
|
+
|
113
|
+
Metasploit::Concern.run(self)
|
114
|
+
end
|
@@ -0,0 +1,168 @@
|
|
1
|
+
# A task run by Metasploit Pro.
|
2
|
+
class Mdm::Task < ApplicationRecord
|
3
|
+
#
|
4
|
+
#
|
5
|
+
# Associations
|
6
|
+
#
|
7
|
+
#
|
8
|
+
|
9
|
+
# Listeners spawned by this task
|
10
|
+
has_many :listeners,
|
11
|
+
class_name: 'Mdm::Listener',
|
12
|
+
dependent: :destroy,
|
13
|
+
inverse_of: :task
|
14
|
+
|
15
|
+
# Joins this to {#creds}.
|
16
|
+
has_many :task_creds,
|
17
|
+
class_name: 'Mdm::TaskCred',
|
18
|
+
dependent: :destroy,
|
19
|
+
inverse_of: :task
|
20
|
+
|
21
|
+
# Joins this to {#hosts}.
|
22
|
+
has_many :task_hosts,
|
23
|
+
class_name: 'Mdm::TaskHost',
|
24
|
+
dependent: :destroy,
|
25
|
+
inverse_of: :task
|
26
|
+
|
27
|
+
# Joins this to {#services}.
|
28
|
+
has_many :task_services,
|
29
|
+
class_name: 'Mdm::TaskService',
|
30
|
+
dependent: :destroy,
|
31
|
+
inverse_of: :task
|
32
|
+
|
33
|
+
# Joins this to {#sessions}.
|
34
|
+
has_many :task_sessions,
|
35
|
+
class_name: 'Mdm::TaskSession',
|
36
|
+
dependent: :destroy,
|
37
|
+
inverse_of: :task
|
38
|
+
|
39
|
+
# The Workspace the Task belongs to
|
40
|
+
belongs_to :workspace,
|
41
|
+
class_name: 'Mdm::Workspace',
|
42
|
+
inverse_of: :tasks
|
43
|
+
|
44
|
+
#
|
45
|
+
# through: :task_creds
|
46
|
+
#
|
47
|
+
|
48
|
+
# Creds this task touched
|
49
|
+
has_many :creds, :through => :task_creds, :class_name => 'Mdm::Cred'
|
50
|
+
|
51
|
+
#
|
52
|
+
# through: :task_hosts
|
53
|
+
#
|
54
|
+
|
55
|
+
# Hosts this task touched
|
56
|
+
has_many :hosts, :through => :task_hosts, :class_name => 'Mdm::Host'
|
57
|
+
|
58
|
+
#
|
59
|
+
# through: :task_services
|
60
|
+
#
|
61
|
+
|
62
|
+
# Services this task touched
|
63
|
+
has_many :services, :through => :task_services, :class_name => 'Mdm::Service'
|
64
|
+
|
65
|
+
#
|
66
|
+
# through: :task_sessions
|
67
|
+
#
|
68
|
+
|
69
|
+
# Session this task touched
|
70
|
+
has_many :sessions, :through => :task_sessions, :class_name => 'Mdm::Session'
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
# @!attribute created_by
|
76
|
+
# {Mdm::User#username Name of user} that created this task.
|
77
|
+
#
|
78
|
+
# @return [String]
|
79
|
+
|
80
|
+
# @!attribute description
|
81
|
+
# Description of what the this task does.
|
82
|
+
#
|
83
|
+
# @return [String]
|
84
|
+
|
85
|
+
# @!attribute error
|
86
|
+
# Error raised while task was running that caused this task to fail.
|
87
|
+
#
|
88
|
+
# @return [String]
|
89
|
+
|
90
|
+
# @!attribute info
|
91
|
+
# Information about the task's current status. What the task is currently doing.
|
92
|
+
#
|
93
|
+
# @return [String]
|
94
|
+
|
95
|
+
# @!attribute module
|
96
|
+
# {Mdm::Module::Class#full_name Module full name} that was run for this task.
|
97
|
+
#
|
98
|
+
# @return [String]
|
99
|
+
|
100
|
+
# @!attribute module_uuid
|
101
|
+
# UUID of `#module` that was run by this task.
|
102
|
+
#
|
103
|
+
# @return [String]
|
104
|
+
|
105
|
+
# @!attribute path
|
106
|
+
# Path to the log for this task.
|
107
|
+
#
|
108
|
+
# @return [String]
|
109
|
+
|
110
|
+
# @!attribute progress
|
111
|
+
# Percentage complete.
|
112
|
+
#
|
113
|
+
# @return [Integer]
|
114
|
+
|
115
|
+
# @!attribute updated_at
|
116
|
+
# When this task was last updated.
|
117
|
+
#
|
118
|
+
# @return [DateTime]
|
119
|
+
|
120
|
+
#
|
121
|
+
# Callbacks
|
122
|
+
#
|
123
|
+
|
124
|
+
before_destroy :delete_file
|
125
|
+
|
126
|
+
#
|
127
|
+
# Serializations
|
128
|
+
#
|
129
|
+
|
130
|
+
# Options passed to `#module`.
|
131
|
+
#
|
132
|
+
# @return [Hash]
|
133
|
+
serialize :options, MetasploitDataModels::Base64Serializer.new
|
134
|
+
|
135
|
+
# Result of task running.
|
136
|
+
#
|
137
|
+
# @return [Hash]
|
138
|
+
serialize :result, MetasploitDataModels::Base64Serializer.new
|
139
|
+
|
140
|
+
# Settings used to configure this task outside of the {#options module options}.
|
141
|
+
#
|
142
|
+
# @return [Hash]
|
143
|
+
serialize :settings, MetasploitDataModels::Base64Serializer.new
|
144
|
+
|
145
|
+
#
|
146
|
+
# Instance Methods
|
147
|
+
#
|
148
|
+
|
149
|
+
private
|
150
|
+
|
151
|
+
# Deletes {#path log} on-disk, so that disk is cleaned up when this task is deleted from the database.
|
152
|
+
#
|
153
|
+
# @return [void]
|
154
|
+
def delete_file
|
155
|
+
c = Pro::Client.get rescue nil
|
156
|
+
if c
|
157
|
+
c.task_delete_log(self[:id]) if c
|
158
|
+
else
|
159
|
+
::File.unlink(self.path) rescue nil
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# Restore public for load hooks
|
164
|
+
public
|
165
|
+
|
166
|
+
Metasploit::Concern.run(self)
|
167
|
+
end
|
168
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# @deprecated {Mdm::Task} has and belongs to many `Metasploit::Credential::Cores` in `Mdm::Task#credential_cores` and
|
2
|
+
# has and belongs to many `Metasploit::Credential::Logins` in `Mdm::Task#credential_logins` when the
|
3
|
+
# `Metasploit::Credential::Engine` is installed.
|
4
|
+
#
|
5
|
+
# Join model between {Mdm::Cred} and {Mdm::Task} that signifies that the {#task} found the {#cred}.
|
6
|
+
class Mdm::TaskCred < ApplicationRecord
|
7
|
+
#
|
8
|
+
# Associations
|
9
|
+
#
|
10
|
+
|
11
|
+
# The {Mdm::Cred} found by {#task}.
|
12
|
+
belongs_to :cred,
|
13
|
+
class_name: 'Mdm::Cred',
|
14
|
+
inverse_of: :task_creds
|
15
|
+
|
16
|
+
# An {Mdm::Task} that found {#cred}.
|
17
|
+
belongs_to :task,
|
18
|
+
class_name: 'Mdm::Task',
|
19
|
+
inverse_of: :task_creds
|
20
|
+
|
21
|
+
#
|
22
|
+
# Attributes
|
23
|
+
#
|
24
|
+
|
25
|
+
# @!attribute [rw] created_at
|
26
|
+
# When this task cred was created.
|
27
|
+
#
|
28
|
+
# @return [DateTime]
|
29
|
+
|
30
|
+
# @!attribute [rw] updated_at
|
31
|
+
# The last time this task cred was updated.
|
32
|
+
#
|
33
|
+
# @return [DateTime]
|
34
|
+
|
35
|
+
#
|
36
|
+
# Validations
|
37
|
+
#
|
38
|
+
|
39
|
+
validates :cred_id,
|
40
|
+
:uniqueness => {
|
41
|
+
:scope => :task_id
|
42
|
+
}
|
43
|
+
|
44
|
+
Metasploit::Concern.run(self)
|
45
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Join model between {Mdm::Host} and {Mdm::Task} that signifies that the {#task} found the {#host}.
|
2
|
+
class Mdm::TaskHost < ApplicationRecord
|
3
|
+
#
|
4
|
+
# Associations
|
5
|
+
#
|
6
|
+
|
7
|
+
# The {Mdm::Host} found by {#task}.
|
8
|
+
belongs_to :host,
|
9
|
+
class_name: 'Mdm::Host',
|
10
|
+
inverse_of: :task_hosts
|
11
|
+
|
12
|
+
# An {Mdm::Task} that found {#host}.
|
13
|
+
belongs_to :task,
|
14
|
+
class_name: 'Mdm::Task',
|
15
|
+
inverse_of: :task_hosts
|
16
|
+
|
17
|
+
#
|
18
|
+
# Attributes
|
19
|
+
#
|
20
|
+
|
21
|
+
# @!attribute created_at
|
22
|
+
# When this task host was created.
|
23
|
+
#
|
24
|
+
# @return [DateTime]
|
25
|
+
|
26
|
+
# @!attribute updated_at
|
27
|
+
# The last time this task host was updated.
|
28
|
+
#
|
29
|
+
# @return [DateTime]
|
30
|
+
|
31
|
+
#
|
32
|
+
# Validations
|
33
|
+
#
|
34
|
+
|
35
|
+
validates :host_id,
|
36
|
+
:uniqueness => {
|
37
|
+
:scope => :task_id
|
38
|
+
}
|
39
|
+
|
40
|
+
Metasploit::Concern.run(self)
|
41
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Join model between {Mdm::Service} and {Mdm::Task} that signifies that the {#task} found the {#service}.
|
2
|
+
class Mdm::TaskService < ApplicationRecord
|
3
|
+
#
|
4
|
+
# Associations
|
5
|
+
#
|
6
|
+
|
7
|
+
# The {Mdm::Service} found by {#task}.
|
8
|
+
belongs_to :service,
|
9
|
+
class_name: 'Mdm::Service',
|
10
|
+
inverse_of: :task_services
|
11
|
+
|
12
|
+
# An {Mdm::Task} that found {#service}.
|
13
|
+
belongs_to :task,
|
14
|
+
class_name: 'Mdm::Task',
|
15
|
+
inverse_of: :task_services
|
16
|
+
|
17
|
+
#
|
18
|
+
# Attributes
|
19
|
+
#
|
20
|
+
|
21
|
+
# @!attribute created_at
|
22
|
+
# When this task service was created.
|
23
|
+
#
|
24
|
+
# @return [DateTime]
|
25
|
+
|
26
|
+
# @!attribute updated_at
|
27
|
+
# The last time this task service was updated.
|
28
|
+
#
|
29
|
+
# @return [DateTime]
|
30
|
+
|
31
|
+
#
|
32
|
+
# Validations
|
33
|
+
#
|
34
|
+
|
35
|
+
validates :service_id,
|
36
|
+
:uniqueness => {
|
37
|
+
:scope => :task_id
|
38
|
+
}
|
39
|
+
|
40
|
+
Metasploit::Concern.run(self)
|
41
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Join model between {Mdm::Session} and {Mdm::Task} that signifies that the {#task} spawned the {#session}.
|
2
|
+
class Mdm::TaskSession < ApplicationRecord
|
3
|
+
#
|
4
|
+
# Associations
|
5
|
+
#
|
6
|
+
|
7
|
+
# The {Mdm::Session} found by {#task}.
|
8
|
+
belongs_to :session,
|
9
|
+
class_name: 'Mdm::Session',
|
10
|
+
inverse_of: :task_sessions
|
11
|
+
|
12
|
+
# An {Mdm::Task} that found {#session}
|
13
|
+
belongs_to :task,
|
14
|
+
class_name: 'Mdm::Task',
|
15
|
+
inverse_of: :task_sessions
|
16
|
+
|
17
|
+
#
|
18
|
+
# Attributes
|
19
|
+
#
|
20
|
+
|
21
|
+
# @!attribute created_at
|
22
|
+
# When this task session was created.
|
23
|
+
#
|
24
|
+
# @return [DateTime]
|
25
|
+
|
26
|
+
# @!attribute updated_at
|
27
|
+
# The last time this task session was updated.
|
28
|
+
#
|
29
|
+
# @return [DateTime]
|
30
|
+
|
31
|
+
#
|
32
|
+
# Validations
|
33
|
+
#
|
34
|
+
|
35
|
+
validates :session_id,
|
36
|
+
:uniqueness => {
|
37
|
+
:scope => :task_id
|
38
|
+
}
|
39
|
+
|
40
|
+
Metasploit::Concern.run(self)
|
41
|
+
end
|