metasploit-credential 3.0.4 → 4.0.4
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +2 -2
- data/app/concerns/mdm/task/metasploit_credential_core.rb +2 -2
- data/app/concerns/mdm/task/metasploit_credential_login.rb +2 -2
- data/app/models/metasploit/credential/core.rb +5 -5
- data/app/models/metasploit/credential/login.rb +2 -2
- data/app/models/metasploit/credential/origin/cracked_password.rb +1 -1
- data/app/models/metasploit/credential/origin/import.rb +1 -1
- data/app/models/metasploit/credential/origin/manual.rb +1 -1
- data/app/models/metasploit/credential/origin/service.rb +1 -1
- data/app/models/metasploit/credential/origin/session.rb +1 -1
- data/app/models/metasploit/credential/private.rb +1 -1
- data/app/models/metasploit/credential/public.rb +1 -1
- data/app/models/metasploit/credential/realm.rb +1 -1
- data/app/models/metasploit/credential/search/operator/type.rb +2 -2
- data/db/migrate/20140331173835_create_metasploit_credential_publics.rb +1 -1
- data/db/migrate/20140407212345_create_metasploit_credential_privates.rb +1 -1
- data/db/migrate/20140410132401_create_metasploit_credential_realms.rb +1 -1
- data/db/migrate/20140410161611_unique_metasploit_credential_realms.rb +1 -1
- data/db/migrate/20140410191213_create_metasploit_credential_origin_manuals.rb +1 -1
- data/db/migrate/20140410205410_create_metasploit_credential_origin_imports.rb +1 -1
- data/db/migrate/20140411142102_create_metasploit_credential_origin_sessions.rb +1 -1
- data/db/migrate/20140411205325_create_metasploit_credential_origin_services.rb +1 -1
- data/db/migrate/20140414192550_create_metasploit_credential_cores.rb +1 -1
- data/db/migrate/20140417140933_create_metasploit_credential_logins.rb +1 -1
- data/db/migrate/20140520140817_add_logins_counter_cache_to_cores.rb +1 -1
- data/db/migrate/20140603163708_add_jtr_format_to_metasploit_credential_privates.rb +1 -1
- data/db/migrate/20140605173747_create_metasploit_credential_origin_cracked_passwords.rb +1 -1
- data/db/migrate/20140702184622_create_credential_cores_tasks_join_table.rb +2 -2
- data/db/migrate/20140703144541_create_credential_logins_tasks_join_table.rb +1 -1
- data/db/migrate/20140722174919_old_creds_to_new_creds.rb +1 -1
- data/db/migrate/20140728191933_unique_metasploit_credential_cores.rb +1 -1
- data/db/migrate/20140801150537_unique_metasploit_credential_cores_with_realm_id.rb +1 -1
- data/db/migrate/20140922170030_add_typeto_public.rb +1 -1
- data/db/migrate/20150106201450_old_creds_to_new_creds2.rb +1 -1
- data/db/migrate/20161107153145_recreate_index_on_private_data_and_type.rb +1 -1
- data/db/migrate/20161107203710_create_index_on_private_data_and_type_for_ssh_key.rb +1 -1
- data/lib/metasploit/credential.rb +1 -1
- data/lib/metasploit/credential/core_validations.rb +6 -6
- data/lib/metasploit/credential/creation.rb +1 -1
- data/lib/metasploit/credential/entity_relationship_diagram.rb +9 -9
- data/lib/metasploit/credential/origin.rb +1 -1
- data/lib/metasploit/credential/version.rb +1 -1
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/config/application.rb +0 -5
- data/spec/dummy/config/database.yml +2 -2
- data/spec/dummy/config/{database.yml.travis → database.yml.github_actions} +4 -5
- data/spec/dummy/config/environments/development.rb +0 -10
- data/spec/lib/metasploit/credential/creation_spec.rb +5 -13
- data/spec/lib/metasploit/credential/exporter/core_spec.rb +2 -2
- data/spec/lib/metasploit/credential/importer/pwdump_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -7
- metadata +25 -27
- metadata.gz.sig +0 -0
- data/spec/dummy/config/initializers/assets.rb +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0d4080e5da11b26f677a0d65ca483889673a59882e6be864a8a74a51134d2680
|
|
4
|
+
data.tar.gz: 3f6c968807a54a0d393c58f61be6e330763c39b21a1744b9bf82844761a48d7d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c44e6959b9863e7a165a5935a8ee97351966d26ef511b1aaa83c7f268d0887bef43a3319a272461383e6c6f816ca67bd9a472d55cb996b5d8cffe82f3d46ffff
|
|
7
|
+
data.tar.gz: 7b72b4e1e7924bc771eba24c31eb4c260882ea255ec371355f7359484697d01e86ca719033cfb3554ad30b6a135f53b6954ccd627ffb30befc6b27e87bbf7fac
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Metasploit::Credential [](https://github.com/rapid7/metasploit-credential/actions/workflows/verify.yml)[](https://codeclimate.com/github/rapid7/metasploit-credential)[](https://gemnasium.com/rapid7/metasploit-credential)[](http://badge.fury.io/rb/metasploit-credential)[](http://inch-ci.org/github/rapid7/metasploit-credential)[](https://www.pullreview.com/github/rapid7/metasploit-credential/reviews/master)
|
|
2
2
|
|
|
3
3
|
## Versioning
|
|
4
4
|
|
|
@@ -98,7 +98,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
|
98
98
|
### Dependencies
|
|
99
99
|
|
|
100
100
|
Remove your `Gemfile.lock` so you test with the latest compatible dependencies as will be done on
|
|
101
|
-
[
|
|
101
|
+
[github actions](https://github.com/rapid7/metasploit-credential/actions/workflows/verify.yml)
|
|
102
102
|
|
|
103
103
|
rm Gemfile.lock
|
|
104
104
|
bundle install
|
|
@@ -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
|
-
-> {
|
|
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
|
-
-> {
|
|
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 <
|
|
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
|
-
-> {
|
|
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 [
|
|
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|
|
|
@@ -276,8 +276,8 @@ class Metasploit::Credential::Core < ActiveRecord::Base
|
|
|
276
276
|
# @param host_id [Integer]
|
|
277
277
|
# @return [String]
|
|
278
278
|
def self.cores_from_host(host_id)
|
|
279
|
-
left = origin_service_host_id(host_id).ast
|
|
280
|
-
right = origin_session_host_id(host_id).ast
|
|
279
|
+
left = origin_service_host_id(host_id).arel.ast
|
|
280
|
+
right = origin_session_host_id(host_id).arel.ast
|
|
281
281
|
|
|
282
282
|
Arel::Nodes::UnionAll.new(
|
|
283
283
|
left,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# The use of a {#core core credential} against a {#service service}.
|
|
2
|
-
class Metasploit::Credential::Login <
|
|
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
|
-
-> {
|
|
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 <
|
|
2
|
+
class Metasploit::Credential::Origin::CrackedPassword < ApplicationRecord
|
|
3
3
|
|
|
4
4
|
#
|
|
5
5
|
# Associations
|
|
@@ -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 <
|
|
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 <
|
|
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 <
|
|
5
|
+
class Metasploit::Credential::Private < ApplicationRecord
|
|
6
6
|
include Metasploit::Model::Search
|
|
7
7
|
|
|
8
8
|
#
|
|
@@ -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 <
|
|
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 `
|
|
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,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,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'
|
|
@@ -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
|
|
@@ -52,7 +52,7 @@ module Metasploit
|
|
|
52
52
|
autoload :Text
|
|
53
53
|
autoload :Username
|
|
54
54
|
|
|
55
|
-
# The prefix for all `
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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
|
|
39
|
+
# All {cluster clusters} of classes that are reachable through belongs_to from each ApplicationRecord descendant
|
|
40
40
|
#
|
|
41
|
-
# @return [Hash{Class<
|
|
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
|
-
|
|
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<
|
|
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<
|
|
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,7 +122,7 @@ module Metasploit::Credential::EntityRelationshipDiagram
|
|
|
122
122
|
|
|
123
123
|
# Set of largest clusters from {cluster_by_class}.
|
|
124
124
|
#
|
|
125
|
-
# @return [Array<Set<Class<
|
|
125
|
+
# @return [Array<Set<Class<ApplicationRecord>>>]
|
|
126
126
|
def self.maximal_clusters
|
|
127
127
|
clusters = cluster_by_class.values
|
|
128
128
|
unique_clusters = clusters.uniq
|
|
@@ -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<
|
|
155
|
+
# @return [Array<ApplicationRecord>]
|
|
156
156
|
def self.polymorphic_classes(belongs_to_reflection)
|
|
157
157
|
name = belongs_to_reflection.name
|
|
158
158
|
|
|
159
|
-
|
|
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
|
|
@@ -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 `
|
|
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
|
|
@@ -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-
|
|
3
|
+
database: metasploit-credential_development3
|
|
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-
|
|
13
|
+
database: metasploit-credential_test3
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
# @note This file is only for use in
|
|
1
|
+
# @note This file is only for use in github actions. If you need to make a `spec/dummy/config/database.yml` for running
|
|
2
2
|
# rake, rake spec, or rspec locally, please customize `spec/dummy/config/database.yml.example`.
|
|
3
3
|
#
|
|
4
4
|
# @example Customizing config/database.yml.example
|
|
5
5
|
# cp spec/dummy/config/database.yml.example spec/dummy/config/database.yml
|
|
6
6
|
# # update password fields for each environment's user
|
|
7
7
|
|
|
8
|
-
# Using the postgres user locally without a host and port is the supported configuration from Travis-CI
|
|
9
|
-
#
|
|
10
|
-
# @see http://about.travis-ci.org/docs/user/database-setup/#PostgreSQL
|
|
11
8
|
development: &pgsql
|
|
12
9
|
adapter: postgresql
|
|
13
10
|
database: metasploit_credential_development
|
|
11
|
+
host: localhost
|
|
14
12
|
username: postgres
|
|
13
|
+
password: postgres
|
|
15
14
|
pool: 5
|
|
16
15
|
timeout: 5
|
|
17
16
|
|
|
@@ -19,4 +18,4 @@ development: &pgsql
|
|
|
19
18
|
# `rake`. Do not set this db to the same as development or production.
|
|
20
19
|
test:
|
|
21
20
|
<<: *pgsql
|
|
22
|
-
database: metasploit_credential_test
|
|
21
|
+
database: metasploit_credential_test
|
|
@@ -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
|
|
@@ -55,8 +55,7 @@ RSpec.describe Metasploit::Credential::Creation do
|
|
|
55
55
|
origin_type: origin_type,
|
|
56
56
|
username: 'admin',
|
|
57
57
|
private_data: 'password',
|
|
58
|
-
private_type: :password
|
|
59
|
-
workspace_id: workspace.id
|
|
58
|
+
private_type: :password
|
|
60
59
|
}.merge(origin_data[origin_type])}
|
|
61
60
|
it 'creates a credential core' do
|
|
62
61
|
expect{ test_object.create_credential(credential_data) }.to change{ Metasploit::Credential::Core.count }.by(1)
|
|
@@ -89,8 +88,7 @@ RSpec.describe Metasploit::Credential::Creation do
|
|
|
89
88
|
origin_type: :manual,
|
|
90
89
|
username: 'admin',
|
|
91
90
|
private_data: 'password',
|
|
92
|
-
private_type: :password
|
|
93
|
-
workspace_id: workspace.id
|
|
91
|
+
private_type: :password
|
|
94
92
|
}}
|
|
95
93
|
it 'creates a credential core' do
|
|
96
94
|
expect{ test_object.create_credential(credential_data) }.to change{ Metasploit::Credential::Core.count }.by(1)
|
|
@@ -117,8 +115,7 @@ RSpec.describe Metasploit::Credential::Creation do
|
|
|
117
115
|
origin_type: :manual,
|
|
118
116
|
username: public_value,
|
|
119
117
|
private_data: 'password',
|
|
120
|
-
private_type: :password
|
|
121
|
-
workspace_id: workspace.id
|
|
118
|
+
private_type: :password
|
|
122
119
|
}}
|
|
123
120
|
it 'creates a credential core' do
|
|
124
121
|
expect{ test_object.create_credential(credential_data) }.to change{ Metasploit::Credential::Core.count }.by(1)
|
|
@@ -158,8 +155,7 @@ RSpec.describe Metasploit::Credential::Creation do
|
|
|
158
155
|
origin_type: :manual,
|
|
159
156
|
username: 'admin',
|
|
160
157
|
private_data: private_data[private_type],
|
|
161
|
-
private_type: private_type
|
|
162
|
-
workspace_id: workspace.id
|
|
158
|
+
private_type: private_type
|
|
163
159
|
}}
|
|
164
160
|
it 'creates a credential core' do
|
|
165
161
|
expect{ test_object.create_credential(credential_data) }.to change{ Metasploit::Credential::Core.count }.by(1)
|
|
@@ -213,7 +209,6 @@ RSpec.describe Metasploit::Credential::Creation do
|
|
|
213
209
|
username: 'admin',
|
|
214
210
|
private_data: 'password',
|
|
215
211
|
private_type: :password,
|
|
216
|
-
workspace_id: workspace.id,
|
|
217
212
|
address: service.host.address,
|
|
218
213
|
port: service.port,
|
|
219
214
|
service_name: service.name,
|
|
@@ -256,7 +251,6 @@ RSpec.describe Metasploit::Credential::Creation do
|
|
|
256
251
|
username: 'admin',
|
|
257
252
|
private_data: 'password',
|
|
258
253
|
private_type: :password,
|
|
259
|
-
workspace_id: workspace.id,
|
|
260
254
|
address: service.host.address,
|
|
261
255
|
port: service.port,
|
|
262
256
|
service_name: service.name,
|
|
@@ -294,7 +288,6 @@ RSpec.describe Metasploit::Credential::Creation do
|
|
|
294
288
|
username: public_value,
|
|
295
289
|
private_data: 'password',
|
|
296
290
|
private_type: :password,
|
|
297
|
-
workspace_id: workspace.id,
|
|
298
291
|
address: service.host.address,
|
|
299
292
|
port: service.port,
|
|
300
293
|
service_name: service.name,
|
|
@@ -344,7 +337,6 @@ RSpec.describe Metasploit::Credential::Creation do
|
|
|
344
337
|
username: 'admin',
|
|
345
338
|
private_data: private_data[private_type],
|
|
346
339
|
private_type: private_type,
|
|
347
|
-
workspace_id: workspace.id,
|
|
348
340
|
address: service.host.address,
|
|
349
341
|
port: service.port,
|
|
350
342
|
service_name: service.name,
|
|
@@ -382,7 +374,7 @@ RSpec.describe Metasploit::Credential::Creation do
|
|
|
382
374
|
it 'creates a Core' do
|
|
383
375
|
expect {
|
|
384
376
|
test_object.create_cracked_credential(
|
|
385
|
-
core_id: old_core,
|
|
377
|
+
core_id: old_core.id,
|
|
386
378
|
username: public.username,
|
|
387
379
|
password: password
|
|
388
380
|
)
|
|
@@ -29,7 +29,7 @@ RSpec.describe Metasploit::Credential::Exporter::Core do
|
|
|
29
29
|
describe "#export!" do
|
|
30
30
|
it 'should create the zipfile' do
|
|
31
31
|
core_exporter.export!
|
|
32
|
-
expect(File.
|
|
32
|
+
expect(File.exist?(core_exporter.output_zipfile_path)).to eq(true)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
it 'should output to a directory whose name contains the standardized identifier' do
|
|
@@ -452,4 +452,4 @@ RSpec.describe Metasploit::Credential::Exporter::Core do
|
|
|
452
452
|
end
|
|
453
453
|
end
|
|
454
454
|
end
|
|
455
|
-
end
|
|
455
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -9,14 +9,8 @@ Bundler.setup(:default, :test)
|
|
|
9
9
|
# Require simplecov before loading ..dummy/config/environment.rb because it will cause metasploit-credential/lib to
|
|
10
10
|
# be loaded, which would result in Coverage not recording hits for any of the files.
|
|
11
11
|
require 'simplecov'
|
|
12
|
-
require 'coveralls'
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
# don't generate local report as it is inaccessible on travis-ci, which is why coveralls is being used.
|
|
16
|
-
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
|
17
|
-
else
|
|
18
|
-
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
|
|
19
|
-
end
|
|
13
|
+
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
|
|
20
14
|
|
|
21
15
|
require File.expand_path("../dummy/config/environment", __FILE__)
|
|
22
16
|
require 'rspec/rails'
|
metadata
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metasploit-credential
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
8
|
-
- Trevor Rosen
|
|
7
|
+
- Metasploit Hackers
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain:
|
|
@@ -65,20 +64,20 @@ cert_chain:
|
|
|
65
64
|
-----END CERTIFICATE-----
|
|
66
65
|
- |
|
|
67
66
|
-----BEGIN CERTIFICATE-----
|
|
68
|
-
|
|
67
|
+
MIIFIzCCBAugAwIBAgIQCMePMbkSxvnPeJhYXIfaxzANBgkqhkiG9w0BAQsFADBy
|
|
69
68
|
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
|
70
69
|
d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQg
|
|
71
|
-
|
|
70
|
+
SUQgQ29kZSBTaWduaW5nIENBMB4XDTIwMTAwNzAwMDAwMFoXDTIzMTEwNjEyMDAw
|
|
72
71
|
MFowYDELMAkGA1UEBhMCVVMxFjAUBgNVBAgTDU1hc3NhY2h1c2V0dHMxDzANBgNV
|
|
73
72
|
BAcTBkJvc3RvbjETMBEGA1UEChMKUmFwaWQ3IExMQzETMBEGA1UEAxMKUmFwaWQ3
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
IExMQzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALNTz4zvAy7h/vQp
|
|
74
|
+
4dr1txXHlABAagkwYYwTMCtHs5PXsJITx/5SAjx5swuaLfze5kPBNF2YImvFlOXY
|
|
75
|
+
WaB+0PsOnXnaARsDZU683xFlj8izU6IN6VrAHzDLKFBzruJENrOJD/ikbEtbjO/q
|
|
76
|
+
gFbmS9J9v5ohG/pcRSS0t4ZPAwymf8eCp6QsvOKK/Aymp1RhlRaP8N6N5CIpkhz1
|
|
77
|
+
9p968iCE+DjOXVYxcWE+jE/7uB1dbgrXykNBujMSS3GULOvVEY28n6NCmrPlo23g
|
|
78
|
+
yRjYVJ2Vy14nBqnxDZ/yRIfWRVjWoT9TsAEbe9gY29oDpSCSs4wSmLQd5zGCpZ9h
|
|
79
|
+
r0HDFB8CAwEAAaOCAcUwggHBMB8GA1UdIwQYMBaAFFrEuXsqCqOl6nEDwGD5LfZl
|
|
80
|
+
dQ5YMB0GA1UdDgQWBBTLBL7DTwumVEKtdCdpHVYMXOFeDzAOBgNVHQ8BAf8EBAMC
|
|
82
81
|
B4AwEwYDVR0lBAwwCgYIKwYBBQUHAwMwdwYDVR0fBHAwbjA1oDOgMYYvaHR0cDov
|
|
83
82
|
L2NybDMuZGlnaWNlcnQuY29tL3NoYTItYXNzdXJlZC1jcy1nMS5jcmwwNaAzoDGG
|
|
84
83
|
L2h0dHA6Ly9jcmw0LmRpZ2ljZXJ0LmNvbS9zaGEyLWFzc3VyZWQtY3MtZzEuY3Js
|
|
@@ -87,14 +86,14 @@ cert_chain:
|
|
|
87
86
|
JAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmRpZ2ljZXJ0LmNvbTBOBggrBgEFBQcw
|
|
88
87
|
AoZCaHR0cDovL2NhY2VydHMuZGlnaWNlcnQuY29tL0RpZ2lDZXJ0U0hBMkFzc3Vy
|
|
89
88
|
ZWRJRENvZGVTaWduaW5nQ0EuY3J0MAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQEL
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
BQADggEBAN+GL5/myPWg7oH4mVrG7/OhXF1MoYQF0ddaNiqaweEHMuKJBQCVZRbL
|
|
90
|
+
37HojoKXXv2yyRJBCeTB+ojrxX+5PdLVZa0ss7toWzJ2A1poPXZ1eZvm5xeFD32z
|
|
91
|
+
YQaTmmNWNI3PCDTyJ2PXUc+bDiNNwcZ7yc5o78UNRvp9Jxghya17Q76c9Ov9wvnv
|
|
92
|
+
dxxQKWGOQy0m4fBrkyjAyH9Djjn81RbQrqYgPuhd5nD0HjN3VUQLhQbIJrk9TVs0
|
|
93
|
+
EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
|
|
94
|
+
9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
|
|
96
95
|
-----END CERTIFICATE-----
|
|
97
|
-
date:
|
|
96
|
+
date: 2021-04-28 00:00:00.000000000 Z
|
|
98
97
|
dependencies:
|
|
99
98
|
- !ruby/object:Gem::Dependency
|
|
100
99
|
name: metasploit-concern
|
|
@@ -224,8 +223,7 @@ dependencies:
|
|
|
224
223
|
version: '0'
|
|
225
224
|
description: The Metasploit::Credential namespace and its ActiveRecord::Base subclasses
|
|
226
225
|
email:
|
|
227
|
-
-
|
|
228
|
-
- trevor_rosen@rapid7.com
|
|
226
|
+
- msfdev@metasploit.com
|
|
229
227
|
executables: []
|
|
230
228
|
extensions: []
|
|
231
229
|
extra_rdoc_files: []
|
|
@@ -320,6 +318,7 @@ files:
|
|
|
320
318
|
- spec/dummy/app/assets/stylesheets/application.css
|
|
321
319
|
- spec/dummy/app/controllers/application_controller.rb
|
|
322
320
|
- spec/dummy/app/helpers/application_helper.rb
|
|
321
|
+
- spec/dummy/app/models/application_record.rb
|
|
323
322
|
- spec/dummy/app/views/layouts/application.html.erb
|
|
324
323
|
- spec/dummy/bin/bundle
|
|
325
324
|
- spec/dummy/bin/rails
|
|
@@ -329,12 +328,11 @@ files:
|
|
|
329
328
|
- spec/dummy/config/boot.rb
|
|
330
329
|
- spec/dummy/config/database.yml
|
|
331
330
|
- spec/dummy/config/database.yml.example
|
|
332
|
-
- spec/dummy/config/database.yml.
|
|
331
|
+
- spec/dummy/config/database.yml.github_actions
|
|
333
332
|
- spec/dummy/config/environment.rb
|
|
334
333
|
- spec/dummy/config/environments/development.rb
|
|
335
334
|
- spec/dummy/config/environments/production.rb
|
|
336
335
|
- spec/dummy/config/environments/test.rb
|
|
337
|
-
- spec/dummy/config/initializers/assets.rb
|
|
338
336
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
|
339
337
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
|
340
338
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
|
@@ -429,7 +427,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
429
427
|
requirements:
|
|
430
428
|
- - ">="
|
|
431
429
|
- !ruby/object:Gem::Version
|
|
432
|
-
version: 2.
|
|
430
|
+
version: 2.4.0
|
|
433
431
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
434
432
|
requirements:
|
|
435
433
|
- - ">="
|
|
@@ -448,6 +446,7 @@ test_files:
|
|
|
448
446
|
- spec/dummy/app/assets/stylesheets/application.css
|
|
449
447
|
- spec/dummy/app/controllers/application_controller.rb
|
|
450
448
|
- spec/dummy/app/helpers/application_helper.rb
|
|
449
|
+
- spec/dummy/app/models/application_record.rb
|
|
451
450
|
- spec/dummy/app/views/layouts/application.html.erb
|
|
452
451
|
- spec/dummy/bin/bundle
|
|
453
452
|
- spec/dummy/bin/rails
|
|
@@ -457,12 +456,11 @@ test_files:
|
|
|
457
456
|
- spec/dummy/config/boot.rb
|
|
458
457
|
- spec/dummy/config/database.yml
|
|
459
458
|
- spec/dummy/config/database.yml.example
|
|
460
|
-
- spec/dummy/config/database.yml.
|
|
459
|
+
- spec/dummy/config/database.yml.github_actions
|
|
461
460
|
- spec/dummy/config/environment.rb
|
|
462
461
|
- spec/dummy/config/environments/development.rb
|
|
463
462
|
- spec/dummy/config/environments/production.rb
|
|
464
463
|
- spec/dummy/config/environments/test.rb
|
|
465
|
-
- spec/dummy/config/initializers/assets.rb
|
|
466
464
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
|
467
465
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
|
468
466
|
- 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 )
|