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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ceacf05a960fa9c22ddd6cc450672f0685a72c1c700c1adf01a1810f56e224f3
|
4
|
+
data.tar.gz: 7e7a93370a505fa7cc4fe475cc7b5df8843a2a4689c5ba0e7cf1be023c5acae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75eb272be274177281aa56b1d771bb02d8959ae589b9b8cc35fb98ede3fc08f2387785950b423410e6c9160463e74ddb6a280ac236213111f88d9e2c36238cd8
|
7
|
+
data.tar.gz: 69b8579d774dba31bbf04b6d47a91141816c814c5d725ace4a3f8fbe9a79594d9006ad8df7e5707d35041d2b699beb81d9a923c49767c5954e6e4fbcfe247f74
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
@@ -0,0 +1,68 @@
|
|
1
|
+
name: Verify
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- '*'
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- '*'
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
test:
|
13
|
+
runs-on: ubuntu-16.04
|
14
|
+
timeout-minutes: 40
|
15
|
+
|
16
|
+
services:
|
17
|
+
postgres:
|
18
|
+
image: postgres:9.6
|
19
|
+
ports: ["5432:5432"]
|
20
|
+
env:
|
21
|
+
POSTGRES_USER: postgres
|
22
|
+
POSTGRES_PASSWORD: postgres
|
23
|
+
options: >-
|
24
|
+
--health-cmd pg_isready
|
25
|
+
--health-interval 10s
|
26
|
+
--health-timeout 5s
|
27
|
+
--health-retries 5
|
28
|
+
|
29
|
+
strategy:
|
30
|
+
fail-fast: true
|
31
|
+
matrix:
|
32
|
+
ruby:
|
33
|
+
- 2.7
|
34
|
+
|
35
|
+
env:
|
36
|
+
RAILS_ENV: test
|
37
|
+
|
38
|
+
name: Ruby ${{ matrix.ruby }}
|
39
|
+
steps:
|
40
|
+
- name: Install system dependencies
|
41
|
+
run: sudo apt-get install libpcap-dev graphviz
|
42
|
+
|
43
|
+
- name: Checkout code
|
44
|
+
uses: actions/checkout@v2
|
45
|
+
|
46
|
+
- uses: actions/setup-ruby@v1
|
47
|
+
with:
|
48
|
+
ruby-version: ${{ matrix.ruby }}
|
49
|
+
|
50
|
+
- name: Setup bundler
|
51
|
+
run: |
|
52
|
+
gem install bundler
|
53
|
+
|
54
|
+
- name: Bundle install
|
55
|
+
run: |
|
56
|
+
bundle config path vendor/bundle
|
57
|
+
bundle install --jobs 4 --retry 3
|
58
|
+
|
59
|
+
- name: Test
|
60
|
+
run: |
|
61
|
+
cp spec/dummy/config/database.yml.github_actions spec/dummy/config/database.yml
|
62
|
+
bundle exec rake --version
|
63
|
+
bundle exec rake db:create db:migrate
|
64
|
+
|
65
|
+
# Disabling this check because it is proving unreliable
|
66
|
+
# git diff --exit-code spec/dummy/db/structure.sql
|
67
|
+
bundle exec rake spec
|
68
|
+
bundle exec rake yard
|
data/.gitignore
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# bundler configuration
|
2
|
+
.bundle
|
3
|
+
# Mac OS X folder attributes
|
4
|
+
.DS_Store
|
5
|
+
# built gems
|
6
|
+
*.gem
|
7
|
+
# Rubymine project configuration
|
8
|
+
.idea
|
9
|
+
# logs
|
10
|
+
*.log
|
11
|
+
# Don't check in new rvm version and gemset files
|
12
|
+
.ruby-gemset
|
13
|
+
.ruby-version
|
14
|
+
# Don't check in rvmrc since this is a gem
|
15
|
+
.rvmrc
|
16
|
+
# YARD database
|
17
|
+
.yardoc
|
18
|
+
# coverage report directory for simplecov/Rubymine
|
19
|
+
coverage
|
20
|
+
# generated yardocs
|
21
|
+
doc
|
22
|
+
# Installed gem versions. Not stored for the same reasons as .rvmrc
|
23
|
+
Gemfile.lock
|
24
|
+
# Packaging directory for builds
|
25
|
+
pkg/*
|
26
|
+
# Database configuration (with passwords) for specs
|
27
|
+
spec/dummy/config/database.yml
|
28
|
+
# Secrets
|
29
|
+
spec/dummy/tmp/*
|
data/.rspec
ADDED
data/.simplecov
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# RM_INFO is set when using Rubymine. In Rubymine, starting SimpleCov is
|
2
|
+
# controlled by running with coverage, so don't explicitly start coverage (and
|
3
|
+
# therefore generate a report) when in Rubymine. This _will_ generate a report
|
4
|
+
# whenever `rake spec` is run.
|
5
|
+
unless ENV['RM_INFO']
|
6
|
+
SimpleCov.start
|
7
|
+
end
|
8
|
+
|
9
|
+
SimpleCov.configure do
|
10
|
+
load_profile('rails')
|
11
|
+
|
12
|
+
# ignore this file
|
13
|
+
add_filter '.simplecov'
|
14
|
+
|
15
|
+
#
|
16
|
+
# Changed Files in Git Group
|
17
|
+
# @see http://fredwu.me/post/35625566267/simplecov-test-coverage-for-changed-files-only
|
18
|
+
#
|
19
|
+
|
20
|
+
untracked = `git ls-files --exclude-standard --others`
|
21
|
+
unstaged = `git diff --name-only`
|
22
|
+
staged = `git diff --name-only --cached`
|
23
|
+
all = untracked + unstaged + staged
|
24
|
+
changed_filenames = all.split("\n")
|
25
|
+
|
26
|
+
add_group 'Changed' do |source_file|
|
27
|
+
changed_filenames.detect { |changed_filename|
|
28
|
+
source_file.filename.end_with?(changed_filename)
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# Specs are reported on to ensure that all examples are being run and all
|
34
|
+
# lets, befores, afters, etc are being used.
|
35
|
+
#
|
36
|
+
|
37
|
+
add_group 'Specs', 'spec'
|
38
|
+
end
|
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
## Forking
|
4
|
+
|
5
|
+
[Fork this repository](https://github.com/rapid7/metasploit_data_models/fork)
|
6
|
+
|
7
|
+
## Branching
|
8
|
+
|
9
|
+
Branch names follow the format `TYPE/ISSUE/SUMMARY`. You can create it with `git checkout -b TYPE/ISSUE/SUMMARY`.
|
10
|
+
|
11
|
+
### `TYPE`
|
12
|
+
|
13
|
+
`TYPE` can be `bug`, `chore`, or `feature`.
|
14
|
+
|
15
|
+
### `ISSUE`
|
16
|
+
|
17
|
+
`ISSUE` is either a [Github issue](https://github.com/rapid7/metasploit_data_models/issues) or an issue from some other
|
18
|
+
issue tracking software.
|
19
|
+
|
20
|
+
### `SUMMARY`
|
21
|
+
|
22
|
+
`SUMMARY` is is short summary of the purpose of the branch composed of lower case words separated by '-' so that it is a valid `PRERELEASE` for the Gem version.
|
23
|
+
|
24
|
+
## Changes
|
25
|
+
|
26
|
+
### `PRERELEASE`
|
27
|
+
|
28
|
+
1. Update `PRERELEASE` to match the `SUMMARY` in the branch name. If you branched from `master`, and [version.rb](lib/metasploit_data_models/version.rb) does not have `PRERELEASE` defined, then adding the following lines after `PATCH`:
|
29
|
+
```
|
30
|
+
# The prerelease version, scoped to the {MAJOR}, {MINOR}, and {PATCH} version number.
|
31
|
+
PRERELEASE = '<SUMMARY>'
|
32
|
+
```
|
33
|
+
2. `rake spec`
|
34
|
+
3. Verify the specs pass, which indicates that `PRERELEASE` was updated correctly.
|
35
|
+
4. Commit the change `git commit -a`
|
36
|
+
|
37
|
+
### Your changes
|
38
|
+
|
39
|
+
Make your changes or however many commits you like, committing each with `git commit`.
|
40
|
+
|
41
|
+
### Pre-Pull Request Testing
|
42
|
+
|
43
|
+
#### Specs
|
44
|
+
1. Run specs one last time before opening the Pull Request: `rake spec`
|
45
|
+
2. Verify there was no failures.
|
46
|
+
|
47
|
+
#### Documentation
|
48
|
+
1. Generate yard documentation to ensure all new code is documented: `rake yard`
|
49
|
+
2. Verify there were no `[warn]`ings.
|
50
|
+
3. Verify there were no undocumented objects.
|
51
|
+
|
52
|
+
### Push
|
53
|
+
|
54
|
+
Push your branch to your fork on github: `git push TYPE/ISSUE/SUMMARY`
|
55
|
+
|
56
|
+
### Pull Request
|
57
|
+
|
58
|
+
* [Create new Pull Request](https://github.com/rapid7/metasploit_data_models/compare/)
|
59
|
+
* Add a Verification Steps to the description comment
|
60
|
+
|
61
|
+
```
|
62
|
+
# Verification Steps
|
63
|
+
|
64
|
+
- [ ] `bundle install`
|
65
|
+
|
66
|
+
## `rake spec`
|
67
|
+
- [ ] `rake spec`
|
68
|
+
- [ ] VERIFY no failures
|
69
|
+
|
70
|
+
## `rake yard`
|
71
|
+
- [ ] `rake yard`
|
72
|
+
- [ ] VERIFY no `[warn]`ings
|
73
|
+
- [ ] VERIFY no undocumented objects
|
74
|
+
```
|
75
|
+
|
76
|
+
You should also include at least one scenario to manually check the changes outside of specs.
|
77
|
+
|
78
|
+
* Add a Post-merge Steps comment
|
79
|
+
|
80
|
+
The 'Post-merge Steps' are a reminder to the reviewer of the Pull Request of how to update the [`PRERELEASE`](lib/metasploit_data_models/version.rb) so that [version_spec.rb](spec/lib/metasploit_data_models/version.rb_spec.rb) passes on the target branch after the merge.
|
81
|
+
|
82
|
+
DESTINATION is the name of the destination branch into which the merge is being made. SOURCE_SUMMARY is the SUMMARY from TYPE/ISSUE/SUMMARY branch name for the SOURCE branch that is being made.
|
83
|
+
|
84
|
+
When merging to `master`:
|
85
|
+
|
86
|
+
```
|
87
|
+
# Post-merge Steps
|
88
|
+
|
89
|
+
Perform these steps prior to pushing to master or the build will be broke on master.
|
90
|
+
|
91
|
+
## Version
|
92
|
+
- [ ] Edit `lib/metasploit_data_models/version.rb`
|
93
|
+
- [ ] Remove `PRERELEASE` and its comment as `PRERELEASE` is not defined on master.
|
94
|
+
|
95
|
+
## Gem build
|
96
|
+
- [ ] gem build *.gemspec
|
97
|
+
- [ ] VERIFY the gem has no '.pre' version suffix.
|
98
|
+
|
99
|
+
## RSpec
|
100
|
+
- [ ] `rake spec`
|
101
|
+
- [ ] VERIFY version examples pass without failures
|
102
|
+
|
103
|
+
## Commit & Push
|
104
|
+
- [ ] `git commit -a`
|
105
|
+
- [ ] `git push origin master`
|
106
|
+
```
|
107
|
+
|
108
|
+
When merging to DESTINATION other than `master`:
|
109
|
+
|
110
|
+
```
|
111
|
+
# Post-merge Steps
|
112
|
+
|
113
|
+
Perform these steps prior to pushing to DESTINATION or the build will be broke on DESTINATION.
|
114
|
+
|
115
|
+
## Version
|
116
|
+
- [ ] Edit `lib/metasploit_data_models/version.rb`
|
117
|
+
- [ ] Change `PRERELEASE` from `SOURCE_SUMMARY` to `DESTINATION_SUMMARY` to match the branch (DESTINATION) summary (DESTINATION_SUMMARY)
|
118
|
+
|
119
|
+
## Gem build
|
120
|
+
- [ ] gem build metasploit_data_models.gemspec
|
121
|
+
- [ ] VERIFY the prerelease suffix has change on the gem.
|
122
|
+
|
123
|
+
## RSpec
|
124
|
+
- [ ] `rake spec`
|
125
|
+
- [ ] VERIFY version examples pass without failures
|
126
|
+
|
127
|
+
## Commit & Push
|
128
|
+
- [ ] `git commit -a`
|
129
|
+
- [ ] `git push origin DESTINATION`
|
130
|
+
```
|
131
|
+
|
132
|
+
To update the [CHANGELOG.md](CHANGELOG.md) with the merged changes or release the merged code see
|
133
|
+
[RELEASING.md](RELEASING.md)
|
data/Gemfile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in metasploit_data_models.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
#gem 'metasploit-erd'
|
9
|
+
# embed ERDs on index, namespace Module and Class<ApplicationRecord> pages
|
10
|
+
#gem 'yard-metasploit-erd'
|
11
|
+
end
|
12
|
+
|
13
|
+
# used by dummy application
|
14
|
+
group :development, :test do
|
15
|
+
# Upload coverage reports to coveralls.io
|
16
|
+
gem 'coveralls', require: false
|
17
|
+
# supplies factories for producing model instance for specs
|
18
|
+
# Version 4.1.0 or newer is needed to support generate calls without the 'FactoryBot.' in factory definitions syntax.
|
19
|
+
gem 'factory_bot'
|
20
|
+
# auto-load factories from spec/factories
|
21
|
+
gem 'factory_bot_rails'
|
22
|
+
|
23
|
+
gem 'rails'
|
24
|
+
# Used to create fake data
|
25
|
+
gem "faker"
|
26
|
+
|
27
|
+
# bound to 0.20 for Activerecord 4.2.8 deprecation warnings:
|
28
|
+
# https://github.com/ged/ruby-pg/commit/c90ac644e861857ae75638eb6954b1cb49617090
|
29
|
+
gem 'pg'
|
30
|
+
|
31
|
+
gem 'pry'
|
32
|
+
end
|
33
|
+
|
34
|
+
group :test do
|
35
|
+
# In a full rails project, factory_girl_rails would be in both the :development, and :test group, but since we only
|
36
|
+
# want rails in :test, factory_girl_rails must also only be in :test.
|
37
|
+
# add matchers from shoulda, such as validates_presence_of, which are useful for testing validations
|
38
|
+
gem 'shoulda-matchers'
|
39
|
+
# code coverage of tests
|
40
|
+
gem 'simplecov', :require => false
|
41
|
+
# need rspec-rails >= 2.12.0 as 2.12.0 adds support for redefining named subject in nested context that uses the
|
42
|
+
# named subject from the outer context without causing a stack overflow.
|
43
|
+
gem 'rspec-rails'
|
44
|
+
# used for building markup for webpage factories
|
45
|
+
gem 'builder'
|
46
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Copyright (C) 2012, Rapid7, Inc.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice,
|
8
|
+
this list of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
12
|
+
and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
* Neither the name of Rapid7 LLC nor the names of its contributors
|
15
|
+
may be used to endorse or promote products derived from this software
|
16
|
+
without specific prior written permission.
|
17
|
+
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
22
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
25
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
#MetasploitDataModels [](https://travis-ci.org/rapid7/metasploit_data_models)[](https://codeclimate.com/github/rapid7/metasploit_data_models)[](https://coveralls.io/r/rapid7/metasploit_data_models)[](https://gemnasium.com/rapid7/metasploit_data_models)[](http://badge.fury.io/rb/metasploit_data_models)
|
2
|
+
|
3
|
+
Part of Metasploit's database layer
|
4
|
+
|
5
|
+
## Purpose
|
6
|
+
__MetasploitDataModels__ exists to do several key things:
|
7
|
+
|
8
|
+
1. Allow code sharing between Metasploit Framework (MSF) and the commercial versions of Metasploit (Community, Express, Pro -- usually referred to collectively as "Pro")
|
9
|
+
|
10
|
+
2. Give developers a lightweight entry point to MSF's backend for use in developing tools that gather data intended for later use with Metasploit (e.g. specialized scanners).
|
11
|
+
|
12
|
+
3. Make it easy to keep commercial stuff private while increasing the functionality of the open-source tools we provide to the community.
|
13
|
+
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
### Rails
|
18
|
+
|
19
|
+
In a Rails application, MetasploitDataModels acts a
|
20
|
+
[Rails Engine](http://edgeapi.rubyonrails.org/classes/Rails/Engine.html) and the models are available to application
|
21
|
+
just as if they were defined under `app/models`. If your Rails appliation needs to modify the models, this can be done
|
22
|
+
using `ActiveSupport.on_load` hooks in initializers. The block passed to on_load hook is evaluated in the context of the
|
23
|
+
model class, so defining method and including modules will work just like reopeninng the class, but
|
24
|
+
`ActiveSupport.on_load` ensures that the monkey patches will work after reloading in development mode. Each class has a
|
25
|
+
different `on_load` name, which is just the class name converted to an underscored symbol, so `Mdm::ApiKey` runs the
|
26
|
+
`:mdm_api_key` load hooks, etc.
|
27
|
+
|
28
|
+
# Gemfile
|
29
|
+
gem :metasploiit_data_models, :git => git://github.com/rapid7/metasploit_data_models.git, :tag => 'v0.3.0'
|
30
|
+
|
31
|
+
# config/initializers/metasploit_data_models.rb
|
32
|
+
ActiveSupport.on_load(:mdm_api_key) do
|
33
|
+
# Returns the String obfuscated token for display. Meant to avoid CSRF
|
34
|
+
# api-key stealing attackes.
|
35
|
+
def obfuscated_token
|
36
|
+
token[0..3] + "****************************"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
**This gem's `Rails::Engine` is not required automatically.** You'll need to also add the following to your `config/application.rb`:
|
41
|
+
|
42
|
+
require 'metasploit_data_models/engine'
|
43
|
+
|
44
|
+
### Metasploit Framework
|
45
|
+
|
46
|
+
In Metasploit Framework, `MetasploitDataModels::Engine` is loaded, but the data models are only if the user wants to use
|
47
|
+
the database.
|
48
|
+
|
49
|
+
### Elsewhere
|
50
|
+
|
51
|
+
In Metasploit Pro, MDM is loaded via the metasploit_data_models gem: https://rubygems.org/gems/metasploit_data_models
|
52
|
+
|
53
|
+
## Developer Info
|
54
|
+
|
55
|
+
### Console
|
56
|
+
The gem includes a console based on [Pry](https://github.com/pry/pry/)
|
57
|
+
|
58
|
+
Give it a path to a working MSF database.yml file for full
|
59
|
+
ActiveRecord-based access to your data.
|
60
|
+
|
61
|
+
__Note:__ "development" mode is hardcoded into the console currently.
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
data/RELEASING.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Releasing
|
2
|
+
|
3
|
+
These steps can be added to the Pull Request description's task list to remind the reviewer of how to release the
|
4
|
+
gem.
|
5
|
+
|
6
|
+
```
|
7
|
+
# Release
|
8
|
+
|
9
|
+
Complete these steps on DESTINATION
|
10
|
+
|
11
|
+
## [CHANGELOG.md](CHANGELOG.md)
|
12
|
+
|
13
|
+
### Terminology
|
14
|
+
|
15
|
+
* "Enhancements" are widdening the API, such as by adding new classes or methods.
|
16
|
+
* "Bug Fixes" are fixes to the implementation that do not affect the public API. If the public API is affected then
|
17
|
+
the change should be listed as both a "Bug Fix" and either an "Enhancement" or "Incompatible Change" depending on how
|
18
|
+
the bug was fixed.
|
19
|
+
* "Deprecations" are changes to the implementation that cause deprecation warnings to be issued for APIs which will be
|
20
|
+
removed in a future major release. "Deprecations" are usually accompanied by an Enhancement that creates a new API
|
21
|
+
that is meant to be used in favor of the deprecated API.
|
22
|
+
* "Incompatbile Changes" are the removal of classes or methods or new required arguments or setup that shrink the API.
|
23
|
+
It is best practice to make a "Deprecation" for the API prior to its removal.
|
24
|
+
|
25
|
+
### Task List
|
26
|
+
|
27
|
+
- [ ] Generate the list of changes since the last release: `git log v<LAST_MAJOR>.<LAST_MINOR>.<LAST_PATCH>..HEAD`
|
28
|
+
- [ ] For each commit in the release, find the corresponding PR by search for the commit on Github.
|
29
|
+
- [ ] For each PR, determine whether it is an Enhancement, Bug Fix, Deprecation, and/or Incompatible Change. A PR can
|
30
|
+
be in more than one category, in which case it should be listed in each category it belongs, but with a category
|
31
|
+
specific description of the change.
|
32
|
+
- [ ] Add an item to each category's list in the following format: `[#<PR>](https://github.com/rapid7/metasploit_data_models/pull/<PR>) <consumer summary> - [@<github_user>](https://github.com/<github_user>)`
|
33
|
+
`consumer_summary` should be a summary of the Enhancement, Bug Fix, Deprecation, or Incompatible Change from a
|
34
|
+
downstream consumer's of the library's perspective. `github_user` should be Github handle of the author of the
|
35
|
+
PR.
|
36
|
+
- [ ] If you added any Deprecations or Incompatible Changes, then adding upgrading information to
|
37
|
+
[UPGRADING.md](UPGRADING.md)
|
38
|
+
|
39
|
+
## `VERSION`
|
40
|
+
|
41
|
+
The entries in the [CHANGELOG.md](CHANGELOG.md) can be used to help determine how the `VERSION` should be bumped.
|
42
|
+
|
43
|
+
### Bug fixes
|
44
|
+
|
45
|
+
If the [CHANGELOG.md](CHANGELOG.md) contains only Bug Fixes for the Next Release, then increment
|
46
|
+
[`PATCH`](lib/metasploit_data_models/version.rb).
|
47
|
+
|
48
|
+
### Compatible API changes
|
49
|
+
|
50
|
+
If the [CHANGELOG.md](CHANGELOG.md) contains any Enhancements or Deprecations, then increment
|
51
|
+
[`MINOR`](lib/metasploit_data_models/version.rb) and reset [`PATCH`](lib/metasploit_data_models/version.rb) to `0`.
|
52
|
+
|
53
|
+
### Incompatible API changes
|
54
|
+
|
55
|
+
If the [CHANGELOG.md](CHANGELOG.md) contains any Incompatible Change, then increment [`MAJOR`](lib/metasploit_data_models/version.rb) and
|
56
|
+
reset [`MINOR`](lib/metasploit_data_models/version.rb and [`PATCH`](lib/metasploit_data_models/version.rb) to `0`.
|
57
|
+
|
58
|
+
## Setup [CHANGELOG.md](CHANGELOG.md) for next release
|
59
|
+
|
60
|
+
- [ ] Change `Next Release` section name at the top of [CHANGELOG.md](CHANGELOG.md) to match the current `VERSION`.
|
61
|
+
- [ ] Add a new `Next Release` section above the `VERSION`'s section you just renamed:
|
62
|
+
<pre>
|
63
|
+
# Next Release
|
64
|
+
|
65
|
+
* Enhancements
|
66
|
+
* Bug Fixes
|
67
|
+
* Deprecations
|
68
|
+
* Incompatible Changes
|
69
|
+
</pre>
|
70
|
+
|
71
|
+
## Release to rubygems.org
|
72
|
+
|
73
|
+
## ruby-2.1
|
74
|
+
- [ ] `rvm use ruby-2.1@metasploit_data_models`
|
75
|
+
- [ ] `rm Gemfile.lock`
|
76
|
+
- [ ] `bundle install`
|
77
|
+
- [ ] `rake release`
|
78
|
+
```
|
79
|
+
|
80
|
+
### Downstream dependencies
|
81
|
+
|
82
|
+
There are currently no known downstream dependencies
|
data/Rakefile
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
print_without = false
|
5
|
+
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
6
|
+
|
7
|
+
begin
|
8
|
+
load 'rails/tasks/engine.rake'
|
9
|
+
rescue LoadError
|
10
|
+
puts "railties not in bundle, so can't load engine tasks."
|
11
|
+
print_without = true
|
12
|
+
end
|
13
|
+
|
14
|
+
Bundler::GemHelper.install_tasks
|
15
|
+
|
16
|
+
#
|
17
|
+
# load rake files like a normal rails app
|
18
|
+
# @see http://viget.com/extend/rails-engine-testing-with-rspec-capybara-and-factorygirl
|
19
|
+
#
|
20
|
+
|
21
|
+
pathname = Pathname.new(__FILE__)
|
22
|
+
root = pathname.parent
|
23
|
+
rakefile_glob = root.join('lib', 'tasks', '**', '*.rake').to_path
|
24
|
+
|
25
|
+
Dir.glob(rakefile_glob) do |rakefile|
|
26
|
+
load rakefile
|
27
|
+
end
|
28
|
+
|
29
|
+
begin
|
30
|
+
require 'rspec/core'
|
31
|
+
rescue LoadError
|
32
|
+
puts "rspec not in bundle, so can't set up spec tasks. " \
|
33
|
+
"To run specs ensure to install the development and test groups."
|
34
|
+
print_without = true
|
35
|
+
else
|
36
|
+
require 'rspec/core/rake_task'
|
37
|
+
|
38
|
+
# Depend on app:db:test:prepare so that test database is recreated just like in a full rails app
|
39
|
+
# @see http://viget.com/extend/rails-engine-testing-with-rspec-capybara-and-factorygirl
|
40
|
+
RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
|
41
|
+
|
42
|
+
task :default => :spec
|
43
|
+
end
|
44
|
+
|
45
|
+
# Use find_all_by_name instead of find_by_name as find_all_by_name will return pre-release versions
|
46
|
+
gem_specification = Gem::Specification.find_all_by_name('metasploit-yard').first
|
47
|
+
|
48
|
+
if gem_specification
|
49
|
+
Dir[File.join(gem_specification.gem_dir, 'lib', 'tasks', '**', '*.rake')].each do |rake|
|
50
|
+
load rake
|
51
|
+
end
|
52
|
+
|
53
|
+
#
|
54
|
+
# Eager load before yard docs so that ApplicationRecord subclasses are loaded for yard-metasploit-erd
|
55
|
+
#
|
56
|
+
|
57
|
+
task 'yard:doc' => :eager_load
|
58
|
+
|
59
|
+
task eager_load: :environment do
|
60
|
+
Rails.application.eager_load!
|
61
|
+
end
|
62
|
+
else
|
63
|
+
puts "metasploit-yard not in bundle, so can't setup yard tasks. " \
|
64
|
+
"To run yard ensure to install the development group."
|
65
|
+
print_without = true
|
66
|
+
end
|
67
|
+
|
68
|
+
if print_without
|
69
|
+
puts "Bundle currently installed '--without #{Bundler.settings.without.join(' ')}'."
|
70
|
+
puts "To clear the without option do `bundle install --without ''` (the --without flag with an empty string) or " \
|
71
|
+
"`rm -rf .bundle` to remove the .bundle/config manually and then `bundle install`"
|
72
|
+
end
|
data/UPGRADING.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
No Deprecations or Incompatible Changes have been introduced at this time
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# API key to access the RPC.
|
2
|
+
class Mdm::ApiKey < ApplicationRecord
|
3
|
+
|
4
|
+
#
|
5
|
+
# Attributes
|
6
|
+
#
|
7
|
+
|
8
|
+
# @!attribute [rw] created_at
|
9
|
+
# When this API Key was created.
|
10
|
+
#
|
11
|
+
# @return [DateTime]
|
12
|
+
|
13
|
+
# @!attribute [rw] token
|
14
|
+
# The API Key to authenicate to the RPC.
|
15
|
+
#
|
16
|
+
# @return [String]
|
17
|
+
|
18
|
+
# @!attribute [rw] updated_at
|
19
|
+
# The last time this API Key was updated.
|
20
|
+
#
|
21
|
+
# @return [DateTime]
|
22
|
+
|
23
|
+
#
|
24
|
+
#
|
25
|
+
# Validations
|
26
|
+
#
|
27
|
+
#
|
28
|
+
|
29
|
+
#
|
30
|
+
# Method Validations
|
31
|
+
#
|
32
|
+
|
33
|
+
validate :supports_api
|
34
|
+
|
35
|
+
#
|
36
|
+
# Attribute Validations
|
37
|
+
#
|
38
|
+
|
39
|
+
validates :token, :presence => true, :length => { :minimum => 8 }
|
40
|
+
|
41
|
+
#
|
42
|
+
# Instance Methods
|
43
|
+
#
|
44
|
+
|
45
|
+
protected
|
46
|
+
|
47
|
+
|
48
|
+
# Validates whether License supports API.
|
49
|
+
#
|
50
|
+
# @return [void]
|
51
|
+
# @todo MSP-2724
|
52
|
+
def supports_api
|
53
|
+
license = License.get
|
54
|
+
|
55
|
+
if license and not license.supports_api?
|
56
|
+
errors.add :license, " - this product does not support API access"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
Metasploit::Concern.run(self)
|
61
|
+
end
|