metasploit_data_models 3.0.8 → 4.0.2
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 +5 -5
- checksums.yaml.gz.sig +1 -3
- data.tar.gz.sig +1 -1
- data/.gitignore +1 -1
- data/.travis.yml +1 -1
- data/Gemfile +6 -4
- data/Rakefile +1 -1
- data/app/models/mdm/api_key.rb +2 -2
- data/app/models/mdm/async_callback.rb +64 -0
- data/app/models/mdm/client.rb +1 -1
- data/app/models/mdm/cred.rb +1 -1
- data/app/models/mdm/event.rb +1 -1
- data/app/models/mdm/exploit_attempt.rb +1 -1
- data/app/models/mdm/exploited_host.rb +1 -1
- data/app/models/mdm/host.rb +2 -2
- data/app/models/mdm/host_detail.rb +2 -2
- data/app/models/mdm/host_tag.rb +1 -1
- data/app/models/mdm/listener.rb +1 -1
- data/app/models/mdm/loot.rb +1 -1
- data/app/models/mdm/macro.rb +1 -1
- data/app/models/mdm/mod_ref.rb +1 -1
- data/app/models/mdm/module/action.rb +1 -1
- data/app/models/mdm/module/arch.rb +1 -1
- data/app/models/mdm/module/author.rb +1 -1
- data/app/models/mdm/module/detail.rb +1 -1
- data/app/models/mdm/module/mixin.rb +1 -1
- data/app/models/mdm/module/platform.rb +1 -1
- data/app/models/mdm/module/ref.rb +1 -1
- data/app/models/mdm/module/target.rb +1 -1
- data/app/models/mdm/nexpose_console.rb +1 -1
- data/app/models/mdm/note.rb +2 -2
- data/app/models/mdm/payload.rb +1 -16
- data/app/models/mdm/profile.rb +1 -1
- data/app/models/mdm/ref.rb +1 -1
- data/app/models/mdm/route.rb +1 -1
- data/app/models/mdm/service.rb +2 -2
- data/app/models/mdm/session.rb +1 -1
- data/app/models/mdm/session_event.rb +1 -1
- data/app/models/mdm/tag.rb +1 -1
- data/app/models/mdm/task.rb +1 -1
- data/app/models/mdm/task_cred.rb +1 -1
- data/app/models/mdm/task_host.rb +1 -1
- data/app/models/mdm/task_service.rb +1 -1
- data/app/models/mdm/task_session.rb +1 -1
- data/app/models/mdm/user.rb +2 -2
- data/app/models/mdm/vuln.rb +2 -2
- data/app/models/mdm/vuln_attempt.rb +1 -1
- data/app/models/mdm/vuln_detail.rb +1 -1
- data/app/models/mdm/vuln_ref.rb +1 -1
- data/app/models/mdm/web_form.rb +1 -1
- data/app/models/mdm/web_page.rb +1 -1
- data/app/models/mdm/web_site.rb +1 -1
- data/app/models/mdm/web_vuln.rb +1 -1
- data/app/models/mdm/wmap_request.rb +1 -1
- data/app/models/mdm/wmap_target.rb +1 -1
- data/app/models/mdm/workspace.rb +6 -9
- data/app/models/metasploit_data_models/automatic_exploitation/match.rb +1 -1
- data/app/models/metasploit_data_models/automatic_exploitation/match_result.rb +1 -1
- data/app/models/metasploit_data_models/automatic_exploitation/match_set.rb +1 -1
- data/app/models/metasploit_data_models/automatic_exploitation/run.rb +2 -2
- data/app/models/metasploit_data_models/module_run.rb +1 -1
- data/app/validators/ip_format_validator.rb +1 -1
- data/app/validators/parameters_validator.rb +7 -7
- data/bin/rails +14 -0
- data/config/initializers/arel_helper.rb +2 -2
- data/config/initializers/ipaddr.rb +11 -6
- data/db/migrate/000_create_tables.rb +1 -1
- data/db/migrate/001_add_wmap_tables.rb +1 -1
- data/db/migrate/002_add_workspaces.rb +1 -1
- data/db/migrate/003_move_notes.rb +1 -1
- data/db/migrate/004_add_events_table.rb +1 -1
- data/db/migrate/005_expand_info.rb +1 -1
- data/db/migrate/006_add_timestamps.rb +1 -1
- data/db/migrate/007_add_loots.rb +1 -1
- data/db/migrate/008_create_users.rb +1 -1
- data/db/migrate/009_add_loots_ctype.rb +1 -1
- data/db/migrate/010_add_alert_fields.rb +1 -1
- data/db/migrate/011_add_reports.rb +1 -1
- data/db/migrate/012_add_tasks.rb +1 -1
- data/db/migrate/013_add_tasks_result.rb +1 -1
- data/db/migrate/014_add_loots_fields.rb +1 -1
- data/db/migrate/015_rename_user.rb +1 -1
- data/db/migrate/016_add_host_purpose.rb +1 -1
- data/db/migrate/017_expand_info2.rb +1 -1
- data/db/migrate/018_add_workspace_user_info.rb +1 -1
- data/db/migrate/019_add_workspace_desc.rb +1 -1
- data/db/migrate/020_add_user_preferences.rb +1 -1
- data/db/migrate/021_standardize_info_and_data.rb +1 -1
- data/db/migrate/022_enlarge_event_info.rb +1 -1
- data/db/migrate/023_add_report_downloaded_at.rb +1 -1
- data/db/migrate/024_convert_service_info_to_text.rb +1 -1
- data/db/migrate/025_add_user_admin.rb +1 -1
- data/db/migrate/026_add_creds_table.rb +1 -1
- data/db/migrate/20100819123300_migrate_cred_data.rb +1 -1
- data/db/migrate/20100824151500_add_exploited_table.rb +1 -1
- data/db/migrate/20100908001428_add_owner_to_workspaces.rb +1 -1
- data/db/migrate/20100911122000_add_report_templates.rb +1 -1
- data/db/migrate/20100916151530_require_admin_flag.rb +1 -1
- data/db/migrate/20100916175000_add_campaigns_and_templates.rb +1 -1
- data/db/migrate/20100920012100_add_generate_exe_column.rb +1 -1
- data/db/migrate/20100926214000_add_template_prefs.rb +1 -1
- data/db/migrate/20101001000000_add_web_tables.rb +1 -1
- data/db/migrate/20101002000000_add_query.rb +1 -1
- data/db/migrate/20101007000000_add_vuln_info.rb +1 -1
- data/db/migrate/20101008111800_add_clients_to_campaigns.rb +1 -1
- data/db/migrate/20101009023300_add_campaign_attachments.rb +1 -1
- data/db/migrate/20101104135100_add_imported_creds.rb +1 -1
- data/db/migrate/20101203000000_fix_web_tables.rb +1 -1
- data/db/migrate/20101203000001_expand_host_comment.rb +1 -1
- data/db/migrate/20101206212033_add_limit_to_network_to_workspaces.rb +1 -1
- data/db/migrate/20110112154300_add_module_uuid_to_tasks.rb +1 -1
- data/db/migrate/20110204112800_add_host_tags.rb +1 -1
- data/db/migrate/20110317144932_add_session_table.rb +4 -4
- data/db/migrate/20110414180600_add_local_id_to_session_table.rb +1 -1
- data/db/migrate/20110415175705_add_routes_table.rb +1 -1
- data/db/migrate/20110422000000_convert_binary.rb +3 -3
- data/db/migrate/20110425095900_add_last_seen_to_sessions.rb +1 -1
- data/db/migrate/20110513143900_track_successful_exploits.rb +3 -3
- data/db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb +2 -2
- data/db/migrate/20110527000000_add_task_id_to_reports_table.rb +1 -1
- data/db/migrate/20110527000001_add_api_keys_table.rb +1 -1
- data/db/migrate/20110606000001_add_macros_table.rb +1 -1
- data/db/migrate/20110622000000_add_settings_to_tasks_table.rb +1 -1
- data/db/migrate/20110624000001_add_listeners_table.rb +1 -1
- data/db/migrate/20110625000001_add_macro_to_listeners_table.rb +1 -1
- data/db/migrate/20110630000001_add_nexpose_consoles_table.rb +1 -1
- data/db/migrate/20110630000002_add_name_to_nexpose_consoles_table.rb +1 -1
- data/db/migrate/20110717000001_add_profiles_table.rb +1 -1
- data/db/migrate/20110727163801_expand_cred_ptype_column.rb +1 -1
- data/db/migrate/20110730000001_add_initial_indexes.rb +1 -1
- data/db/migrate/20110812000001_prune_indexes.rb +1 -1
- data/db/migrate/20110922000000_expand_notes.rb +1 -1
- data/db/migrate/20110928101300_add_mod_ref_table.rb +1 -1
- data/db/migrate/20111011110000_add_display_name_to_reports_table.rb +2 -2
- data/db/migrate/20111203000000_inet_columns.rb +1 -1
- data/db/migrate/20111204000000_more_inet_columns.rb +1 -1
- data/db/migrate/20111210000000_add_scope_to_hosts.rb +1 -1
- data/db/migrate/20120126110000_add_virtual_host_to_hosts.rb +1 -1
- data/db/migrate/20120411173220_rename_workspace_members.rb +1 -1
- data/db/migrate/20120601152442_add_counter_caches_to_hosts.rb +2 -2
- data/db/migrate/20120625000000_add_vuln_details.rb +1 -1
- data/db/migrate/20120625000001_add_host_details.rb +1 -1
- data/db/migrate/20120625000002_expand_details.rb +1 -1
- data/db/migrate/20120625000003_expand_details2.rb +1 -1
- data/db/migrate/20120625000004_add_vuln_attempts.rb +1 -1
- data/db/migrate/20120625000005_add_vuln_and_host_counter_caches.rb +1 -1
- data/db/migrate/20120625000006_add_module_details.rb +1 -1
- data/db/migrate/20120625000007_add_exploit_attempts.rb +1 -1
- data/db/migrate/20120625000008_add_fail_message.rb +1 -1
- data/db/migrate/20120718202805_add_owner_and_payload_to_web_vulns.rb +1 -1
- data/db/migrate/20130412154159_change_foreign_key_in_module_actions.rb +1 -1
- data/db/migrate/20130412171844_change_foreign_key_in_module_archs.rb +1 -1
- data/db/migrate/20130412173121_change_foreign_key_in_module_authors.rb +1 -1
- data/db/migrate/20130412173640_change_foreign_key_in_module_mixins.rb +1 -1
- data/db/migrate/20130412174254_change_foreign_key_in_module_platforms.rb +1 -1
- data/db/migrate/20130412174719_change_foreign_key_in_module_refs.rb +1 -1
- data/db/migrate/20130412175040_change_foreign_key_in_module_targets.rb +1 -1
- data/db/migrate/20130423211152_add_creds_counter_cache.rb +1 -1
- data/db/migrate/20130430162145_enforce_address_uniqueness_in_workspace_in_hosts.rb +6 -6
- data/db/migrate/20130510021637_remove_campaigns.rb +1 -1
- data/db/migrate/20130515164311_change_web_vulns_confidence_to_integer.rb +1 -1
- data/db/migrate/20130515172727_valid_mdm_web_vuln_params.rb +1 -1
- data/db/migrate/20130516204810_making_vulns_refs_a_real_ar_model.rb +2 -2
- data/db/migrate/20130522001343_create_task_creds.rb +1 -1
- data/db/migrate/20130522032517_create_task_hosts.rb +1 -1
- data/db/migrate/20130522041110_create_task_services.rb +1 -1
- data/db/migrate/20130525015035_remove_campaign_id_from_clients.rb +1 -1
- data/db/migrate/20130525212420_drop_table_imported_creds.rb +1 -1
- data/db/migrate/20130531144949_making_host_tags_a_real_ar_model.rb +1 -1
- data/db/migrate/20130604145732_create_task_sessions.rb +1 -1
- data/db/migrate/20130717150737_remove_pname_validation.rb +1 -1
- data/db/migrate/20131002004641_create_automatic_exploitation_matches.rb +1 -1
- data/db/migrate/20131002164449_create_automatic_exploitation_match_sets.rb +1 -1
- data/db/migrate/20131008213344_create_automatic_exploitation_runs.rb +1 -1
- data/db/migrate/20131011184338_module_detail_on_automatic_exploitation_match.rb +1 -1
- data/db/migrate/20131017150735_create_automatic_exploitation_match_results.rb +1 -1
- data/db/migrate/20131021185657_make_match_polymorphic.rb +1 -1
- data/db/migrate/20140905031549_add_detected_arch_to_host.rb +1 -1
- data/db/migrate/20150112203945_remove_duplicate_services.rb +1 -1
- data/db/migrate/20150205192745_drop_service_uniqueness_index.rb +1 -1
- data/db/migrate/20150209195939_add_vuln_id_to_note.rb +1 -1
- data/db/migrate/20150212214222_remove_duplicate_services2.rb +1 -1
- data/db/migrate/20150219173821_create_module_runs.rb +1 -1
- data/db/migrate/20150219215039_add_module_run_to_session.rb +1 -1
- data/db/migrate/20150226151459_add_module_run_fk_to_loot.rb +1 -1
- data/db/migrate/20150312155312_add_module_full_name_to_match.rb +1 -1
- data/db/migrate/20150317145455_rename_module_indices.rb +2 -2
- data/db/migrate/20150326183742_add_missing_ae_indices.rb +1 -1
- data/db/migrate/20150421211719_rename_automatic_exploitation_index.rb +3 -3
- data/db/migrate/20150514182921_add_origin_to_mdm_vuln.rb +1 -1
- data/db/migrate/20160415153312_remove_not_null_from_web_vuln_p_arams.rb +1 -1
- data/db/migrate/20161004165612_add_fingerprinted_to_workspace.rb +1 -1
- data/db/migrate/20161227212223_add_os_family_to_hosts.rb +1 -1
- data/db/migrate/20180904120211_create_payloads.rb +1 -1
- data/db/migrate/20190308134512_create_async_callbacks.rb +14 -0
- data/db/migrate/20190507120211_remove_payload_workspaces.rb +5 -0
- data/lib/mdm.rb +1 -0
- data/lib/metasploit_data_models.rb +0 -1
- data/lib/metasploit_data_models/automatic_exploitation.rb +1 -1
- data/lib/metasploit_data_models/base64_serializer.rb +1 -1
- data/lib/metasploit_data_models/change_required_columns_to_null_false.rb +2 -2
- data/lib/metasploit_data_models/engine.rb +1 -1
- data/lib/metasploit_data_models/version.rb +1 -1
- data/metasploit_data_models.gemspec +4 -8
- data/spec/app/models/mdm/exploit_attempt_spec.rb +2 -2
- data/spec/app/models/mdm/host_detail_spec.rb +1 -1
- data/spec/app/models/mdm/host_spec.rb +27 -27
- data/spec/app/models/mdm/module/detail_spec.rb +18 -18
- data/spec/app/models/mdm/service_spec.rb +1 -0
- data/spec/app/models/mdm/vuln_attempt_spec.rb +1 -1
- data/spec/app/models/mdm/vuln_detail_spec.rb +1 -1
- data/spec/app/models/mdm/vuln_spec.rb +1 -1
- data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +4 -4
- data/spec/dummy/app/assets/config/manifest.js +1 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/db/structure.sql +213 -329
- metadata +92 -98
- metadata.gz.sig +0 -0
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
data/app/models/mdm/session.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# A session opened on a {#host} using an {#via_exploit exploit} and controlled through a {#via_payload payload} to
|
|
2
2
|
# connect back to the local host using meterpreter or a cmd shell.
|
|
3
|
-
class Mdm::Session <
|
|
3
|
+
class Mdm::Session < ApplicationRecord
|
|
4
4
|
|
|
5
5
|
#
|
|
6
6
|
# Associations
|
data/app/models/mdm/tag.rb
CHANGED
data/app/models/mdm/task.rb
CHANGED
data/app/models/mdm/task_cred.rb
CHANGED
data/app/models/mdm/task_host.rb
CHANGED
data/app/models/mdm/user.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# A user of metasploit-framework or metasploit-pro.
|
|
2
|
-
class Mdm::User <
|
|
2
|
+
class Mdm::User < ApplicationRecord
|
|
3
3
|
extend MetasploitDataModels::SerializedPrefs
|
|
4
4
|
|
|
5
5
|
#
|
|
@@ -36,7 +36,7 @@ class Mdm::User < ActiveRecord::Base
|
|
|
36
36
|
# {Mdm::Workspace Workspace} where this user has access. If a user is an {#admin administrator} they have access
|
|
37
37
|
# to all workspaces even if they are not a member of that workspace.
|
|
38
38
|
has_and_belongs_to_many :workspaces,
|
|
39
|
-
-> {
|
|
39
|
+
-> { distinct },
|
|
40
40
|
class_name: 'Mdm::Workspace',
|
|
41
41
|
join_table: 'workspace_members'
|
|
42
42
|
|
data/app/models/mdm/vuln.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# A vulnerability found on a {#host} or {#service}.
|
|
2
|
-
class Mdm::Vuln <
|
|
2
|
+
class Mdm::Vuln < ApplicationRecord
|
|
3
3
|
|
|
4
4
|
#
|
|
5
5
|
# Associations
|
|
@@ -122,7 +122,7 @@ class Mdm::Vuln < ActiveRecord::Base
|
|
|
122
122
|
#
|
|
123
123
|
# @return [ActiveRecord::Relation<Mdm::Module::Detail>]
|
|
124
124
|
has_many :module_details,
|
|
125
|
-
-> {
|
|
125
|
+
-> { distinct },
|
|
126
126
|
:class_name => 'Mdm::Module::Detail',
|
|
127
127
|
:source => :detail,
|
|
128
128
|
:through => :module_refs
|
data/app/models/mdm/vuln_ref.rb
CHANGED
data/app/models/mdm/web_form.rb
CHANGED
data/app/models/mdm/web_page.rb
CHANGED
data/app/models/mdm/web_site.rb
CHANGED
data/app/models/mdm/web_vuln.rb
CHANGED
data/app/models/mdm/workspace.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Workspace to separate different collections of {#hosts}. Can be used to separate pentests against different networks
|
|
2
2
|
# or different clients as reports are normally generated against all records in a workspace.
|
|
3
|
-
class Mdm::Workspace <
|
|
3
|
+
class Mdm::Workspace < ApplicationRecord
|
|
4
4
|
#
|
|
5
5
|
# CONSTANTS
|
|
6
6
|
#
|
|
@@ -52,7 +52,7 @@ class Mdm::Workspace < ActiveRecord::Base
|
|
|
52
52
|
# Users that are allowed to use this workspace. Does not necessarily include all users, as an {Mdm::User#admin
|
|
53
53
|
# administrator} can access any workspace, even ones where they are not a member.
|
|
54
54
|
has_and_belongs_to_many :users,
|
|
55
|
-
-> {
|
|
55
|
+
-> { distinct },
|
|
56
56
|
class_name: 'Mdm::User',
|
|
57
57
|
join_table: 'workspace_members'
|
|
58
58
|
|
|
@@ -81,9 +81,6 @@ class Mdm::Workspace < ActiveRecord::Base
|
|
|
81
81
|
# Sessions opened on {#hosts} in this workspace.
|
|
82
82
|
has_many :sessions, :through => :hosts, :class_name => 'Mdm::Session'
|
|
83
83
|
|
|
84
|
-
# Payloads for this workspace.
|
|
85
|
-
has_many :payloads, :class_name => 'Mdm::Payload'
|
|
86
|
-
|
|
87
84
|
#
|
|
88
85
|
# Attributes
|
|
89
86
|
#
|
|
@@ -213,7 +210,7 @@ class Mdm::Workspace < ActiveRecord::Base
|
|
|
213
210
|
Mdm::WebSite.join_association(:service),
|
|
214
211
|
Mdm::Service.join_association(:host),
|
|
215
212
|
Mdm::Host.join_association(:workspace)
|
|
216
|
-
).where(Mdm::Workspace[:id].eq(id)).
|
|
213
|
+
).where(Mdm::Workspace[:id].eq(id)).distinct
|
|
217
214
|
end
|
|
218
215
|
|
|
219
216
|
|
|
@@ -226,7 +223,7 @@ class Mdm::Workspace < ActiveRecord::Base
|
|
|
226
223
|
Mdm::WebSite.join_association(:service),
|
|
227
224
|
Mdm::Service.join_association(:host),
|
|
228
225
|
Mdm::Host.join_association(:workspace)
|
|
229
|
-
).where(Mdm::Workspace[:id].eq(id)).
|
|
226
|
+
).where(Mdm::Workspace[:id].eq(id)).distinct
|
|
230
227
|
end
|
|
231
228
|
|
|
232
229
|
# Web sites running on {#services}.
|
|
@@ -237,7 +234,7 @@ class Mdm::Workspace < ActiveRecord::Base
|
|
|
237
234
|
Mdm::WebSite.join_association(:service),
|
|
238
235
|
Mdm::Service.join_association(:host),
|
|
239
236
|
Mdm::Host.join_association(:workspace)
|
|
240
|
-
).where(Mdm::Workspace[:id].eq(id)).
|
|
237
|
+
).where(Mdm::Workspace[:id].eq(id)).distinct
|
|
241
238
|
end
|
|
242
239
|
|
|
243
240
|
# Web vulnerability found on {#web_sites}.
|
|
@@ -249,7 +246,7 @@ class Mdm::Workspace < ActiveRecord::Base
|
|
|
249
246
|
Mdm::WebSite.join_association(:service),
|
|
250
247
|
Mdm::Service.join_association(:host),
|
|
251
248
|
Mdm::Host.join_association(:workspace)
|
|
252
|
-
).where(Mdm::Workspace[:id].eq(id)).
|
|
249
|
+
).where(Mdm::Workspace[:id].eq(id)).distinct
|
|
253
250
|
end
|
|
254
251
|
|
|
255
252
|
# Web forms on {#web_sites}.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Matches {#matchable} {Mdm::Service} or {Mdm::Vuln} to a {#module_detail Metasploit Module} that can exploit it.
|
|
2
|
-
class MetasploitDataModels::AutomaticExploitation::Match <
|
|
2
|
+
class MetasploitDataModels::AutomaticExploitation::Match < ApplicationRecord
|
|
3
3
|
#
|
|
4
4
|
# Associations
|
|
5
5
|
#
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Runs a {#match_set set of matches} to produce {#match_results results}.
|
|
2
|
-
class MetasploitDataModels::AutomaticExploitation::Run <
|
|
2
|
+
class MetasploitDataModels::AutomaticExploitation::Run < ApplicationRecord
|
|
3
3
|
#
|
|
4
4
|
# Associations
|
|
5
5
|
#
|
|
@@ -26,4 +26,4 @@ class MetasploitDataModels::AutomaticExploitation::Run < ActiveRecord::Base
|
|
|
26
26
|
inverse_of: :automatic_exploitation_runs
|
|
27
27
|
|
|
28
28
|
Metasploit::Concern.run(self)
|
|
29
|
-
end
|
|
29
|
+
end
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# There are also associations to {Mdm::Session} for two use cases: a `spawned_session` is a
|
|
7
7
|
# session created by the ModuleRun. A `target_session` is a session that the ModuleRun
|
|
8
8
|
# is acting upon (e.g.) for running a post module.
|
|
9
|
-
class MetasploitDataModels::ModuleRun <
|
|
9
|
+
class MetasploitDataModels::ModuleRun < ApplicationRecord
|
|
10
10
|
#
|
|
11
11
|
# Constants
|
|
12
12
|
#
|
|
@@ -6,7 +6,7 @@ class IpFormatValidator < ActiveModel::EachValidator
|
|
|
6
6
|
#
|
|
7
7
|
# @return [void]
|
|
8
8
|
def validate_each(object, attribute, value)
|
|
9
|
-
error_message_block = lambda{ object.errors
|
|
9
|
+
error_message_block = lambda{ object.errors.add attribute, " must be a valid IPv4 or IPv6 address" }
|
|
10
10
|
begin
|
|
11
11
|
if value.is_a? IPAddr
|
|
12
12
|
potential_ip = value.dup
|
|
@@ -33,7 +33,7 @@ class ParametersValidator < ActiveModel::EachValidator
|
|
|
33
33
|
:index => index
|
|
34
34
|
)
|
|
35
35
|
|
|
36
|
-
record.errors
|
|
36
|
+
record.errors.add attribute, length_error
|
|
37
37
|
else
|
|
38
38
|
parameter_name = element.first
|
|
39
39
|
|
|
@@ -44,7 +44,7 @@ class ParametersValidator < ActiveModel::EachValidator
|
|
|
44
44
|
:index => index,
|
|
45
45
|
:prefix => "has blank parameter name"
|
|
46
46
|
)
|
|
47
|
-
record.errors
|
|
47
|
+
record.errors.add attribute, error
|
|
48
48
|
end
|
|
49
49
|
else
|
|
50
50
|
error = error_at(
|
|
@@ -52,7 +52,7 @@ class ParametersValidator < ActiveModel::EachValidator
|
|
|
52
52
|
:index => index,
|
|
53
53
|
:prefix => "has non-String parameter name (#{parameter_name.inspect})"
|
|
54
54
|
)
|
|
55
|
-
record.errors
|
|
55
|
+
record.errors.add attribute, error
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
parameter_value = element.second
|
|
@@ -63,7 +63,7 @@ class ParametersValidator < ActiveModel::EachValidator
|
|
|
63
63
|
:index => index,
|
|
64
64
|
:prefix => "has non-String parameter value (#{parameter_value.inspect})"
|
|
65
65
|
)
|
|
66
|
-
record.errors
|
|
66
|
+
record.errors.add attribute, error
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
69
|
else
|
|
@@ -72,11 +72,11 @@ class ParametersValidator < ActiveModel::EachValidator
|
|
|
72
72
|
:index => index,
|
|
73
73
|
:prefix => 'has non-Array'
|
|
74
74
|
)
|
|
75
|
-
record.errors
|
|
75
|
+
record.errors.add attribute, error
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
else
|
|
79
|
-
record.errors
|
|
79
|
+
record.errors.add attribute, "is not an Array. #{TYPE_SIGNATURE_SENTENCE}"
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
@@ -126,4 +126,4 @@ class ParametersValidator < ActiveModel::EachValidator
|
|
|
126
126
|
|
|
127
127
|
clause
|
|
128
128
|
end
|
|
129
|
-
end
|
|
129
|
+
end
|
data/bin/rails
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This command will automatically be run when you run "rails" with Rails gems
|
|
3
|
+
# installed from the root of your application.
|
|
4
|
+
|
|
5
|
+
ENGINE_ROOT = File.expand_path('..', __dir__)
|
|
6
|
+
ENGINE_PATH = File.expand_path('../lib/metasploit_data_models/engine', __dir__)
|
|
7
|
+
APP_PATH = File.expand_path('../test/dummy/config/application', __dir__)
|
|
8
|
+
|
|
9
|
+
# Set up gems listed in the Gemfile.
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
|
11
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
|
12
|
+
|
|
13
|
+
require 'rails/all'
|
|
14
|
+
require 'rails/engine/commands'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Including arel-helpers in all active record models.
|
|
2
2
|
# https://github.com/camertron/arel-helpers
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
ApplicationRecord.send(:include, ArelHelpers::ArelTable)
|
|
5
|
+
ApplicationRecord.send(:include, ArelHelpers::JoinAssociation)
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
module IPAddrExtensions
|
|
2
2
|
extend ActiveSupport::Concern
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def coerce_other_with_rescue(other)
|
|
3
|
+
|
|
4
|
+
def coerce(other)
|
|
8
5
|
begin
|
|
9
6
|
case other
|
|
10
7
|
when IPAddr
|
|
@@ -18,7 +15,15 @@ module IPAddrExtensions
|
|
|
18
15
|
OpenStruct.new(family: false, to_i: false)
|
|
19
16
|
end
|
|
20
17
|
end
|
|
18
|
+
|
|
19
|
+
def include?(other)
|
|
20
|
+
begin
|
|
21
|
+
super(other)
|
|
22
|
+
rescue IPAddr::InvalidAddressError
|
|
23
|
+
false
|
|
24
|
+
end
|
|
25
|
+
end
|
|
21
26
|
|
|
22
27
|
end
|
|
23
28
|
|
|
24
|
-
IPAddr.send(:
|
|
29
|
+
IPAddr.send(:prepend, IPAddrExtensions)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
# Adds 'created_at' and 'updated_at' columns to every primary table.
|
|
3
3
|
#
|
|
4
|
-
class AddTimestamps < ActiveRecord::Migration
|
|
4
|
+
class AddTimestamps < ActiveRecord::Migration[4.2]
|
|
5
5
|
|
|
6
6
|
@@TABLES_NEEDING_RENAME = [:clients, :hosts, :notes, :refs, :services, :vulns, :wmap_requests]
|
|
7
7
|
@@TABLES_NEEDING_CREATED_AT = [:wmap_targets]
|