metasploit-credential 6.0.20 → 6.0.21
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8812bdc403724cf3a31080fa3de9e8c2ff95a1d8b792c29c047d1ba693c40286
|
|
4
|
+
data.tar.gz: 203337f164044196d492582a5d99b498d31a5afc0b17b6eb72fa5c55c48b3e52
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a47718c56eef2fbfff45374bd73cb1f83026476c9a6aa77178aedfa05ee3cfe0c78d05e39cbc619d6f25bf33d845f07b39d4ce15f6e60c56268f26a48c9a8c3c
|
|
7
|
+
data.tar.gz: c7c22d92745f28b54226f47f11c91dcfdb2a893698228b3e96620cf324d514e2a38d26ddbba620148ecb6135511a55f252ca3ee06f124bd7ff5e1b2a3ad25671
|
|
@@ -413,6 +413,8 @@ module Metasploit::Credential::Creation
|
|
|
413
413
|
# If there is not a matching `Mdm::Host` it will create it. If there is not a matching
|
|
414
414
|
# `Mdm::Service` it will create that too.
|
|
415
415
|
#
|
|
416
|
+
# @option opts [Mdm::Service] :service The service to use instead of creating one
|
|
417
|
+
# @option opts [Fixnum] :service_id The ID of the `Mdm::Service` to link this Origin to
|
|
416
418
|
# @option opts [String] :address The address of the `Mdm::Host` to link this Origin to
|
|
417
419
|
# @option opts [Fixnum] :port The port number of the `Mdm::Service` to link this Origin to
|
|
418
420
|
# @option opts [String] :service_name The service name to use for the `Mdm::Service`
|
|
@@ -423,8 +425,13 @@ module Metasploit::Credential::Creation
|
|
|
423
425
|
# @return [Metasploit::Credential::Origin::Service] The created {Metasploit::Credential::Origin::Service} object
|
|
424
426
|
def create_credential_origin_service(opts={})
|
|
425
427
|
return nil unless active_db?
|
|
428
|
+
|
|
426
429
|
module_fullname = opts.fetch(:module_fullname)
|
|
427
|
-
|
|
430
|
+
if (service_id = opts[:service_id] || opts[:service].try(:id))
|
|
431
|
+
service_object = Mdm::Service.where(id: service_id).first
|
|
432
|
+
else
|
|
433
|
+
service_object = create_credential_service(opts)
|
|
434
|
+
end
|
|
428
435
|
return nil if service_object.nil?
|
|
429
436
|
|
|
430
437
|
retry_transaction do
|
|
@@ -652,6 +652,49 @@ RSpec.describe Metasploit::Credential::Creation do
|
|
|
652
652
|
expect{ test_object.create_credential_origin_service(opts)}.to raise_error KeyError
|
|
653
653
|
end
|
|
654
654
|
end
|
|
655
|
+
|
|
656
|
+
context 'when :service is provided' do
|
|
657
|
+
it 'uses the given service object and does not create a new Mdm::Service' do
|
|
658
|
+
host = FactoryBot.create(:mdm_host, workspace: workspace)
|
|
659
|
+
existing_service = FactoryBot.create(:mdm_service, host: host)
|
|
660
|
+
opts = {
|
|
661
|
+
service: existing_service,
|
|
662
|
+
module_fullname: 'auxiliary/scanner/smb/smb_login',
|
|
663
|
+
origin_type: :service
|
|
664
|
+
}
|
|
665
|
+
expect { test_object.create_credential_origin_service(opts) }.to_not change { Mdm::Service.count }
|
|
666
|
+
origin = test_object.create_credential_origin_service(opts)
|
|
667
|
+
expect(origin.service_id).to eq(existing_service.id)
|
|
668
|
+
end
|
|
669
|
+
end
|
|
670
|
+
|
|
671
|
+
context 'when :service_id is provided' do
|
|
672
|
+
context 'and the ID corresponds to an existing Mdm::Service' do
|
|
673
|
+
it 'uses that service and does not create a new Mdm::Service' do
|
|
674
|
+
host = FactoryBot.create(:mdm_host, workspace: workspace)
|
|
675
|
+
existing_service = FactoryBot.create(:mdm_service, host: host)
|
|
676
|
+
opts = {
|
|
677
|
+
service_id: existing_service.id,
|
|
678
|
+
module_fullname: 'auxiliary/scanner/smb/smb_login',
|
|
679
|
+
origin_type: :service
|
|
680
|
+
}
|
|
681
|
+
expect { test_object.create_credential_origin_service(opts) }.to_not change { Mdm::Service.count }
|
|
682
|
+
origin = test_object.create_credential_origin_service(opts)
|
|
683
|
+
expect(origin.service_id).to eq(existing_service.id)
|
|
684
|
+
end
|
|
685
|
+
end
|
|
686
|
+
|
|
687
|
+
context 'and the ID does not correspond to an existing Mdm::Service' do
|
|
688
|
+
it 'returns nil' do
|
|
689
|
+
opts = {
|
|
690
|
+
service_id: 0,
|
|
691
|
+
module_fullname: 'auxiliary/scanner/smb/smb_login',
|
|
692
|
+
origin_type: :service
|
|
693
|
+
}
|
|
694
|
+
expect(test_object.create_credential_origin_service(opts)).to be_nil
|
|
695
|
+
end
|
|
696
|
+
end
|
|
697
|
+
end
|
|
655
698
|
end
|
|
656
699
|
|
|
657
700
|
context '#create_credential_origin_session' do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metasploit-credential
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.
|
|
4
|
+
version: 6.0.21
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Metasploit Hackers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-04-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: metasploit-concern
|