metasploit_data_models 3.0.8 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (219) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +1 -3
  3. data.tar.gz.sig +1 -1
  4. data/.gitignore +1 -1
  5. data/.travis.yml +1 -1
  6. data/Gemfile +6 -4
  7. data/Rakefile +1 -1
  8. data/app/models/mdm/api_key.rb +2 -2
  9. data/app/models/mdm/async_callback.rb +64 -0
  10. data/app/models/mdm/client.rb +1 -1
  11. data/app/models/mdm/cred.rb +1 -1
  12. data/app/models/mdm/event.rb +1 -1
  13. data/app/models/mdm/exploit_attempt.rb +1 -1
  14. data/app/models/mdm/exploited_host.rb +1 -1
  15. data/app/models/mdm/host.rb +2 -2
  16. data/app/models/mdm/host_detail.rb +2 -2
  17. data/app/models/mdm/host_tag.rb +1 -1
  18. data/app/models/mdm/listener.rb +1 -1
  19. data/app/models/mdm/loot.rb +1 -1
  20. data/app/models/mdm/macro.rb +1 -1
  21. data/app/models/mdm/mod_ref.rb +1 -1
  22. data/app/models/mdm/module/action.rb +1 -1
  23. data/app/models/mdm/module/arch.rb +1 -1
  24. data/app/models/mdm/module/author.rb +1 -1
  25. data/app/models/mdm/module/detail.rb +1 -1
  26. data/app/models/mdm/module/mixin.rb +1 -1
  27. data/app/models/mdm/module/platform.rb +1 -1
  28. data/app/models/mdm/module/ref.rb +1 -1
  29. data/app/models/mdm/module/target.rb +1 -1
  30. data/app/models/mdm/nexpose_console.rb +1 -1
  31. data/app/models/mdm/note.rb +2 -2
  32. data/app/models/mdm/payload.rb +1 -16
  33. data/app/models/mdm/profile.rb +1 -1
  34. data/app/models/mdm/ref.rb +1 -1
  35. data/app/models/mdm/route.rb +1 -1
  36. data/app/models/mdm/service.rb +2 -2
  37. data/app/models/mdm/session.rb +1 -1
  38. data/app/models/mdm/session_event.rb +1 -1
  39. data/app/models/mdm/tag.rb +1 -1
  40. data/app/models/mdm/task.rb +1 -1
  41. data/app/models/mdm/task_cred.rb +1 -1
  42. data/app/models/mdm/task_host.rb +1 -1
  43. data/app/models/mdm/task_service.rb +1 -1
  44. data/app/models/mdm/task_session.rb +1 -1
  45. data/app/models/mdm/user.rb +2 -2
  46. data/app/models/mdm/vuln.rb +2 -2
  47. data/app/models/mdm/vuln_attempt.rb +1 -1
  48. data/app/models/mdm/vuln_detail.rb +1 -1
  49. data/app/models/mdm/vuln_ref.rb +1 -1
  50. data/app/models/mdm/web_form.rb +1 -1
  51. data/app/models/mdm/web_page.rb +1 -1
  52. data/app/models/mdm/web_site.rb +1 -1
  53. data/app/models/mdm/web_vuln.rb +1 -1
  54. data/app/models/mdm/wmap_request.rb +1 -1
  55. data/app/models/mdm/wmap_target.rb +1 -1
  56. data/app/models/mdm/workspace.rb +6 -9
  57. data/app/models/metasploit_data_models/automatic_exploitation/match.rb +1 -1
  58. data/app/models/metasploit_data_models/automatic_exploitation/match_result.rb +1 -1
  59. data/app/models/metasploit_data_models/automatic_exploitation/match_set.rb +1 -1
  60. data/app/models/metasploit_data_models/automatic_exploitation/run.rb +2 -2
  61. data/app/models/metasploit_data_models/module_run.rb +1 -1
  62. data/app/validators/ip_format_validator.rb +1 -1
  63. data/app/validators/parameters_validator.rb +7 -7
  64. data/bin/rails +14 -0
  65. data/config/initializers/arel_helper.rb +2 -2
  66. data/config/initializers/ipaddr.rb +11 -6
  67. data/db/migrate/000_create_tables.rb +1 -1
  68. data/db/migrate/001_add_wmap_tables.rb +1 -1
  69. data/db/migrate/002_add_workspaces.rb +1 -1
  70. data/db/migrate/003_move_notes.rb +1 -1
  71. data/db/migrate/004_add_events_table.rb +1 -1
  72. data/db/migrate/005_expand_info.rb +1 -1
  73. data/db/migrate/006_add_timestamps.rb +1 -1
  74. data/db/migrate/007_add_loots.rb +1 -1
  75. data/db/migrate/008_create_users.rb +1 -1
  76. data/db/migrate/009_add_loots_ctype.rb +1 -1
  77. data/db/migrate/010_add_alert_fields.rb +1 -1
  78. data/db/migrate/011_add_reports.rb +1 -1
  79. data/db/migrate/012_add_tasks.rb +1 -1
  80. data/db/migrate/013_add_tasks_result.rb +1 -1
  81. data/db/migrate/014_add_loots_fields.rb +1 -1
  82. data/db/migrate/015_rename_user.rb +1 -1
  83. data/db/migrate/016_add_host_purpose.rb +1 -1
  84. data/db/migrate/017_expand_info2.rb +1 -1
  85. data/db/migrate/018_add_workspace_user_info.rb +1 -1
  86. data/db/migrate/019_add_workspace_desc.rb +1 -1
  87. data/db/migrate/020_add_user_preferences.rb +1 -1
  88. data/db/migrate/021_standardize_info_and_data.rb +1 -1
  89. data/db/migrate/022_enlarge_event_info.rb +1 -1
  90. data/db/migrate/023_add_report_downloaded_at.rb +1 -1
  91. data/db/migrate/024_convert_service_info_to_text.rb +1 -1
  92. data/db/migrate/025_add_user_admin.rb +1 -1
  93. data/db/migrate/026_add_creds_table.rb +1 -1
  94. data/db/migrate/20100819123300_migrate_cred_data.rb +1 -1
  95. data/db/migrate/20100824151500_add_exploited_table.rb +1 -1
  96. data/db/migrate/20100908001428_add_owner_to_workspaces.rb +1 -1
  97. data/db/migrate/20100911122000_add_report_templates.rb +1 -1
  98. data/db/migrate/20100916151530_require_admin_flag.rb +1 -1
  99. data/db/migrate/20100916175000_add_campaigns_and_templates.rb +1 -1
  100. data/db/migrate/20100920012100_add_generate_exe_column.rb +1 -1
  101. data/db/migrate/20100926214000_add_template_prefs.rb +1 -1
  102. data/db/migrate/20101001000000_add_web_tables.rb +1 -1
  103. data/db/migrate/20101002000000_add_query.rb +1 -1
  104. data/db/migrate/20101007000000_add_vuln_info.rb +1 -1
  105. data/db/migrate/20101008111800_add_clients_to_campaigns.rb +1 -1
  106. data/db/migrate/20101009023300_add_campaign_attachments.rb +1 -1
  107. data/db/migrate/20101104135100_add_imported_creds.rb +1 -1
  108. data/db/migrate/20101203000000_fix_web_tables.rb +1 -1
  109. data/db/migrate/20101203000001_expand_host_comment.rb +1 -1
  110. data/db/migrate/20101206212033_add_limit_to_network_to_workspaces.rb +1 -1
  111. data/db/migrate/20110112154300_add_module_uuid_to_tasks.rb +1 -1
  112. data/db/migrate/20110204112800_add_host_tags.rb +1 -1
  113. data/db/migrate/20110317144932_add_session_table.rb +4 -4
  114. data/db/migrate/20110414180600_add_local_id_to_session_table.rb +1 -1
  115. data/db/migrate/20110415175705_add_routes_table.rb +1 -1
  116. data/db/migrate/20110422000000_convert_binary.rb +3 -3
  117. data/db/migrate/20110425095900_add_last_seen_to_sessions.rb +1 -1
  118. data/db/migrate/20110513143900_track_successful_exploits.rb +3 -3
  119. data/db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb +2 -2
  120. data/db/migrate/20110527000000_add_task_id_to_reports_table.rb +1 -1
  121. data/db/migrate/20110527000001_add_api_keys_table.rb +1 -1
  122. data/db/migrate/20110606000001_add_macros_table.rb +1 -1
  123. data/db/migrate/20110622000000_add_settings_to_tasks_table.rb +1 -1
  124. data/db/migrate/20110624000001_add_listeners_table.rb +1 -1
  125. data/db/migrate/20110625000001_add_macro_to_listeners_table.rb +1 -1
  126. data/db/migrate/20110630000001_add_nexpose_consoles_table.rb +1 -1
  127. data/db/migrate/20110630000002_add_name_to_nexpose_consoles_table.rb +1 -1
  128. data/db/migrate/20110717000001_add_profiles_table.rb +1 -1
  129. data/db/migrate/20110727163801_expand_cred_ptype_column.rb +1 -1
  130. data/db/migrate/20110730000001_add_initial_indexes.rb +1 -1
  131. data/db/migrate/20110812000001_prune_indexes.rb +1 -1
  132. data/db/migrate/20110922000000_expand_notes.rb +1 -1
  133. data/db/migrate/20110928101300_add_mod_ref_table.rb +1 -1
  134. data/db/migrate/20111011110000_add_display_name_to_reports_table.rb +2 -2
  135. data/db/migrate/20111203000000_inet_columns.rb +1 -1
  136. data/db/migrate/20111204000000_more_inet_columns.rb +1 -1
  137. data/db/migrate/20111210000000_add_scope_to_hosts.rb +1 -1
  138. data/db/migrate/20120126110000_add_virtual_host_to_hosts.rb +1 -1
  139. data/db/migrate/20120411173220_rename_workspace_members.rb +1 -1
  140. data/db/migrate/20120601152442_add_counter_caches_to_hosts.rb +2 -2
  141. data/db/migrate/20120625000000_add_vuln_details.rb +1 -1
  142. data/db/migrate/20120625000001_add_host_details.rb +1 -1
  143. data/db/migrate/20120625000002_expand_details.rb +1 -1
  144. data/db/migrate/20120625000003_expand_details2.rb +1 -1
  145. data/db/migrate/20120625000004_add_vuln_attempts.rb +1 -1
  146. data/db/migrate/20120625000005_add_vuln_and_host_counter_caches.rb +1 -1
  147. data/db/migrate/20120625000006_add_module_details.rb +1 -1
  148. data/db/migrate/20120625000007_add_exploit_attempts.rb +1 -1
  149. data/db/migrate/20120625000008_add_fail_message.rb +1 -1
  150. data/db/migrate/20120718202805_add_owner_and_payload_to_web_vulns.rb +1 -1
  151. data/db/migrate/20130412154159_change_foreign_key_in_module_actions.rb +1 -1
  152. data/db/migrate/20130412171844_change_foreign_key_in_module_archs.rb +1 -1
  153. data/db/migrate/20130412173121_change_foreign_key_in_module_authors.rb +1 -1
  154. data/db/migrate/20130412173640_change_foreign_key_in_module_mixins.rb +1 -1
  155. data/db/migrate/20130412174254_change_foreign_key_in_module_platforms.rb +1 -1
  156. data/db/migrate/20130412174719_change_foreign_key_in_module_refs.rb +1 -1
  157. data/db/migrate/20130412175040_change_foreign_key_in_module_targets.rb +1 -1
  158. data/db/migrate/20130423211152_add_creds_counter_cache.rb +1 -1
  159. data/db/migrate/20130430162145_enforce_address_uniqueness_in_workspace_in_hosts.rb +6 -6
  160. data/db/migrate/20130510021637_remove_campaigns.rb +1 -1
  161. data/db/migrate/20130515164311_change_web_vulns_confidence_to_integer.rb +1 -1
  162. data/db/migrate/20130515172727_valid_mdm_web_vuln_params.rb +1 -1
  163. data/db/migrate/20130516204810_making_vulns_refs_a_real_ar_model.rb +2 -2
  164. data/db/migrate/20130522001343_create_task_creds.rb +1 -1
  165. data/db/migrate/20130522032517_create_task_hosts.rb +1 -1
  166. data/db/migrate/20130522041110_create_task_services.rb +1 -1
  167. data/db/migrate/20130525015035_remove_campaign_id_from_clients.rb +1 -1
  168. data/db/migrate/20130525212420_drop_table_imported_creds.rb +1 -1
  169. data/db/migrate/20130531144949_making_host_tags_a_real_ar_model.rb +1 -1
  170. data/db/migrate/20130604145732_create_task_sessions.rb +1 -1
  171. data/db/migrate/20130717150737_remove_pname_validation.rb +1 -1
  172. data/db/migrate/20131002004641_create_automatic_exploitation_matches.rb +1 -1
  173. data/db/migrate/20131002164449_create_automatic_exploitation_match_sets.rb +1 -1
  174. data/db/migrate/20131008213344_create_automatic_exploitation_runs.rb +1 -1
  175. data/db/migrate/20131011184338_module_detail_on_automatic_exploitation_match.rb +1 -1
  176. data/db/migrate/20131017150735_create_automatic_exploitation_match_results.rb +1 -1
  177. data/db/migrate/20131021185657_make_match_polymorphic.rb +1 -1
  178. data/db/migrate/20140905031549_add_detected_arch_to_host.rb +1 -1
  179. data/db/migrate/20150112203945_remove_duplicate_services.rb +1 -1
  180. data/db/migrate/20150205192745_drop_service_uniqueness_index.rb +1 -1
  181. data/db/migrate/20150209195939_add_vuln_id_to_note.rb +1 -1
  182. data/db/migrate/20150212214222_remove_duplicate_services2.rb +1 -1
  183. data/db/migrate/20150219173821_create_module_runs.rb +1 -1
  184. data/db/migrate/20150219215039_add_module_run_to_session.rb +1 -1
  185. data/db/migrate/20150226151459_add_module_run_fk_to_loot.rb +1 -1
  186. data/db/migrate/20150312155312_add_module_full_name_to_match.rb +1 -1
  187. data/db/migrate/20150317145455_rename_module_indices.rb +2 -2
  188. data/db/migrate/20150326183742_add_missing_ae_indices.rb +1 -1
  189. data/db/migrate/20150421211719_rename_automatic_exploitation_index.rb +3 -3
  190. data/db/migrate/20150514182921_add_origin_to_mdm_vuln.rb +1 -1
  191. data/db/migrate/20160415153312_remove_not_null_from_web_vuln_p_arams.rb +1 -1
  192. data/db/migrate/20161004165612_add_fingerprinted_to_workspace.rb +1 -1
  193. data/db/migrate/20161227212223_add_os_family_to_hosts.rb +1 -1
  194. data/db/migrate/20180904120211_create_payloads.rb +1 -1
  195. data/db/migrate/20190308134512_create_async_callbacks.rb +14 -0
  196. data/db/migrate/20190507120211_remove_payload_workspaces.rb +5 -0
  197. data/lib/mdm.rb +1 -0
  198. data/lib/metasploit_data_models.rb +0 -1
  199. data/lib/metasploit_data_models/automatic_exploitation.rb +1 -1
  200. data/lib/metasploit_data_models/base64_serializer.rb +1 -1
  201. data/lib/metasploit_data_models/change_required_columns_to_null_false.rb +2 -2
  202. data/lib/metasploit_data_models/engine.rb +1 -1
  203. data/lib/metasploit_data_models/version.rb +1 -1
  204. data/metasploit_data_models.gemspec +4 -8
  205. data/spec/app/models/mdm/exploit_attempt_spec.rb +2 -2
  206. data/spec/app/models/mdm/host_detail_spec.rb +1 -1
  207. data/spec/app/models/mdm/host_spec.rb +27 -27
  208. data/spec/app/models/mdm/module/detail_spec.rb +18 -18
  209. data/spec/app/models/mdm/service_spec.rb +1 -0
  210. data/spec/app/models/mdm/vuln_attempt_spec.rb +1 -1
  211. data/spec/app/models/mdm/vuln_detail_spec.rb +1 -1
  212. data/spec/app/models/mdm/vuln_spec.rb +1 -1
  213. data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +4 -4
  214. data/spec/dummy/app/assets/config/manifest.js +1 -0
  215. data/spec/dummy/app/models/application_record.rb +3 -0
  216. data/spec/dummy/db/structure.sql +213 -329
  217. metadata +92 -98
  218. metadata.gz.sig +0 -0
  219. data/spec/dummy/config/initializers/secret_token.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1de250dab01252ec903267f151d8381dc07075fe
4
- data.tar.gz: 52d15de85b7946d63a93c33fcc629fc6bcc4ff8c
2
+ SHA256:
3
+ metadata.gz: 7160a9465ddf37341f8823e9523185b042f1fb99db31e42a79aa25b583ddb676
4
+ data.tar.gz: dfff423e1f177a6bdc6bc85b84225c3a243e2528283e49185d188c76d04808c1
5
5
  SHA512:
6
- metadata.gz: 79679aa1cfea49f399d47d0d80d24f3f6ed2362bf2dbe9670ea4b848e52581d9ff211e580bffb54f3cd927ef48c645424451f5e740c6b6b6c6fd194d0dfaaa34
7
- data.tar.gz: 5477dc7aeaf031bc3d96bafeb90c53ee59457a3fba9d3e3769247f7548375e6eee0fa979eed75a9804e2843b62638bf0398e4ea5ff63cc6dd590858bd24e594b
6
+ metadata.gz: 7c60f29e7ebff8b3c2f1aa0e7a10a9c06a07f186f57c3539deb24419ba65b5d004897ecada92e313b19c38f37c634dcf2dc55765aea3e0e1ae2b126f6748e597
7
+ data.tar.gz: 501f97755d40903d2e25b3476538e498f650209df40c9522e98ddf7eb6ab1bd716e28454eb0ceb289991e22a400b10feb0665e776f0f4d4ee55822888247466f
@@ -1,3 +1 @@
1
- �/��C
2
- w!��!��4����;v��@P1D;��ŘՀD=pش��=2��+B2�u›(�:%J:y��
3
- �@�v�ΆC�"R_��`
1
+ fo㏚j��E'�G�G�Τ�Y�9����v�;��3V����פ�f(1`l�6�G�v���S����͒Gω|�1g�cU�R�y����^�b&%>
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- S )��Yo�����NIG�b%��K��FmU&J��[��$ VM�@��'Ĩ1R�^p�ɇ�X�������!d٘�]Cd(�,���҈d]ɹ�m9�҅��� ������ݎsϬ�T��%�D>����ۣ\9a��?���]\�Ӊ����#f��������@��C��X{ح��}�=d ���nrH0V�$,��{\�C�l�Ρ`�m���!��b��!l�!%�>����9u5ӳ�y_N��e
1
+ �Y����@JJ۸y�K*~��%I��1��L/l�wM0s8���;�t���[�:�"���-�������HbC)6��S�yW���!��ts�ć�G�3�� !����c.=�~�~H!b�$�AP���NY���d�����K&�&�y_r�]*����nUA���Z�3�`<�bK"*�z��H���S�y��HLr4�� p�=Y����qa�����<w�a~�ÝS�M��Ay��.�P�$��(��L����;�%z��
data/.gitignore CHANGED
@@ -26,4 +26,4 @@ pkg/*
26
26
  # Database configuration (with passwords) for specs
27
27
  spec/dummy/config/database.yml
28
28
  # Secrets
29
- spec/dummy/config/secrets.yml
29
+ spec/dummy/tmp/*
@@ -10,7 +10,7 @@ addons:
10
10
  - libpcap-dev
11
11
  - graphviz
12
12
  rvm:
13
- - 2.5.0
13
+ - 2.6.5
14
14
  before_script:
15
15
  - cp spec/dummy/config/database.yml.travis spec/dummy/config/database.yml
16
16
  - bundle exec rake --version
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ gemspec
6
6
 
7
7
  group :development do
8
8
  #gem 'metasploit-erd'
9
- # embed ERDs on index, namespace Module and Class<ActiveRecord::Base> pages
9
+ # embed ERDs on index, namespace Module and Class<ApplicationRecord> pages
10
10
  #gem 'yard-metasploit-erd'
11
11
  end
12
12
 
@@ -16,17 +16,19 @@ group :development, :test do
16
16
  gem 'coveralls', require: false
17
17
  # supplies factories for producing model instance for specs
18
18
  # Version 4.1.0 or newer is needed to support generate calls without the 'FactoryBot.' in factory definitions syntax.
19
- gem 'factory_bot', '~>4'
19
+ gem 'factory_bot'
20
20
  # auto-load factories from spec/factories
21
21
  gem 'factory_bot_rails'
22
22
 
23
- gem 'rails', '~>4.2.6'
23
+ gem 'rails'
24
24
  # Used to create fake data
25
25
  gem "faker"
26
26
 
27
27
  # bound to 0.20 for Activerecord 4.2.8 deprecation warnings:
28
28
  # https://github.com/ged/ruby-pg/commit/c90ac644e861857ae75638eb6954b1cb49617090
29
- gem 'pg', "0.20.0"
29
+ gem 'pg'
30
+
31
+ gem 'pry'
30
32
  end
31
33
 
32
34
  group :test do
data/Rakefile CHANGED
@@ -51,7 +51,7 @@ if gem_specification
51
51
  end
52
52
 
53
53
  #
54
- # Eager load before yard docs so that ActiveRecord::Base subclasses are loaded for yard-metasploit-erd
54
+ # Eager load before yard docs so that ApplicationRecord subclasses are loaded for yard-metasploit-erd
55
55
  #
56
56
 
57
57
  task 'yard:doc' => :eager_load
@@ -1,5 +1,5 @@
1
1
  # API key to access the RPC.
2
- class Mdm::ApiKey < ActiveRecord::Base
2
+ class Mdm::ApiKey < ApplicationRecord
3
3
 
4
4
  #
5
5
  # Attributes
@@ -53,7 +53,7 @@ class Mdm::ApiKey < ActiveRecord::Base
53
53
  license = License.get
54
54
 
55
55
  if license and not license.supports_api?
56
- errors[:license] = " - this product does not support API access"
56
+ errors.add :license, " - this product does not support API access"
57
57
  end
58
58
  end
59
59
 
@@ -0,0 +1,64 @@
1
+ # An asychronous callback that has been received by the Mettle Pingback Listener and is logged
2
+ class Mdm::AsyncCallback < ApplicationRecord
3
+ extend ActiveSupport::Autoload
4
+
5
+ include Metasploit::Model::Search
6
+
7
+ #
8
+ # Associations
9
+ #
10
+
11
+
12
+ #
13
+ # Attributes
14
+ #
15
+
16
+ # @!attribute [rw] uuid
17
+ # A 16-byte unique identifier for this payload. The UUID is encoded to include specific information.
18
+ # See lib/msf/core/payload/uuid.rb in the https://github.com/rapid7/metasploit-framework repo.
19
+ #
20
+ # @return [String]
21
+
22
+ # @!attribute [rw] timestamp
23
+ # The Unix format timestamp when this payload called back.
24
+ #
25
+ # @return [Integer]
26
+
27
+ # @!attribute [rw] listener_uri
28
+ # Non-unique URIs (eg. "tcp://192.168.1.7:4444") which received callbacks from this payload.
29
+ #
30
+ # @return [String]
31
+
32
+ # @!attribute [rw] target_host
33
+ # The IP address (eg. "192.168.1.7" or "fe80::1") from which the callback originated, from the view of the callback listener.
34
+ #
35
+ # @return [String]
36
+
37
+ # @!attribute [rw] target_port
38
+ # The IP port (eg. "4444") from which the callback originated, from the view of the callback listener.
39
+ #
40
+ # @return [Integer]
41
+
42
+ #
43
+ # Validations
44
+ #
45
+
46
+
47
+ #
48
+ # Search Attributes
49
+ #
50
+
51
+ search_attribute :uuid,
52
+ type: :string
53
+
54
+ #
55
+ # Serializations
56
+ #
57
+
58
+ # NONE
59
+
60
+
61
+ public
62
+
63
+ Metasploit::Concern.run(self)
64
+ end
@@ -1,5 +1,5 @@
1
1
  # Client used for `report_client` in metasploit-framework Metasploit Modules.
2
- class Mdm::Client < ActiveRecord::Base
2
+ class Mdm::Client < ApplicationRecord
3
3
  #
4
4
  # Associations
5
5
  #
@@ -1,7 +1,7 @@
1
1
  # @deprecated Use metasploit-credential's `Metasploit::Credential::Core`.
2
2
  #
3
3
  # A credential captured from a {#service}.
4
- class Mdm::Cred < ActiveRecord::Base
4
+ class Mdm::Cred < ApplicationRecord
5
5
  #
6
6
  # CONSTANTS
7
7
  #
@@ -1,5 +1,5 @@
1
1
  # Records framework events to the database.
2
- class Mdm::Event < ActiveRecord::Base
2
+ class Mdm::Event < ApplicationRecord
3
3
 
4
4
  #
5
5
  # Associations
@@ -1,5 +1,5 @@
1
1
  # An attempt to exploit {#host}.
2
- class Mdm::ExploitAttempt < ActiveRecord::Base
2
+ class Mdm::ExploitAttempt < ApplicationRecord
3
3
 
4
4
  #
5
5
  # Associations
@@ -1,7 +1,7 @@
1
1
  # @deprecated use {Mdm::ExploitAttempt} instead.
2
2
  #
3
3
  # When a {#host} or {#service} on a {#host} is exploited.
4
- class Mdm::ExploitedHost < ActiveRecord::Base
4
+ class Mdm::ExploitedHost < ApplicationRecord
5
5
  #
6
6
  # Associations
7
7
  #
@@ -1,5 +1,5 @@
1
1
  # A system with an {#address IP address} on the network that has been discovered in some way.
2
- class Mdm::Host < ActiveRecord::Base
2
+ class Mdm::Host < ApplicationRecord
3
3
  extend ActiveSupport::Autoload
4
4
 
5
5
  autoload :OperatingSystemNormalization
@@ -316,7 +316,7 @@ class Mdm::Host < ActiveRecord::Base
316
316
  # {Mdm::Module::Detail Details about modules} that were used to find {#vulns vulnerabilities} on this host.
317
317
  #
318
318
  # @return [ActiveRecord::Relation<Mdm::Module::Detail]
319
- has_many :module_details, -> { uniq } ,
319
+ has_many :module_details, -> { distinct } ,
320
320
  :class_name => 'Mdm::Module::Detail',
321
321
  :source =>:detail,
322
322
  :through => :module_refs
@@ -1,5 +1,5 @@
1
1
  # Details supplied by Nexpose about a {Mdm::Host host}.
2
- class Mdm::HostDetail < ActiveRecord::Base
2
+ class Mdm::HostDetail < ApplicationRecord
3
3
  #
4
4
  # Associations
5
5
  #
@@ -59,4 +59,4 @@ class Mdm::HostDetail < ActiveRecord::Base
59
59
  validates :host_id, :presence => true
60
60
 
61
61
  Metasploit::Concern.run(self)
62
- end
62
+ end
@@ -1,5 +1,5 @@
1
1
  # Join model between {Mdm::Host} and {Mdm::Tag}.
2
- class Mdm::HostTag < ActiveRecord::Base
2
+ class Mdm::HostTag < ApplicationRecord
3
3
  self.table_name = "hosts_tags"
4
4
 
5
5
  #
@@ -1,5 +1,5 @@
1
1
  # A listener spawned by a {#task} that is waiting for connection on {#address}:{#port}.
2
- class Mdm::Listener < ActiveRecord::Base
2
+ class Mdm::Listener < ApplicationRecord
3
3
 
4
4
  #
5
5
  # Associations
@@ -1,6 +1,6 @@
1
1
  # Loot gathered from {#host} or {#service} such as files to prove you were on the system or to crack later to gain
2
2
  # sessions on other machines in the network.
3
- class Mdm::Loot < ActiveRecord::Base
3
+ class Mdm::Loot < ApplicationRecord
4
4
 
5
5
  #
6
6
  # CONSTANTS
@@ -1,5 +1,5 @@
1
1
  # Macro of {#actions} to run at once.
2
- class Mdm::Macro < ActiveRecord::Base
2
+ class Mdm::Macro < ApplicationRecord
3
3
  extend MetasploitDataModels::SerializedPrefs
4
4
 
5
5
  #
@@ -1,6 +1,6 @@
1
1
  # Joins a {Mdm::Module::Detail} and {Mdm::Ref} indirectly through the {Mdm::Module::Detail#refname} matching {#module},
2
2
  # {Mdm::Module::Detail#mtype} matching {#mtype}, and {Mdm::Ref#name} matching {#ref}.
3
- class Mdm::ModRef < ActiveRecord::Base
3
+ class Mdm::ModRef < ApplicationRecord
4
4
  #
5
5
  # Attributes
6
6
  #
@@ -3,7 +3,7 @@
3
3
  # {Mdm::Module::Detail Metasploit Module}: if two {Mdm::Module::Detail Metasploit Modules} have
4
4
  # {Mdm::Module::Action actions} with the same {Mdm::Module::Action#name name}, no similarity should be assumed between
5
5
  # those two {Mdm::Module::Action actions} or {Mdm::Module::Detail Metasploit Modules}.
6
- class Mdm::Module::Action < ActiveRecord::Base
6
+ class Mdm::Module::Action < ApplicationRecord
7
7
  self.table_name = 'module_actions'
8
8
 
9
9
  #
@@ -1,5 +1,5 @@
1
1
  # A supported architecture for a given {Mdm::Module::Detail Metasploit Module}
2
- class Mdm::Module::Arch < ActiveRecord::Base
2
+ class Mdm::Module::Arch < ApplicationRecord
3
3
  self.table_name = 'module_archs'
4
4
 
5
5
  #
@@ -1,5 +1,5 @@
1
1
  # The {#email} and {#name} of an author of a {#detail Metasploit Module}.
2
- class Mdm::Module::Author < ActiveRecord::Base
2
+ class Mdm::Module::Author < ApplicationRecord
3
3
  self.table_name = 'module_authors'
4
4
 
5
5
  #
@@ -1,6 +1,6 @@
1
1
  # Details about an Msf::Module. Metadata that can be an array is stored in associations in modules under the
2
2
  # {Mdm::Module} namespace.
3
- class Mdm::Module::Detail < ActiveRecord::Base
3
+ class Mdm::Module::Detail < ApplicationRecord
4
4
  self.table_name = 'module_details'
5
5
 
6
6
  #
@@ -1,7 +1,7 @@
1
1
  # @deprecated Never populated by metasploit-framework.
2
2
  #
3
3
  # Module mixed into a {#detail Metasploit Module}.
4
- class Mdm::Module::Mixin < ActiveRecord::Base
4
+ class Mdm::Module::Mixin < ApplicationRecord
5
5
  self.table_name = 'module_mixins'
6
6
 
7
7
  #
@@ -1,5 +1,5 @@
1
1
  # {#name Platform} on which the {#detail Metasploit Module} can run.
2
- class Mdm::Module::Platform < ActiveRecord::Base
2
+ class Mdm::Module::Platform < ApplicationRecord
3
3
  self.table_name = 'module_platforms'
4
4
 
5
5
  #
@@ -1,5 +1,5 @@
1
1
  # External references to the vulnerability exploited by this module.
2
- class Mdm::Module::Ref < ActiveRecord::Base
2
+ class Mdm::Module::Ref < ApplicationRecord
3
3
  self.table_name = 'module_refs'
4
4
 
5
5
  #
@@ -1,6 +1,6 @@
1
1
  # A potential target for a {Mdm::Module::Detail exploit Metasploit Module}. Targets can change options including
2
2
  # offsets for ROP chains to tune an exploit to work with different system libraries and versions.
3
- class Mdm::Module::Target < ActiveRecord::Base
3
+ class Mdm::Module::Target < ApplicationRecord
4
4
  self.table_name = 'module_targets'
5
5
 
6
6
  #
@@ -1,5 +1,5 @@
1
1
  # A connection to Nexpose from Metasploit.
2
- class Mdm::NexposeConsole < ActiveRecord::Base
2
+ class Mdm::NexposeConsole < ApplicationRecord
3
3
 
4
4
  #
5
5
  # Associations
@@ -1,5 +1,5 @@
1
1
  # Data gathered or derived from the {#host} or {#service} such as its {#ntype fingerprint}.
2
- class Mdm::Note < ActiveRecord::Base
2
+ class Mdm::Note < ApplicationRecord
3
3
 
4
4
  #
5
5
  # Associations
@@ -113,7 +113,7 @@ class Mdm::Note < ActiveRecord::Base
113
113
  #
114
114
  # @return [void]
115
115
  def normalize
116
- if data_changed? and ntype =~ /fingerprint/ && host.workspace.present? && !host.workspace.import_fingerprint
116
+ if saved_change_to_data? and ntype =~ /fingerprint/ && host.workspace.present? && !host.workspace.import_fingerprint
117
117
  host.normalize_os
118
118
  end
119
119
  end
@@ -1,5 +1,5 @@
1
1
  # A payload that has been generated by Metasploit and used to establish {Mdm::Session}.
2
- class Mdm::Payload < ActiveRecord::Base
2
+ class Mdm::Payload < ApplicationRecord
3
3
  extend ActiveSupport::Autoload
4
4
 
5
5
  include Metasploit::Model::Search
@@ -8,14 +8,6 @@ class Mdm::Payload < ActiveRecord::Base
8
8
  # Associations
9
9
  #
10
10
 
11
- # @!attribute [rw] workspace
12
- # {Mdm::Workspace} in which this payload was created.
13
- #
14
- # @return [Mdm::Workspace]
15
- belongs_to :workspace,
16
- class_name: 'Mdm::Workspace',
17
- inverse_of: :payloads
18
-
19
11
 
20
12
  #
21
13
  # Attributes
@@ -65,11 +57,6 @@ class Mdm::Payload < ActiveRecord::Base
65
57
  #
66
58
  # @return [String]
67
59
 
68
- # @!attribute [rw] workspace_id
69
- # The ID of the workspace this payload belongs to.
70
- #
71
- # @return [Integer]
72
-
73
60
  # @!attribute [rw] raw_payload
74
61
  # A URL pointing to where the binary payload can be downloaded from.
75
62
  #
@@ -95,8 +82,6 @@ class Mdm::Payload < ActiveRecord::Base
95
82
  # Validations
96
83
  #
97
84
 
98
- validates :workspace, :presence => true
99
-
100
85
 
101
86
  #
102
87
  # Search Attributes
@@ -1,5 +1,5 @@
1
1
  # User settings.
2
- class Mdm::Profile < ActiveRecord::Base
2
+ class Mdm::Profile < ApplicationRecord
3
3
  #
4
4
  # Attributes
5
5
  #
@@ -1,7 +1,7 @@
1
1
  # An external vulnerability reference for vulnerabilities that aren't part of a module. {Mdm::Module::Ref} should be
2
2
  # used whenever possible and Mdm::Ref should only be used when the vulnerability is from an import and can't be
3
3
  # correlated to a module and its {Mdm::Module::Detail}.
4
- class Mdm::Ref < ActiveRecord::Base
4
+ class Mdm::Ref < ApplicationRecord
5
5
  #
6
6
  # Associations
7
7
  #
@@ -1,5 +1,5 @@
1
1
  # Network route that goes through a {#session} to allow accessing IPs on the remote end of the session.
2
- class Mdm::Route < ActiveRecord::Base
2
+ class Mdm::Route < ApplicationRecord
3
3
 
4
4
  #
5
5
  # Associations
@@ -1,5 +1,5 @@
1
1
  # A service, such as an ssh server or web server, running on a {#host}.
2
- class Mdm::Service < ActiveRecord::Base
2
+ class Mdm::Service < ApplicationRecord
3
3
  include Metasploit::Model::Search
4
4
 
5
5
  #
@@ -258,7 +258,7 @@ class Mdm::Service < ActiveRecord::Base
258
258
  #
259
259
  # @return [void]
260
260
  def normalize_host_os
261
- if info_changed? && host.workspace.present? && !host.workspace.import_fingerprint
261
+ if saved_change_to_info? && host.workspace.present? && !host.workspace.import_fingerprint
262
262
  host.normalize_os
263
263
  end
264
264
  end