metasploit-credential 3.0.4 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/app/concerns/mdm/task/metasploit_credential_core.rb +2 -2
  5. data/app/concerns/mdm/task/metasploit_credential_login.rb +2 -2
  6. data/app/models/metasploit/credential/core.rb +3 -3
  7. data/app/models/metasploit/credential/login.rb +2 -2
  8. data/app/models/metasploit/credential/origin/cracked_password.rb +1 -1
  9. data/app/models/metasploit/credential/origin/import.rb +1 -1
  10. data/app/models/metasploit/credential/origin/manual.rb +1 -1
  11. data/app/models/metasploit/credential/origin/service.rb +1 -1
  12. data/app/models/metasploit/credential/origin/session.rb +1 -1
  13. data/app/models/metasploit/credential/private.rb +1 -1
  14. data/app/models/metasploit/credential/public.rb +1 -1
  15. data/app/models/metasploit/credential/realm.rb +1 -1
  16. data/app/models/metasploit/credential/search/operator/type.rb +2 -2
  17. data/db/migrate/20140331173835_create_metasploit_credential_publics.rb +1 -1
  18. data/db/migrate/20140407212345_create_metasploit_credential_privates.rb +1 -1
  19. data/db/migrate/20140410132401_create_metasploit_credential_realms.rb +1 -1
  20. data/db/migrate/20140410161611_unique_metasploit_credential_realms.rb +1 -1
  21. data/db/migrate/20140410191213_create_metasploit_credential_origin_manuals.rb +1 -1
  22. data/db/migrate/20140410205410_create_metasploit_credential_origin_imports.rb +1 -1
  23. data/db/migrate/20140411142102_create_metasploit_credential_origin_sessions.rb +1 -1
  24. data/db/migrate/20140411205325_create_metasploit_credential_origin_services.rb +1 -1
  25. data/db/migrate/20140414192550_create_metasploit_credential_cores.rb +1 -1
  26. data/db/migrate/20140417140933_create_metasploit_credential_logins.rb +1 -1
  27. data/db/migrate/20140520140817_add_logins_counter_cache_to_cores.rb +1 -1
  28. data/db/migrate/20140603163708_add_jtr_format_to_metasploit_credential_privates.rb +1 -1
  29. data/db/migrate/20140605173747_create_metasploit_credential_origin_cracked_passwords.rb +1 -1
  30. data/db/migrate/20140702184622_create_credential_cores_tasks_join_table.rb +2 -2
  31. data/db/migrate/20140703144541_create_credential_logins_tasks_join_table.rb +1 -1
  32. data/db/migrate/20140722174919_old_creds_to_new_creds.rb +1 -1
  33. data/db/migrate/20140728191933_unique_metasploit_credential_cores.rb +1 -1
  34. data/db/migrate/20140801150537_unique_metasploit_credential_cores_with_realm_id.rb +1 -1
  35. data/db/migrate/20140922170030_add_typeto_public.rb +1 -1
  36. data/db/migrate/20150106201450_old_creds_to_new_creds2.rb +1 -1
  37. data/db/migrate/20161107153145_recreate_index_on_private_data_and_type.rb +1 -1
  38. data/db/migrate/20161107203710_create_index_on_private_data_and_type_for_ssh_key.rb +1 -1
  39. data/lib/metasploit/credential.rb +1 -1
  40. data/lib/metasploit/credential/core_validations.rb +6 -6
  41. data/lib/metasploit/credential/creation.rb +1 -1
  42. data/lib/metasploit/credential/entity_relationship_diagram.rb +10 -10
  43. data/lib/metasploit/credential/exporter/pwdump.rb +1 -1
  44. data/lib/metasploit/credential/origin.rb +1 -1
  45. data/lib/metasploit/credential/version.rb +1 -1
  46. data/spec/dummy/app/models/application_record.rb +3 -0
  47. data/spec/dummy/config/application.rb +0 -5
  48. data/spec/dummy/config/database.yml +2 -2
  49. data/spec/dummy/config/environments/development.rb +0 -10
  50. data/spec/lib/metasploit/credential/creation_spec.rb +1 -1
  51. data/spec/lib/metasploit/credential/importer/pwdump_spec.rb +1 -1
  52. metadata +4 -4
  53. metadata.gz.sig +0 -0
  54. data/spec/dummy/config/initializers/assets.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e32058185ba39a78129a585e86c500790a52e2553a98bca55e2804428c4c5e6
4
- data.tar.gz: 8b74251eda58f780025e4bbd6b3d780bc6da7d14d9c6029cf86397e9a579b299
3
+ metadata.gz: 56d3f12b32ff69edc1d61dcfe44578abf1d039679320ad45e1109b7180038d11
4
+ data.tar.gz: 014e0d05a2983eb3c94f211930c55434ae789af5232ab58c18741057c865bc49
5
5
  SHA512:
6
- metadata.gz: 2171821e86cdcddbd84a9206feb91b2b588c4dd1fa5f44c8444ab0a71b28dc3c5972145d680a997274738d78574916b0e82dd3c0d3b45490c269d70a6b3403ff
7
- data.tar.gz: 263e9323aa40fa177d39e400caa4eb88d05b3d6ce24fe6877f0e01480f9599bee7b5ef58b3b48a5768520f640194084d2f6c18ec82b6a8c3e9b9375b15c38db4
6
+ metadata.gz: d1264f5666b467b40ae7e24da2cecae6ee57cef12a4b087bb9db8e8b7914518a389da59e2e102ae8f9d6efb6229e84a1dee371d7d17ff302650558c78dc8f75f
7
+ data.tar.gz: a7ab4645c7c03e282afcfc691bf746d08ea8e2b2dc2d7c1014b6fd3b61b772049ab105b0b4019f4b70622099c946fa8d7dc9f907e3edabc788dc6fd782d9490c
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -12,8 +12,8 @@ module Mdm::Task::MetasploitCredentialCore
12
12
  #
13
13
  # @return [ActiveRecord::Relation<Metasploit::Credential::Core>]
14
14
  has_and_belongs_to_many :credential_cores,
15
- -> { uniq },
15
+ -> { distinct },
16
16
  class_name: "Metasploit::Credential::Core",
17
17
  join_table: "credential_cores_tasks"
18
18
  end
19
- end
19
+ end
@@ -12,8 +12,8 @@ module Mdm::Task::MetasploitCredentialLogin
12
12
  #
13
13
  # @return [ActiveRecord::Relation<Metasploit::Credential::Core>]
14
14
  has_and_belongs_to_many :credential_logins,
15
- -> { uniq },
15
+ -> { distinct },
16
16
  class_name: "Metasploit::Credential::Login",
17
17
  join_table: "credential_logins_tasks"
18
18
  end
19
- end
19
+ end
@@ -3,7 +3,7 @@
3
3
  # used.
4
4
  #
5
5
  # A core credential must always have an {#origin}, but only needs 1 of {#private}, {#public}, or {#realm} set.
6
- class Metasploit::Credential::Core < ActiveRecord::Base
6
+ class Metasploit::Credential::Core < ApplicationRecord
7
7
  include Metasploit::Model::Search
8
8
  include Metasploit::Credential::CoreValidations
9
9
 
@@ -16,7 +16,7 @@ class Metasploit::Credential::Core < ActiveRecord::Base
16
16
  #
17
17
  # @return [ActiveRecord::Relation<Mdm::Task>]
18
18
  has_and_belongs_to_many :tasks,
19
- -> { uniq },
19
+ -> { distinct },
20
20
  class_name: "Mdm::Task",
21
21
  join_table: "credential_cores_tasks"
22
22
 
@@ -127,7 +127,7 @@ class Metasploit::Credential::Core < ActiveRecord::Base
127
127
  #
128
128
  # @method origins(origin_class)
129
129
  # @scope Metasploit::Credential::Core
130
- # @param origin_class [ActiveRecord::Base] the Origin class to look up
130
+ # @param origin_class [ApplicationRecord] the Origin class to look up
131
131
  # @param table_alias [String] an alias for the JOINed table, defaults to the table name
132
132
  # @return [ActiveRecord::Relation] scoped to that origin
133
133
  scope :origins, lambda { |origin_class, table_alias=nil|
@@ -1,5 +1,5 @@
1
1
  # The use of a {#core core credential} against a {#service service}.
2
- class Metasploit::Credential::Login < ActiveRecord::Base
2
+ class Metasploit::Credential::Login < ApplicationRecord
3
3
  extend ActiveSupport::Autoload
4
4
 
5
5
  include Metasploit::Model::Search
@@ -13,7 +13,7 @@ class Metasploit::Credential::Login < ActiveRecord::Base
13
13
  #
14
14
  # @return [ActiveRecord::Relation<Mdm::Task>]
15
15
  has_and_belongs_to_many :tasks,
16
- -> { uniq },
16
+ -> { distinct },
17
17
  class_name: "Mdm::Task",
18
18
  join_table: "credential_logins_tasks"
19
19
 
@@ -1,5 +1,5 @@
1
1
  # An origin for {#cores core credentials} that were cracked from a {#originating_core core credentials}
2
- class Metasploit::Credential::Origin::CrackedPassword < ActiveRecord::Base
2
+ class Metasploit::Credential::Origin::CrackedPassword < ApplicationRecord
3
3
 
4
4
  #
5
5
  # Associations
@@ -1,5 +1,5 @@
1
1
  # An origin for {#cores core credentials} that were imported by a {#task} from a {#filename file}.
2
- class Metasploit::Credential::Origin::Import < ActiveRecord::Base
2
+ class Metasploit::Credential::Origin::Import < ApplicationRecord
3
3
  #
4
4
  # Associations
5
5
  #
@@ -1,5 +1,5 @@
1
1
  # Origin of {#cores core credentials} that are manually entered by a {#user}.
2
- class Metasploit::Credential::Origin::Manual < ActiveRecord::Base
2
+ class Metasploit::Credential::Origin::Manual < ApplicationRecord
3
3
  #
4
4
  # Associations
5
5
  #
@@ -3,7 +3,7 @@
3
3
  # for `Metasploit::Credential::Core`s derived after a {Metasploit::Credential::Origin::Session#session session} is
4
4
  # gained and a {Metasploit::Credential::Origin::Session#post_reference_name post module} is run from the session to
5
5
  # gather credentials.
6
- class Metasploit::Credential::Origin::Service < ActiveRecord::Base
6
+ class Metasploit::Credential::Origin::Service < ApplicationRecord
7
7
  #
8
8
  # CONSTANTS
9
9
  #
@@ -3,7 +3,7 @@
3
3
  # {Metasploit::Credential::Origin::Service#module_full_name auxiliary or exploit modules} that gather credentials
4
4
  # directly from a {Metasploit::Credential::Origin::Service#service service} without the need for a separate post module
5
5
  # or even a session.
6
- class Metasploit::Credential::Origin::Session < ActiveRecord::Base
6
+ class Metasploit::Credential::Origin::Session < ApplicationRecord
7
7
  #
8
8
  # Associations
9
9
  #
@@ -2,7 +2,7 @@
2
2
  # disclosed, such as a {Metasploit::Credential::Password password}, password hash, or key file.
3
3
  #
4
4
  # Uses Single Table Inheritance to store subclass name in {#type} per Rails convention.
5
- class Metasploit::Credential::Private < ActiveRecord::Base
5
+ class Metasploit::Credential::Private < ApplicationRecord
6
6
  include Metasploit::Model::Search
7
7
 
8
8
  #
@@ -1,5 +1,5 @@
1
1
  # A publicly disclosed credential, i.e. a {#username}.
2
- class Metasploit::Credential::Public < ActiveRecord::Base
2
+ class Metasploit::Credential::Public < ApplicationRecord
3
3
  include Metasploit::Model::Search
4
4
 
5
5
  #
@@ -1,6 +1,6 @@
1
1
  # The realm in which a {Metasploit::Credential::Public} can be used to authenticate or from which a
2
2
  # {Metasploit::Credential::Private} was looted.
3
- class Metasploit::Credential::Realm < ActiveRecord::Base
3
+ class Metasploit::Credential::Realm < ApplicationRecord
4
4
  extend ActiveSupport::Autoload
5
5
 
6
6
  include Metasploit::Model::Search
@@ -24,7 +24,7 @@ class Metasploit::Credential::Search::Operator::Type < Metasploit::Model::Search
24
24
  # Instance Methods
25
25
  #
26
26
 
27
- # Defaults to `:type` as all STI tables in `ActiveRecord::Base` use `type` as teh type attribute by default. Override
27
+ # Defaults to `:type` as all STI tables in `ApplicationRecord` use `type` as teh type attribute by default. Override
28
28
  # to search foreign key types, which are prefixed with the association name.
29
29
  #
30
30
  # @return [Symbol]
@@ -70,4 +70,4 @@ class Metasploit::Credential::Search::Operator::Type < Metasploit::Model::Search
70
70
  def type
71
71
  :string
72
72
  end
73
- end
73
+ end
@@ -1,4 +1,4 @@
1
- class CreateMetasploitCredentialPublics < ActiveRecord::Migration
1
+ class CreateMetasploitCredentialPublics < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :metasploit_credential_publics do |t|
4
4
  #
@@ -1,4 +1,4 @@
1
- class CreateMetasploitCredentialPrivates < ActiveRecord::Migration
1
+ class CreateMetasploitCredentialPrivates < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :metasploit_credential_privates do |t|
4
4
  #
@@ -1,4 +1,4 @@
1
- class CreateMetasploitCredentialRealms < ActiveRecord::Migration
1
+ class CreateMetasploitCredentialRealms < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :metasploit_credential_realms do |t|
4
4
  t.string :key, null: false
@@ -1,4 +1,4 @@
1
- class UniqueMetasploitCredentialRealms < ActiveRecord::Migration
1
+ class UniqueMetasploitCredentialRealms < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  change_table :metasploit_credential_realms do |t|
4
4
  t.index [:key, :value], unique: true
@@ -1,4 +1,4 @@
1
- class CreateMetasploitCredentialOriginManuals < ActiveRecord::Migration
1
+ class CreateMetasploitCredentialOriginManuals < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :metasploit_credential_origin_manuals do |t|
4
4
  #
@@ -1,4 +1,4 @@
1
- class CreateMetasploitCredentialOriginImports < ActiveRecord::Migration
1
+ class CreateMetasploitCredentialOriginImports < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :metasploit_credential_origin_imports do |t|
4
4
  #
@@ -1,4 +1,4 @@
1
- class CreateMetasploitCredentialOriginSessions < ActiveRecord::Migration
1
+ class CreateMetasploitCredentialOriginSessions < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :metasploit_credential_origin_sessions do |t|
4
4
  #
@@ -1,4 +1,4 @@
1
- class CreateMetasploitCredentialOriginServices < ActiveRecord::Migration
1
+ class CreateMetasploitCredentialOriginServices < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :metasploit_credential_origin_services do |t|
4
4
  #
@@ -1,4 +1,4 @@
1
- class CreateMetasploitCredentialCores < ActiveRecord::Migration
1
+ class CreateMetasploitCredentialCores < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :metasploit_credential_cores do |t|
4
4
  #
@@ -1,4 +1,4 @@
1
- class CreateMetasploitCredentialLogins < ActiveRecord::Migration
1
+ class CreateMetasploitCredentialLogins < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :metasploit_credential_logins do |t|
4
4
  #
@@ -1,4 +1,4 @@
1
- class AddLoginsCounterCacheToCores < ActiveRecord::Migration
1
+ class AddLoginsCounterCacheToCores < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  add_column :metasploit_credential_cores, :logins_count, :integer, :default => 0
4
4
 
@@ -1,4 +1,4 @@
1
- class AddJtrFormatToMetasploitCredentialPrivates < ActiveRecord::Migration
1
+ class AddJtrFormatToMetasploitCredentialPrivates < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :metasploit_credential_privates, :jtr_format, :string
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateMetasploitCredentialOriginCrackedPasswords < ActiveRecord::Migration
1
+ class CreateMetasploitCredentialOriginCrackedPasswords < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :metasploit_credential_origin_cracked_passwords do |t|
4
4
 
@@ -1,8 +1,8 @@
1
- class CreateCredentialCoresTasksJoinTable < ActiveRecord::Migration
1
+ class CreateCredentialCoresTasksJoinTable < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :credential_cores_tasks, :force => true, :id => false do |t|
4
4
  t.integer :core_id
5
5
  t.integer :task_id
6
6
  end
7
7
  end
8
- end
8
+ end
@@ -1,4 +1,4 @@
1
- class CreateCredentialLoginsTasksJoinTable < ActiveRecord::Migration
1
+ class CreateCredentialLoginsTasksJoinTable < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :credential_logins_tasks, :force => true, :id => false do |t|
4
4
  t.integer :login_id
@@ -1,6 +1,6 @@
1
1
  # Implements a one-time migration of `Mdm::Cred` objects to
2
2
  # appropriate objects from {Metasploit::Credential}
3
- class OldCredsToNewCreds < ActiveRecord::Migration
3
+ class OldCredsToNewCreds < ActiveRecord::Migration[4.2]
4
4
  def up
5
5
  Metasploit::Credential::Migrator.new.migrate!
6
6
  end
@@ -1,4 +1,4 @@
1
- class UniqueMetasploitCredentialCores < ActiveRecord::Migration
1
+ class UniqueMetasploitCredentialCores < ActiveRecord::Migration[4.2]
2
2
  def down
3
3
  execute 'DROP INDEX unique_complete_metasploit_credential_cores'
4
4
  execute 'DROP INDEX unique_private_metasploit_credential_cores'
@@ -1,4 +1,4 @@
1
- class UniqueMetasploitCredentialCoresWithRealmId < ActiveRecord::Migration
1
+ class UniqueMetasploitCredentialCoresWithRealmId < ActiveRecord::Migration[4.2]
2
2
  #
3
3
  # CONSTANTS
4
4
  #
@@ -1,4 +1,4 @@
1
- class AddTypetoPublic < ActiveRecord::Migration
1
+ class AddTypetoPublic < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  change_table :metasploit_credential_publics do |t|
4
4
  #
@@ -2,7 +2,7 @@
2
2
  # appropriate objects from {Metasploit::Credential}
3
3
  # This second run is due to the refactor of #report_auth_info
4
4
  # that means we should no longer be creating old creds anywhere.
5
- class OldCredsToNewCreds2 < ActiveRecord::Migration
5
+ class OldCredsToNewCreds2 < ActiveRecord::Migration[4.2]
6
6
  def up
7
7
  Metasploit::Credential::Migrator.new.migrate!
8
8
  end
@@ -1,4 +1,4 @@
1
- class RecreateIndexOnPrivateDataAndType < ActiveRecord::Migration
1
+ class RecreateIndexOnPrivateDataAndType < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  remove_index :metasploit_credential_privates, [:type, :data]
4
4
 
@@ -1,4 +1,4 @@
1
- class CreateIndexOnPrivateDataAndTypeForSshKey < ActiveRecord::Migration
1
+ class CreateIndexOnPrivateDataAndTypeForSshKey < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  sql =<<ENDL
4
4
  CREATE UNIQUE INDEX "index_metasploit_credential_privates_on_type_and_data_sshkey" ON
@@ -52,7 +52,7 @@ module Metasploit
52
52
  autoload :Text
53
53
  autoload :Username
54
54
 
55
- # The prefix for all `ActiveRecord::Base#table_name`s for `ActiveRecord::Base` subclasses under this namespace.
55
+ # The prefix for all `ApplicationRecord#table_name`s for `ApplicationRecord` subclasses under this namespace.
56
56
  #
57
57
  # @return [String] `'metasploit_credential_'`
58
58
  def self.table_name_prefix
@@ -25,7 +25,7 @@ module Metasploit::Credential::CoreValidations
25
25
  :public_id
26
26
  ]
27
27
  },
28
- if: '!realm.present? && !public.present? && private.present?'
28
+ if: -> { !realm.present? && !public.present? && private.present? }
29
29
  # replicates 'unique_public_metasploit_credential_cores' index
30
30
  validates :public_id,
31
31
  uniqueness: {
@@ -37,7 +37,7 @@ module Metasploit::Credential::CoreValidations
37
37
  :private_id
38
38
  ]
39
39
  },
40
- if: '!realm.present? && public.present? && !private.present?'
40
+ if: -> { !realm.present? && public.present? && !private.present? }
41
41
  # replicates 'unique_realmless_metasploit_credential_cores' index
42
42
  validates :private_id,
43
43
  uniqueness: {
@@ -49,7 +49,7 @@ module Metasploit::Credential::CoreValidations
49
49
  :public_id
50
50
  ]
51
51
  },
52
- if: '!realm.present? && public.present? && private.present?'
52
+ if: -> { !realm.present? && public.present? && private.present? }
53
53
  # replicates 'unique_publicless_metasploit_credential_cores' index
54
54
  validates :private_id,
55
55
  uniqueness: {
@@ -61,7 +61,7 @@ module Metasploit::Credential::CoreValidations
61
61
  :public_id
62
62
  ]
63
63
  },
64
- if: 'realm.present? && !public.present? && private.present?'
64
+ if: -> { realm.present? && !public.present? && private.present? }
65
65
  # replicates 'unique_privateless_metasploit_credential_cores' index
66
66
  validates :public_id,
67
67
  uniqueness: {
@@ -73,7 +73,7 @@ module Metasploit::Credential::CoreValidations
73
73
  :private_id
74
74
  ]
75
75
  },
76
- if: 'realm.present? && public.present? && !private.present?'
76
+ if: -> { realm.present? && public.present? && !private.present? }
77
77
  # replicates 'unique_complete_metasploit_credential_cores' index
78
78
  validates :private_id,
79
79
  uniqueness: {
@@ -84,7 +84,7 @@ module Metasploit::Credential::CoreValidations
84
84
  :public_id
85
85
  ]
86
86
  },
87
- if: 'realm.present? && public.present? && private.present?'
87
+ if: -> { realm.present? && public.present? && private.present? }
88
88
  validates :workspace,
89
89
  presence: true
90
90
 
@@ -8,7 +8,7 @@ module Metasploit::Credential::Creation
8
8
  # Returns true if ActiveRecord has an active database connection, false otherwise.
9
9
  # @return [Boolean]
10
10
  def active_db?
11
- ActiveRecord::Base.connected?
11
+ ApplicationRecord.connected?
12
12
  end
13
13
 
14
14
  # This method takes a few simple parameters and creates a new username/password
@@ -36,16 +36,16 @@ module Metasploit::Credential::EntityRelationshipDiagram
36
36
  # Class Methods
37
37
  #
38
38
 
39
- # All {cluster clusters} of classes that are reachable through belongs_to from each ActiveRecord::Base descendant
39
+ # All {cluster clusters} of classes that are reachable through belongs_to from each ApplicationRecord descendant
40
40
  #
41
- # @return [Hash{Class<ActiveRecord::Base> => Set<Class<ActiveRecord::Base>>}] Maps entry point to cluster to its
41
+ # @return [Hash{Class<ApplicationRecord> => Set<Class<ApplicationRecord>>}] Maps entry point to cluster to its
42
42
  # cluster.
43
43
  def self.cluster_by_class
44
44
  cluster_by_class = {}
45
45
 
46
46
  Metasploit::Credential::Engine.instance.eager_load!
47
47
 
48
- ActiveRecord::Base.descendants.each do |klass|
48
+ ApplicationRecord.descendants.each do |klass|
49
49
  klass_cluster = cluster(klass)
50
50
  cluster_by_class[klass] = klass_cluster
51
51
  end
@@ -55,9 +55,9 @@ module Metasploit::Credential::EntityRelationshipDiagram
55
55
 
56
56
  # Cluster of classes that are reachable through belongs_to from `classes`.
57
57
  #
58
- # @param classes [Array<Class<ActiveRecord::Base>>] classes that must be in cluster. All other classes in the
58
+ # @param classes [Array<Class<ApplicationRecord>>] classes that must be in cluster. All other classes in the
59
59
  # returned cluster will be classes to which `classes` belong directly or indirectly.
60
- # @return [Set<Class<ActiveRecord::Base>>]
60
+ # @return [Set<Class<ApplicationRecord>>]
61
61
  def self.cluster(*classes)
62
62
  class_queue = classes.dup
63
63
  visited_class_set = Set.new
@@ -122,10 +122,10 @@ module Metasploit::Credential::EntityRelationshipDiagram
122
122
 
123
123
  # Set of largest clusters from {cluster_by_class}.
124
124
  #
125
- # @return [Array<Set<Class<ActiveRecord::Base>>>]
125
+ # @return [Array<Set<Class<ApplicationRecord>>>]
126
126
  def self.maximal_clusters
127
127
  clusters = cluster_by_class.values
128
- unique_clusters = clusters.uniq
128
+ unique_clusters = clusters.distinct
129
129
 
130
130
  maximal_clusters = unique_clusters.dup
131
131
  cluster_queue = unique_clusters.dup
@@ -152,11 +152,11 @@ module Metasploit::Credential::EntityRelationshipDiagram
152
152
 
153
153
  # Calculates the target classes for a polymorphic `belongs_to`.
154
154
  #
155
- # @return [Array<ActiveRecord::Base>]
155
+ # @return [Array<ApplicationRecord>]
156
156
  def self.polymorphic_classes(belongs_to_reflection)
157
157
  name = belongs_to_reflection.name
158
158
 
159
- ActiveRecord::Base.descendants.each_with_object([]) { |descendant, target_classes|
159
+ ApplicationRecord.descendants.each_with_object([]) { |descendant, target_classes|
160
160
  has_many_reflections = descendant.reflect_on_all_associations(:has_many)
161
161
 
162
162
  has_many_reflections.each do |has_many_reflection|
@@ -168,4 +168,4 @@ module Metasploit::Credential::EntityRelationshipDiagram
168
168
  end
169
169
  }
170
170
  end
171
- end
171
+ end
@@ -154,7 +154,7 @@ class Metasploit::Credential::Exporter::Pwdump
154
154
  # @param hash_array [Array<Metasploit::Credential::Login>]
155
155
  # @return [Fixnum]
156
156
  def service_count_for_hashes(hash_array)
157
- hash_array.collect(&:service).collect(&:id).uniq.size
157
+ hash_array.collect(&:service).collect(&:id).distinct.size
158
158
  end
159
159
 
160
160
  private
@@ -8,7 +8,7 @@ module Metasploit::Credential::Origin
8
8
  autoload :Service
9
9
  autoload :Session
10
10
 
11
- # The prefix for table name of `ActiveRecord::Base` subclasses in the namespace.
11
+ # The prefix for table name of `ApplicationRecord` subclasses in the namespace.
12
12
  #
13
13
  # @return [String] `'metasploit_credential_origin_'`
14
14
  def self.table_name_prefix
@@ -3,7 +3,7 @@
3
3
  module Metasploit
4
4
  module Credential
5
5
  # VERSION is managed by GemRelease
6
- VERSION = '3.0.4'
6
+ VERSION = '4.0.0'
7
7
 
8
8
  # @return [String]
9
9
  #
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -55,11 +55,6 @@ module Dummy
55
55
  # like if you have constraints or database-specific column types
56
56
  config.active_record.schema_format = :sql
57
57
 
58
- # Enable the asset pipeline
59
- config.assets.enabled = false
60
-
61
- # Version of your assets, change this if you want to expire all your assets
62
- config.assets.version = '1.0'
63
58
  end
64
59
  end
65
60
 
@@ -1,6 +1,6 @@
1
1
  development: &pgsql
2
2
  adapter: postgresql
3
- database: metasploit-credential_development1
3
+ database: metasploit-credential_development0
4
4
  username: msf
5
5
  password: pass123
6
6
  host: localhost
@@ -10,4 +10,4 @@ development: &pgsql
10
10
  min_messages: warning
11
11
  test:
12
12
  <<: *pgsql
13
- database: metasploit-credential_test1
13
+ database: metasploit-credential_test0
@@ -19,16 +19,6 @@ Rails.application.configure do
19
19
  # Raise an error on page load if there are pending migrations.
20
20
  config.active_record.migration_error = :page_load
21
21
 
22
- # Debug mode disables concatenation and preprocessing of assets.
23
- # This option may cause significant delays in view rendering with a large
24
- # number of complex assets.
25
- config.assets.debug = true
26
-
27
- # Adds additional error checking when serving assets at runtime.
28
- # Checks for improperly declared sprockets dependencies.
29
- # Raises helpful error messages.
30
- config.assets.raise_runtime_errors = true
31
-
32
22
  # Raises error for missing translations
33
23
  # config.action_view.raise_on_missing_translations = true
34
24
  end
@@ -382,7 +382,7 @@ RSpec.describe Metasploit::Credential::Creation do
382
382
  it 'creates a Core' do
383
383
  expect {
384
384
  test_object.create_cracked_credential(
385
- core_id: old_core,
385
+ core_id: old_core.id,
386
386
  username: public.username,
387
387
  password: password
388
388
  )
@@ -113,4 +113,4 @@ RSpec.describe Metasploit::Credential::Importer::Pwdump do
113
113
 
114
114
  end
115
115
 
116
- end
116
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metasploit-credential
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Imhoff
@@ -94,7 +94,7 @@ cert_chain:
94
94
  JI/W23RbIRksG2pioMhd4dCXq3FLLlkOV1YfCwWixNB+iIhQPPZVaPNfgPhCn4Dt
95
95
  DeGjje/qA4fkLtRmOtb9PUBq3ToRDE4=
96
96
  -----END CERTIFICATE-----
97
- date: 2019-12-12 00:00:00.000000000 Z
97
+ date: 2020-02-06 00:00:00.000000000 Z
98
98
  dependencies:
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: metasploit-concern
@@ -320,6 +320,7 @@ files:
320
320
  - spec/dummy/app/assets/stylesheets/application.css
321
321
  - spec/dummy/app/controllers/application_controller.rb
322
322
  - spec/dummy/app/helpers/application_helper.rb
323
+ - spec/dummy/app/models/application_record.rb
323
324
  - spec/dummy/app/views/layouts/application.html.erb
324
325
  - spec/dummy/bin/bundle
325
326
  - spec/dummy/bin/rails
@@ -334,7 +335,6 @@ files:
334
335
  - spec/dummy/config/environments/development.rb
335
336
  - spec/dummy/config/environments/production.rb
336
337
  - spec/dummy/config/environments/test.rb
337
- - spec/dummy/config/initializers/assets.rb
338
338
  - spec/dummy/config/initializers/backtrace_silencers.rb
339
339
  - spec/dummy/config/initializers/cookies_serializer.rb
340
340
  - spec/dummy/config/initializers/filter_parameter_logging.rb
@@ -448,6 +448,7 @@ test_files:
448
448
  - spec/dummy/app/assets/stylesheets/application.css
449
449
  - spec/dummy/app/controllers/application_controller.rb
450
450
  - spec/dummy/app/helpers/application_helper.rb
451
+ - spec/dummy/app/models/application_record.rb
451
452
  - spec/dummy/app/views/layouts/application.html.erb
452
453
  - spec/dummy/bin/bundle
453
454
  - spec/dummy/bin/rails
@@ -462,7 +463,6 @@ test_files:
462
463
  - spec/dummy/config/environments/development.rb
463
464
  - spec/dummy/config/environments/production.rb
464
465
  - spec/dummy/config/environments/test.rb
465
- - spec/dummy/config/initializers/assets.rb
466
466
  - spec/dummy/config/initializers/backtrace_silencers.rb
467
467
  - spec/dummy/config/initializers/cookies_serializer.rb
468
468
  - spec/dummy/config/initializers/filter_parameter_logging.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Version of your assets, change this if you want to expire all your assets.
4
- Rails.application.config.assets.version = '1.0'
5
-
6
- # Precompile additional assets.
7
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
8
- # Rails.application.config.assets.precompile += %w( search.js )