metasploit-credential 0.14.5 → 0.14.6
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
 - data/lib/metasploit/credential/exporter/core.rb +2 -2
 - data/lib/metasploit/credential/exporter/pwdump.rb +2 -2
 - data/lib/metasploit/credential/migrator.rb +1 -1
 - data/lib/metasploit/credential/version.rb +1 -3
 - data/spec/dummy/config/database.yml +13 -11
 - data/spec/dummy/db/structure.sql +1 -0
 - data/spec/lib/metasploit/credential/creation_spec.rb +6 -8
 - data/spec/lib/metasploit/credential/exporter/core_spec.rb +100 -85
 - data/spec/lib/metasploit/credential/exporter/pwdump_spec.rb +14 -16
 - data/spec/lib/metasploit/credential/importer/core_spec.rb +10 -12
 - data/spec/lib/metasploit/credential/importer/multi_spec.rb +4 -6
 - data/spec/lib/metasploit/credential/importer/pwdump_spec.rb +11 -13
 - data/spec/lib/metasploit/credential/importer/zip_spec.rb +5 -7
 - data/spec/lib/metasploit/credential/migrator_spec.rb +13 -13
 - data/spec/lib/metasploit/credential/version_spec.rb +3 -5
 - data/spec/lib/metasploit/credential_spec.rb +1 -3
 - data/spec/models/mdm/service_spec.rb +3 -5
 - data/spec/models/mdm/session_spec.rb +2 -4
 - data/spec/models/mdm/task_spec.rb +4 -6
 - data/spec/models/mdm/user_spec.rb +2 -4
 - data/spec/models/mdm/workspace_spec.rb +2 -4
 - data/spec/models/metasploit/credential/blank_username_spec.rb +5 -7
 - data/spec/models/metasploit/credential/core_spec.rb +43 -45
 - data/spec/models/metasploit/credential/login/status_spec.rb +19 -21
 - data/spec/models/metasploit/credential/login_spec.rb +36 -38
 - data/spec/models/metasploit/credential/nonreplayable_hash_spec.rb +3 -5
 - data/spec/models/metasploit/credential/ntlm_hash_spec.rb +13 -15
 - data/spec/models/metasploit/credential/origin/cracked_password_spec.rb +5 -7
 - data/spec/models/metasploit/credential/origin/import_spec.rb +8 -10
 - data/spec/models/metasploit/credential/origin/manual_spec.rb +7 -9
 - data/spec/models/metasploit/credential/origin/service_spec.rb +10 -12
 - data/spec/models/metasploit/credential/origin/session_spec.rb +11 -13
 - data/spec/models/metasploit/credential/password_hash_spec.rb +4 -6
 - data/spec/models/metasploit/credential/password_spec.rb +3 -5
 - data/spec/models/metasploit/credential/postgres_md5_spec.rb +4 -6
 - data/spec/models/metasploit/credential/private_spec.rb +8 -10
 - data/spec/models/metasploit/credential/public_spec.rb +5 -7
 - data/spec/models/metasploit/credential/realm_spec.rb +14 -16
 - data/spec/models/metasploit/credential/replayable_hash_spec.rb +3 -5
 - data/spec/models/metasploit/credential/ssh_key_spec.rb +15 -17
 - data/spec/models/metasploit/credential/username_spec.rb +6 -8
 - data/spec/models/metasploit_data_models/search/visitor/relation_spec.rb +1 -3
 - data/spec/spec_helper.rb +83 -18
 - data/spec/support/shared/contexts/mdm/workspace.rb +1 -1
 - data/spec/support/shared/examples/core_validations.rb +117 -42
 - data/spec/support/shared/examples/single_table_inheritance_database_columns.rb +2 -2
 - data/spec/support/shared/examples/timestamp_database_column.rb +2 -2
 - metadata +9 -9
 
| 
         @@ -1,30 +1,28 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            describe Metasploit::Credential::Username do
         
     | 
| 
      
 1 
     | 
    
         
            +
            RSpec.describe Metasploit::Credential::Username, type: :model do
         
     | 
| 
       4 
2 
     | 
    
         
             
              it_should_behave_like 'Metasploit::Concern.run'
         
     | 
| 
       5 
3 
     | 
    
         | 
| 
       6 
4 
     | 
    
         
             
              context 'database' do
         
     | 
| 
       7 
5 
     | 
    
         
             
                context 'columns' do
         
     | 
| 
       8 
6 
     | 
    
         
             
                  it_should_behave_like 'timestamp database columns'
         
     | 
| 
       9 
7 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
                  it {  
     | 
| 
      
 8 
     | 
    
         
            +
                  it { is_expected.to have_db_column(:username).of_type(:string).with_options(null: false) }
         
     | 
| 
       11 
9 
     | 
    
         
             
                end
         
     | 
| 
       12 
10 
     | 
    
         | 
| 
       13 
11 
     | 
    
         
             
                context 'indices' do
         
     | 
| 
       14 
     | 
    
         
            -
                  it {  
     | 
| 
      
 12 
     | 
    
         
            +
                  it { is_expected.to have_db_index(:username).unique(true) }
         
     | 
| 
       15 
13 
     | 
    
         
             
                end
         
     | 
| 
       16 
14 
     | 
    
         
             
              end
         
     | 
| 
       17 
15 
     | 
    
         | 
| 
       18 
16 
     | 
    
         
             
              context 'mass assignment security' do
         
     | 
| 
       19 
17 
     | 
    
         
             
                it { should_not allow_mass_assignment_of(:created_at) }
         
     | 
| 
       20 
18 
     | 
    
         
             
                it { should_not allow_mass_assignment_of(:updated_at) }
         
     | 
| 
       21 
     | 
    
         
            -
                it {  
     | 
| 
      
 19 
     | 
    
         
            +
                it { is_expected.to allow_mass_assignment_of(:username) }
         
     | 
| 
       22 
20 
     | 
    
         
             
              end
         
     | 
| 
       23 
21 
     | 
    
         | 
| 
       24 
22 
     | 
    
         
             
              context 'validations' do
         
     | 
| 
       25 
23 
     | 
    
         
             
                context 'username' do
         
     | 
| 
       26 
     | 
    
         
            -
                  it {  
     | 
| 
       27 
     | 
    
         
            -
                  it {  
     | 
| 
      
 24 
     | 
    
         
            +
                  it { is_expected.to validate_presence_of :username }
         
     | 
| 
      
 25 
     | 
    
         
            +
                  it { is_expected.to validate_uniqueness_of :username }
         
     | 
| 
       28 
26 
     | 
    
         
             
                end
         
     | 
| 
       29 
27 
     | 
    
         
             
              end
         
     | 
| 
       30 
28 
     | 
    
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -39,31 +39,96 @@ rooteds.each do |rooted| 
     | 
|
| 
       39 
39 
     | 
    
         
             
              end
         
     | 
| 
       40 
40 
     | 
    
         
             
            end
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            # This file was generated by the `rspec --init` command. Conventionally, all
         
     | 
| 
      
 44 
     | 
    
         
            +
            # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
         
     | 
| 
      
 45 
     | 
    
         
            +
            # The generated `.rspec` file contains `--require spec_helper` which will cause
         
     | 
| 
      
 46 
     | 
    
         
            +
            # this file to always be loaded, without a need to explicitly require it in any
         
     | 
| 
      
 47 
     | 
    
         
            +
            # files.
         
     | 
| 
      
 48 
     | 
    
         
            +
            #
         
     | 
| 
      
 49 
     | 
    
         
            +
            # Given that it is always loaded, you are encouraged to keep this file as
         
     | 
| 
      
 50 
     | 
    
         
            +
            # light-weight as possible. Requiring heavyweight dependencies from this file
         
     | 
| 
      
 51 
     | 
    
         
            +
            # will add to the boot time of your test suite on EVERY test run, even for an
         
     | 
| 
      
 52 
     | 
    
         
            +
            # individual file that may not need all of that loaded. Instead, consider making
         
     | 
| 
      
 53 
     | 
    
         
            +
            # a separate helper file that requires the additional dependencies and performs
         
     | 
| 
      
 54 
     | 
    
         
            +
            # the additional setup, and require it from the spec files that actually need
         
     | 
| 
      
 55 
     | 
    
         
            +
            # it.
         
     | 
| 
      
 56 
     | 
    
         
            +
            #
         
     | 
| 
      
 57 
     | 
    
         
            +
            # The `.rspec` file also contains a few flags that are not defaults but that
         
     | 
| 
      
 58 
     | 
    
         
            +
            # users commonly want.
         
     | 
| 
      
 59 
     | 
    
         
            +
            #
         
     | 
| 
      
 60 
     | 
    
         
            +
            # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
         
     | 
| 
       42 
61 
     | 
    
         
             
            RSpec.configure do |config|
         
     | 
| 
       43 
     | 
    
         
            -
              #  
     | 
| 
       44 
     | 
    
         
            -
              #
         
     | 
| 
       45 
     | 
    
         
            -
              #  
     | 
| 
       46 
     | 
    
         
            -
               
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
      
 62 
     | 
    
         
            +
              # rspec-expectations config goes here. You can use an alternate
         
     | 
| 
      
 63 
     | 
    
         
            +
              # assertion/expectation library such as wrong or the stdlib/minitest
         
     | 
| 
      
 64 
     | 
    
         
            +
              # assertions if you prefer.
         
     | 
| 
      
 65 
     | 
    
         
            +
              config.expect_with :rspec do |expectations|
         
     | 
| 
      
 66 
     | 
    
         
            +
                # This option will default to `true` in RSpec 4. It makes the `description`
         
     | 
| 
      
 67 
     | 
    
         
            +
                # and `failure_message` of custom matchers include text for helper methods
         
     | 
| 
      
 68 
     | 
    
         
            +
                # defined using `chain`, e.g.:
         
     | 
| 
      
 69 
     | 
    
         
            +
                #     be_bigger_than(2).and_smaller_than(4).description
         
     | 
| 
      
 70 
     | 
    
         
            +
                #     # => "be bigger than 2 and smaller than 4"
         
     | 
| 
      
 71 
     | 
    
         
            +
                # ...rather than:
         
     | 
| 
      
 72 
     | 
    
         
            +
                #     # => "be bigger than 2"
         
     | 
| 
      
 73 
     | 
    
         
            +
                expectations.include_chain_clauses_in_custom_matcher_descriptions = true
         
     | 
| 
      
 74 
     | 
    
         
            +
              end
         
     | 
| 
       50 
75 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
              #  
     | 
| 
       52 
     | 
    
         
            -
               
     | 
| 
      
 76 
     | 
    
         
            +
              # rspec-mocks config goes here. You can use an alternate test double
         
     | 
| 
      
 77 
     | 
    
         
            +
              # library (such as bogus or mocha) by changing the `mock_with` option here.
         
     | 
| 
      
 78 
     | 
    
         
            +
              config.mock_with :rspec do |mocks|
         
     | 
| 
      
 79 
     | 
    
         
            +
                # Prevents you from mocking or stubbing a method that does not exist on
         
     | 
| 
      
 80 
     | 
    
         
            +
                # a real object. This is generally recommended, and will default to
         
     | 
| 
      
 81 
     | 
    
         
            +
                # `true` in RSpec 4.
         
     | 
| 
      
 82 
     | 
    
         
            +
                mocks.verify_partial_doubles = true
         
     | 
| 
      
 83 
     | 
    
         
            +
              end
         
     | 
| 
       53 
84 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
              #  
     | 
| 
       55 
     | 
    
         
            -
              # examples  
     | 
| 
       56 
     | 
    
         
            -
              #  
     | 
| 
       57 
     | 
    
         
            -
               
     | 
| 
      
 85 
     | 
    
         
            +
              # These two settings work together to allow you to limit a spec run
         
     | 
| 
      
 86 
     | 
    
         
            +
              # to individual examples or groups you care about by tagging them with
         
     | 
| 
      
 87 
     | 
    
         
            +
              # `:focus` metadata. When nothing is tagged with `:focus`, all examples
         
     | 
| 
      
 88 
     | 
    
         
            +
              # get run.
         
     | 
| 
      
 89 
     | 
    
         
            +
              config.filter_run :focus
         
     | 
| 
      
 90 
     | 
    
         
            +
              config.run_all_when_everything_filtered = true
         
     | 
| 
       58 
91 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
              #  
     | 
| 
       60 
     | 
    
         
            -
              #  
     | 
| 
       61 
     | 
    
         
            -
              #  
     | 
| 
       62 
     | 
    
         
            -
               
     | 
| 
      
 92 
     | 
    
         
            +
              # Limits the available syntax to the non-monkey patched syntax that is
         
     | 
| 
      
 93 
     | 
    
         
            +
              # recommended. For more details, see:
         
     | 
| 
      
 94 
     | 
    
         
            +
              #   - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
         
     | 
| 
      
 95 
     | 
    
         
            +
              #   - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
         
     | 
| 
      
 96 
     | 
    
         
            +
              #   - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
         
     | 
| 
      
 97 
     | 
    
         
            +
              config.disable_monkey_patching!
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
              # This setting enables warnings. It's recommended, but in some cases may
         
     | 
| 
      
 100 
     | 
    
         
            +
              # be too noisy due to issues in dependencies.
         
     | 
| 
      
 101 
     | 
    
         
            +
              config.warnings = true
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
              # Many RSpec users commonly either run the entire suite or an individual
         
     | 
| 
      
 104 
     | 
    
         
            +
              # file, and it's useful to allow more verbose output when running an
         
     | 
| 
      
 105 
     | 
    
         
            +
              # individual spec file.
         
     | 
| 
      
 106 
     | 
    
         
            +
              if config.files_to_run.one?
         
     | 
| 
      
 107 
     | 
    
         
            +
                # Use the documentation formatter for detailed output,
         
     | 
| 
      
 108 
     | 
    
         
            +
                # unless a formatter has already been configured
         
     | 
| 
      
 109 
     | 
    
         
            +
                # (e.g. via a command-line flag).
         
     | 
| 
      
 110 
     | 
    
         
            +
                config.default_formatter = 'doc'
         
     | 
| 
      
 111 
     | 
    
         
            +
              end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
              # Print the 10 slowest examples and example groups at the
         
     | 
| 
      
 114 
     | 
    
         
            +
              # end of the spec run, to help surface which specs are running
         
     | 
| 
      
 115 
     | 
    
         
            +
              # particularly slow.
         
     | 
| 
      
 116 
     | 
    
         
            +
              config.profile_examples = 10
         
     | 
| 
       63 
117 
     | 
    
         | 
| 
       64 
118 
     | 
    
         
             
              # Run specs in random order to surface order dependencies. If you find an
         
     | 
| 
       65 
119 
     | 
    
         
             
              # order dependency and want to debug it, you can fix the order by providing
         
     | 
| 
       66 
120 
     | 
    
         
             
              # the seed, which is printed after each run.
         
     | 
| 
       67 
121 
     | 
    
         
             
              #     --seed 1234
         
     | 
| 
       68 
     | 
    
         
            -
              config.order =  
     | 
| 
      
 122 
     | 
    
         
            +
              config.order = :random
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
              # Seed global randomization in this process using the `--seed` CLI option.
         
     | 
| 
      
 125 
     | 
    
         
            +
              # Setting this allows you to use `--seed` to deterministically reproduce
         
     | 
| 
      
 126 
     | 
    
         
            +
              # test failures related to randomization by passing the same `--seed` value
         
     | 
| 
      
 127 
     | 
    
         
            +
              # as the one that triggered the failure.
         
     | 
| 
      
 128 
     | 
    
         
            +
              Kernel.srand config.seed
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
              # If you're not using ActiveRecord, or you'd prefer not to run each of your
         
     | 
| 
      
 131 
     | 
    
         
            +
              # examples within a transaction, remove the following line or assign false
         
     | 
| 
      
 132 
     | 
    
         
            +
              # instead of true.
         
     | 
| 
      
 133 
     | 
    
         
            +
              config.use_transactional_fixtures = true
         
     | 
| 
       69 
134 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            shared_context 'Mdm::Workspace' do
         
     | 
| 
       2 
2 
     | 
    
         
             
              before(:each) do
         
     | 
| 
       3 
3 
     | 
    
         
             
                # TODO remove Rex usage from Mdm as it is not a declared dependency
         
     | 
| 
       4 
     | 
    
         
            -
                Mdm::Workspace. 
     | 
| 
      
 4 
     | 
    
         
            +
                allow_any_instance_of(Mdm::Workspace).to receive(:valid_ip_or_range?).and_return(true)
         
     | 
| 
       5 
5 
     | 
    
         
             
              end
         
     | 
| 
       6 
6 
     | 
    
         
             
            end
         
     | 
| 
         @@ -51,18 +51,6 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       51 
51 
     | 
    
         
             
                # lets
         
     | 
| 
       52 
52 
     | 
    
         
             
                #
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                let(:first_private) {
         
     | 
| 
       55 
     | 
    
         
            -
                  FactoryGirl.create(:metasploit_credential_private)
         
     | 
| 
       56 
     | 
    
         
            -
                }
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
                let(:first_public) {
         
     | 
| 
       59 
     | 
    
         
            -
                  FactoryGirl.create(:metasploit_credential_username)
         
     | 
| 
       60 
     | 
    
         
            -
                }
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
                let(:first_realm) {
         
     | 
| 
       63 
     | 
    
         
            -
                  FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
       64 
     | 
    
         
            -
                }
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
54 
     | 
    
         
             
                let(:first_workspace) {
         
     | 
| 
       67 
55 
     | 
    
         
             
                  FactoryGirl.create(:mdm_workspace)
         
     | 
| 
       68 
56 
     | 
    
         
             
                }
         
     | 
| 
         @@ -96,27 +84,10 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       96 
84 
     | 
    
         
             
                  }
         
     | 
| 
       97 
85 
     | 
    
         
             
                }
         
     | 
| 
       98 
86 
     | 
    
         | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
87 
     | 
    
         
             
                let(:second_metasploit_credential_core) {
         
     | 
| 
       101 
88 
     | 
    
         
             
                  FactoryGirl.build( factory_name, second_factory_options)
         
     | 
| 
       102 
89 
     | 
    
         
             
                }
         
     | 
| 
       103 
90 
     | 
    
         | 
| 
       104 
     | 
    
         
            -
                let(:second_private) {
         
     | 
| 
       105 
     | 
    
         
            -
                  FactoryGirl.create(:metasploit_credential_private)
         
     | 
| 
       106 
     | 
    
         
            -
                }
         
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
                let(:second_public) {
         
     | 
| 
       109 
     | 
    
         
            -
                  FactoryGirl.create(:metasploit_credential_username)
         
     | 
| 
       110 
     | 
    
         
            -
                }
         
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
                let(:second_realm) {
         
     | 
| 
       113 
     | 
    
         
            -
                  FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
       114 
     | 
    
         
            -
                }
         
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
                let(:second_workspace) {
         
     | 
| 
       117 
     | 
    
         
            -
                  FactoryGirl.create(:mdm_workspace)
         
     | 
| 
       118 
     | 
    
         
            -
                }
         
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
91 
     | 
    
         
             
                #
         
     | 
| 
       121 
92 
     | 
    
         
             
                # let!s
         
     | 
| 
       122 
93 
     | 
    
         
             
                #
         
     | 
| 
         @@ -129,6 +100,26 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       129 
100 
     | 
    
         
             
              context 'database' do
         
     | 
| 
       130 
101 
     | 
    
         
             
                context 'indices' do
         
     | 
| 
       131 
102 
     | 
    
         
             
                  context 'foreign keys' do
         
     | 
| 
      
 103 
     | 
    
         
            +
                    let(:first_private) {
         
     | 
| 
      
 104 
     | 
    
         
            +
                      FactoryGirl.create(:metasploit_credential_private)
         
     | 
| 
      
 105 
     | 
    
         
            +
                    }
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                    let(:second_public) {
         
     | 
| 
      
 108 
     | 
    
         
            +
                      FactoryGirl.create(:metasploit_credential_username)
         
     | 
| 
      
 109 
     | 
    
         
            +
                    }
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                    let(:second_private) {
         
     | 
| 
      
 112 
     | 
    
         
            +
                      FactoryGirl.create(:metasploit_credential_private)
         
     | 
| 
      
 113 
     | 
    
         
            +
                    }
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
                    let(:second_realm) {
         
     | 
| 
      
 116 
     | 
    
         
            +
                      FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
      
 117 
     | 
    
         
            +
                    }
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
                    let(:second_workspace) {
         
     | 
| 
      
 120 
     | 
    
         
            +
                      FactoryGirl.create(:mdm_workspace)
         
     | 
| 
      
 121 
     | 
    
         
            +
                    }
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
       132 
123 
     | 
    
         
             
                    shared_examples_for 'potential collision' do |options={}|
         
     | 
| 
       133 
124 
     | 
    
         
             
                      options.assert_valid_keys(:collision, :index)
         
     | 
| 
       134 
125 
     | 
    
         | 
| 
         @@ -198,6 +189,10 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       198 
189 
     | 
    
         
             
                        nil
         
     | 
| 
       199 
190 
     | 
    
         
             
                      }
         
     | 
| 
       200 
191 
     | 
    
         | 
| 
      
 192 
     | 
    
         
            +
                      let(:first_public) {
         
     | 
| 
      
 193 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_username)
         
     | 
| 
      
 194 
     | 
    
         
            +
                      }
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
       201 
196 
     | 
    
         
             
                      let(:first_realm) {
         
     | 
| 
       202 
197 
     | 
    
         
             
                        nil
         
     | 
| 
       203 
198 
     | 
    
         
             
                      }
         
     | 
| 
         @@ -224,6 +219,10 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       224 
219 
     | 
    
         | 
| 
       225 
220 
     | 
    
         
             
                      options.assert_valid_keys(:collision, :private, :public, :workspace)
         
     | 
| 
       226 
221 
     | 
    
         | 
| 
      
 222 
     | 
    
         
            +
                      let(:first_public) {
         
     | 
| 
      
 223 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_username)
         
     | 
| 
      
 224 
     | 
    
         
            +
                      }
         
     | 
| 
      
 225 
     | 
    
         
            +
             
     | 
| 
       227 
226 
     | 
    
         
             
                      let(:first_realm) {
         
     | 
| 
       228 
227 
     | 
    
         
             
                        nil
         
     | 
| 
       229 
228 
     | 
    
         
             
                      }
         
     | 
| 
         @@ -252,6 +251,10 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       252 
251 
     | 
    
         
             
                        nil
         
     | 
| 
       253 
252 
     | 
    
         
             
                      }
         
     | 
| 
       254 
253 
     | 
    
         | 
| 
      
 254 
     | 
    
         
            +
                      let(:first_realm) {
         
     | 
| 
      
 255 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
      
 256 
     | 
    
         
            +
                      }
         
     | 
| 
      
 257 
     | 
    
         
            +
             
     | 
| 
       255 
258 
     | 
    
         
             
                      let(:second_public) {
         
     | 
| 
       256 
259 
     | 
    
         
             
                        nil
         
     | 
| 
       257 
260 
     | 
    
         
             
                      }
         
     | 
| 
         @@ -276,6 +279,14 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       276 
279 
     | 
    
         
             
                        nil
         
     | 
| 
       277 
280 
     | 
    
         
             
                      }
         
     | 
| 
       278 
281 
     | 
    
         | 
| 
      
 282 
     | 
    
         
            +
                      let(:first_public) {
         
     | 
| 
      
 283 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_username)
         
     | 
| 
      
 284 
     | 
    
         
            +
                      }
         
     | 
| 
      
 285 
     | 
    
         
            +
             
     | 
| 
      
 286 
     | 
    
         
            +
                      let(:first_realm) {
         
     | 
| 
      
 287 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
      
 288 
     | 
    
         
            +
                      }
         
     | 
| 
      
 289 
     | 
    
         
            +
             
     | 
| 
       279 
290 
     | 
    
         
             
                      let(:second_private) {
         
     | 
| 
       280 
291 
     | 
    
         
             
                        nil
         
     | 
| 
       281 
292 
     | 
    
         
             
                      }
         
     | 
| 
         @@ -296,6 +307,14 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       296 
307 
     | 
    
         | 
| 
       297 
308 
     | 
    
         
             
                      options.assert_valid_keys(:collision, :private, :public, :realm, :workspace)
         
     | 
| 
       298 
309 
     | 
    
         | 
| 
      
 310 
     | 
    
         
            +
                      let(:first_public) {
         
     | 
| 
      
 311 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_username)
         
     | 
| 
      
 312 
     | 
    
         
            +
                      }
         
     | 
| 
      
 313 
     | 
    
         
            +
             
     | 
| 
      
 314 
     | 
    
         
            +
                      let(:first_realm) {
         
     | 
| 
      
 315 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
      
 316 
     | 
    
         
            +
                      }
         
     | 
| 
      
 317 
     | 
    
         
            +
             
     | 
| 
       299 
318 
     | 
    
         
             
                      context_with_correlation(options, :workspace) do
         
     | 
| 
       300 
319 
     | 
    
         
             
                        context_with_correlation(options, :realm) do
         
     | 
| 
       301 
320 
     | 
    
         
             
                          context_with_correlation(options, :public) do
         
     | 
| 
         @@ -566,9 +585,29 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       566 
585 
     | 
    
         
             
                end
         
     | 
| 
       567 
586 
     | 
    
         | 
| 
       568 
587 
     | 
    
         
             
                context 'validations' do
         
     | 
| 
       569 
     | 
    
         
            -
                  it {  
     | 
| 
      
 588 
     | 
    
         
            +
                  it { is_expected.to validate_presence_of :workspace }
         
     | 
| 
       570 
589 
     | 
    
         | 
| 
       571 
590 
     | 
    
         
             
                  context 'of uniqueness' do
         
     | 
| 
      
 591 
     | 
    
         
            +
                    let(:first_private) {
         
     | 
| 
      
 592 
     | 
    
         
            +
                      FactoryGirl.create(:metasploit_credential_private)
         
     | 
| 
      
 593 
     | 
    
         
            +
                    }
         
     | 
| 
      
 594 
     | 
    
         
            +
             
     | 
| 
      
 595 
     | 
    
         
            +
                    let(:second_public) {
         
     | 
| 
      
 596 
     | 
    
         
            +
                      FactoryGirl.create(:metasploit_credential_username)
         
     | 
| 
      
 597 
     | 
    
         
            +
                    }
         
     | 
| 
      
 598 
     | 
    
         
            +
             
     | 
| 
      
 599 
     | 
    
         
            +
                    let(:second_private) {
         
     | 
| 
      
 600 
     | 
    
         
            +
                      FactoryGirl.create(:metasploit_credential_private)
         
     | 
| 
      
 601 
     | 
    
         
            +
                    }
         
     | 
| 
      
 602 
     | 
    
         
            +
             
     | 
| 
      
 603 
     | 
    
         
            +
                    let(:second_realm) {
         
     | 
| 
      
 604 
     | 
    
         
            +
                      FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
      
 605 
     | 
    
         
            +
                    }
         
     | 
| 
      
 606 
     | 
    
         
            +
             
     | 
| 
      
 607 
     | 
    
         
            +
                    let(:second_workspace) {
         
     | 
| 
      
 608 
     | 
    
         
            +
                      FactoryGirl.create(:mdm_workspace)
         
     | 
| 
      
 609 
     | 
    
         
            +
                    }
         
     | 
| 
      
 610 
     | 
    
         
            +
             
     | 
| 
       572 
611 
     | 
    
         
             
                    shared_examples_for 'potential collision' do |options={}|
         
     | 
| 
       573 
612 
     | 
    
         
             
                      options.assert_valid_keys(:attribute, :collision, :message)
         
     | 
| 
       574 
613 
     | 
    
         | 
| 
         @@ -590,7 +629,7 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       590 
629 
     | 
    
         
             
                          ).to include options.fetch(:message)
         
     | 
| 
       591 
630 
     | 
    
         
             
                        end
         
     | 
| 
       592 
631 
     | 
    
         
             
                      else
         
     | 
| 
       593 
     | 
    
         
            -
                        it {  
     | 
| 
      
 632 
     | 
    
         
            +
                        it { is_expected.to be_valid }
         
     | 
| 
       594 
633 
     | 
    
         
             
                      end
         
     | 
| 
       595 
634 
     | 
    
         
             
                    end
         
     | 
| 
       596 
635 
     | 
    
         | 
| 
         @@ -642,6 +681,10 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       642 
681 
     | 
    
         
             
                        nil
         
     | 
| 
       643 
682 
     | 
    
         
             
                      }
         
     | 
| 
       644 
683 
     | 
    
         | 
| 
      
 684 
     | 
    
         
            +
                      let(:first_public) {
         
     | 
| 
      
 685 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_username)
         
     | 
| 
      
 686 
     | 
    
         
            +
                      }
         
     | 
| 
      
 687 
     | 
    
         
            +
             
     | 
| 
       645 
688 
     | 
    
         
             
                      let(:first_realm) {
         
     | 
| 
       646 
689 
     | 
    
         
             
                        nil
         
     | 
| 
       647 
690 
     | 
    
         
             
                      }
         
     | 
| 
         @@ -673,6 +716,10 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       673 
716 
     | 
    
         
             
                        nil
         
     | 
| 
       674 
717 
     | 
    
         
             
                      }
         
     | 
| 
       675 
718 
     | 
    
         | 
| 
      
 719 
     | 
    
         
            +
                      let(:first_public) {
         
     | 
| 
      
 720 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_username)
         
     | 
| 
      
 721 
     | 
    
         
            +
                      }
         
     | 
| 
      
 722 
     | 
    
         
            +
             
     | 
| 
       676 
723 
     | 
    
         
             
                      let(:second_realm) {
         
     | 
| 
       677 
724 
     | 
    
         
             
                        nil
         
     | 
| 
       678 
725 
     | 
    
         
             
                      }
         
     | 
| 
         @@ -698,6 +745,10 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       698 
745 
     | 
    
         
             
                        nil
         
     | 
| 
       699 
746 
     | 
    
         
             
                      }
         
     | 
| 
       700 
747 
     | 
    
         | 
| 
      
 748 
     | 
    
         
            +
                      let(:first_realm) {
         
     | 
| 
      
 749 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
      
 750 
     | 
    
         
            +
                      }
         
     | 
| 
      
 751 
     | 
    
         
            +
             
     | 
| 
       701 
752 
     | 
    
         
             
                      let(:second_public) {
         
     | 
| 
       702 
753 
     | 
    
         
             
                        nil
         
     | 
| 
       703 
754 
     | 
    
         
             
                      }
         
     | 
| 
         @@ -723,6 +774,14 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       723 
774 
     | 
    
         
             
                        nil
         
     | 
| 
       724 
775 
     | 
    
         
             
                      }
         
     | 
| 
       725 
776 
     | 
    
         | 
| 
      
 777 
     | 
    
         
            +
                      let(:first_public) {
         
     | 
| 
      
 778 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_username)
         
     | 
| 
      
 779 
     | 
    
         
            +
                      }
         
     | 
| 
      
 780 
     | 
    
         
            +
             
     | 
| 
      
 781 
     | 
    
         
            +
                      let(:first_realm) {
         
     | 
| 
      
 782 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
      
 783 
     | 
    
         
            +
                      }
         
     | 
| 
      
 784 
     | 
    
         
            +
             
     | 
| 
       726 
785 
     | 
    
         
             
                      let(:second_private) {
         
     | 
| 
       727 
786 
     | 
    
         
             
                        nil
         
     | 
| 
       728 
787 
     | 
    
         
             
                      }
         
     | 
| 
         @@ -744,6 +803,14 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       744 
803 
     | 
    
         | 
| 
       745 
804 
     | 
    
         
             
                      options.assert_valid_keys(:collision, :private, :public, :realm, :workspace)
         
     | 
| 
       746 
805 
     | 
    
         | 
| 
      
 806 
     | 
    
         
            +
                      let(:first_public) {
         
     | 
| 
      
 807 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_username)
         
     | 
| 
      
 808 
     | 
    
         
            +
                      }
         
     | 
| 
      
 809 
     | 
    
         
            +
             
     | 
| 
      
 810 
     | 
    
         
            +
                      let(:first_realm) {
         
     | 
| 
      
 811 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
      
 812 
     | 
    
         
            +
                      }
         
     | 
| 
      
 813 
     | 
    
         
            +
             
     | 
| 
       747 
814 
     | 
    
         
             
                      context_with_correlation(options, :workspace) do
         
     | 
| 
       748 
815 
     | 
    
         
             
                        context_with_correlation(options, :realm) do
         
     | 
| 
       749 
816 
     | 
    
         
             
                          context_with_correlation(options, :public) do
         
     | 
| 
         @@ -1027,6 +1094,14 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       1027 
1094 
     | 
    
         
             
                        second_metasploit_credential_core
         
     | 
| 
       1028 
1095 
     | 
    
         
             
                      }
         
     | 
| 
       1029 
1096 
     | 
    
         | 
| 
      
 1097 
     | 
    
         
            +
                      let(:first_public) {
         
     | 
| 
      
 1098 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_username)
         
     | 
| 
      
 1099 
     | 
    
         
            +
                      }
         
     | 
| 
      
 1100 
     | 
    
         
            +
             
     | 
| 
      
 1101 
     | 
    
         
            +
                      let(:first_realm) {
         
     | 
| 
      
 1102 
     | 
    
         
            +
                        FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
      
 1103 
     | 
    
         
            +
                      }
         
     | 
| 
      
 1104 
     | 
    
         
            +
             
     | 
| 
       1030 
1105 
     | 
    
         
             
                      let(:second_private) {
         
     | 
| 
       1031 
1106 
     | 
    
         
             
                        first_private
         
     | 
| 
       1032 
1107 
     | 
    
         
             
                      }
         
     | 
| 
         @@ -1053,7 +1128,7 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       1053 
1128 
     | 
    
         
             
                            nil
         
     | 
| 
       1054 
1129 
     | 
    
         
             
                          }
         
     | 
| 
       1055 
1130 
     | 
    
         | 
| 
       1056 
     | 
    
         
            -
                          it {  
     | 
| 
      
 1131 
     | 
    
         
            +
                          it { is_expected.to be_valid }
         
     | 
| 
       1057 
1132 
     | 
    
         
             
                        end
         
     | 
| 
       1058 
1133 
     | 
    
         | 
| 
       1059 
1134 
     | 
    
         
             
                        context 'with same workspace without realm with same public without private' do
         
     | 
| 
         @@ -1065,7 +1140,7 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       1065 
1140 
     | 
    
         
             
                            nil
         
     | 
| 
       1066 
1141 
     | 
    
         
             
                          }
         
     | 
| 
       1067 
1142 
     | 
    
         | 
| 
       1068 
     | 
    
         
            -
                          it {  
     | 
| 
      
 1143 
     | 
    
         
            +
                          it { is_expected.to be_valid }
         
     | 
| 
       1069 
1144 
     | 
    
         
             
                        end
         
     | 
| 
       1070 
1145 
     | 
    
         | 
| 
       1071 
1146 
     | 
    
         
             
                        context 'with same workspace with same realm without public with same private' do
         
     | 
| 
         @@ -1073,7 +1148,7 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       1073 
1148 
     | 
    
         
             
                            nil
         
     | 
| 
       1074 
1149 
     | 
    
         
             
                          }
         
     | 
| 
       1075 
1150 
     | 
    
         | 
| 
       1076 
     | 
    
         
            -
                          it {  
     | 
| 
      
 1151 
     | 
    
         
            +
                          it { is_expected.to be_valid }
         
     | 
| 
       1077 
1152 
     | 
    
         
             
                        end
         
     | 
| 
       1078 
1153 
     | 
    
         | 
| 
       1079 
1154 
     | 
    
         
             
                        context 'with same workspace with same realm with same public without private' do
         
     | 
| 
         @@ -1085,7 +1160,7 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       1085 
1160 
     | 
    
         
             
                            nil
         
     | 
| 
       1086 
1161 
     | 
    
         
             
                          }
         
     | 
| 
       1087 
1162 
     | 
    
         | 
| 
       1088 
     | 
    
         
            -
                          it {  
     | 
| 
      
 1163 
     | 
    
         
            +
                          it { is_expected.to be_valid }
         
     | 
| 
       1089 
1164 
     | 
    
         
             
                        end
         
     | 
| 
       1090 
1165 
     | 
    
         
             
                      end
         
     | 
| 
       1091 
1166 
     | 
    
         | 
| 
         @@ -1107,7 +1182,7 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       1107 
1182 
     | 
    
         
             
                            nil
         
     | 
| 
       1108 
1183 
     | 
    
         
             
                          }
         
     | 
| 
       1109 
1184 
     | 
    
         | 
| 
       1110 
     | 
    
         
            -
                          it {  
     | 
| 
      
 1185 
     | 
    
         
            +
                          it { is_expected.to be_valid }
         
     | 
| 
       1111 
1186 
     | 
    
         
             
                        end
         
     | 
| 
       1112 
1187 
     | 
    
         | 
| 
       1113 
1188 
     | 
    
         
             
                        context 'with same workspace without realm with public with same private' do
         
     | 
| 
         @@ -1115,7 +1190,7 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       1115 
1190 
     | 
    
         
             
                            FactoryGirl.create(:metasploit_credential_public)
         
     | 
| 
       1116 
1191 
     | 
    
         
             
                          }
         
     | 
| 
       1117 
1192 
     | 
    
         | 
| 
       1118 
     | 
    
         
            -
                          it {  
     | 
| 
      
 1193 
     | 
    
         
            +
                          it { is_expected.to be_valid }
         
     | 
| 
       1119 
1194 
     | 
    
         
             
                        end
         
     | 
| 
       1120 
1195 
     | 
    
         | 
| 
       1121 
1196 
     | 
    
         
             
                        context 'with same workspace with realm without public with same private' do
         
     | 
| 
         @@ -1123,7 +1198,7 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       1123 
1198 
     | 
    
         
             
                            FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
       1124 
1199 
     | 
    
         
             
                          }
         
     | 
| 
       1125 
1200 
     | 
    
         | 
| 
       1126 
     | 
    
         
            -
                          it {  
     | 
| 
      
 1201 
     | 
    
         
            +
                          it { is_expected.to be_valid }
         
     | 
| 
       1127 
1202 
     | 
    
         
             
                        end
         
     | 
| 
       1128 
1203 
     | 
    
         
             
                      end
         
     | 
| 
       1129 
1204 
     | 
    
         | 
| 
         @@ -1141,7 +1216,7 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       1141 
1216 
     | 
    
         
             
                            FactoryGirl.create(:metasploit_credential_private)
         
     | 
| 
       1142 
1217 
     | 
    
         
             
                          }
         
     | 
| 
       1143 
1218 
     | 
    
         | 
| 
       1144 
     | 
    
         
            -
                          it {  
     | 
| 
      
 1219 
     | 
    
         
            +
                          it { is_expected.to be_valid }
         
     | 
| 
       1145 
1220 
     | 
    
         
             
                        end
         
     | 
| 
       1146 
1221 
     | 
    
         | 
| 
       1147 
1222 
     | 
    
         
             
                        context 'with workspace with realm without public with private' do
         
     | 
| 
         @@ -1153,7 +1228,7 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       1153 
1228 
     | 
    
         
             
                            FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
       1154 
1229 
     | 
    
         
             
                          }
         
     | 
| 
       1155 
1230 
     | 
    
         | 
| 
       1156 
     | 
    
         
            -
                          it {  
     | 
| 
      
 1231 
     | 
    
         
            +
                          it { is_expected.to be_valid}
         
     | 
| 
       1157 
1232 
     | 
    
         
             
                        end
         
     | 
| 
       1158 
1233 
     | 
    
         
             
                      end
         
     | 
| 
       1159 
1234 
     | 
    
         | 
| 
         @@ -1171,7 +1246,7 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       1171 
1246 
     | 
    
         
             
                            FactoryGirl.create(:metasploit_credential_realm)
         
     | 
| 
       1172 
1247 
     | 
    
         
             
                          }
         
     | 
| 
       1173 
1248 
     | 
    
         | 
| 
       1174 
     | 
    
         
            -
                          it {  
     | 
| 
      
 1249 
     | 
    
         
            +
                          it { is_expected.to be_valid }
         
     | 
| 
       1175 
1250 
     | 
    
         
             
                        end
         
     | 
| 
       1176 
1251 
     | 
    
         
             
                      end
         
     | 
| 
       1177 
1252 
     | 
    
         | 
| 
         @@ -1189,7 +1264,7 @@ shared_examples_for 'Metasploit::Credential::CoreValidations' do 
     | 
|
| 
       1189 
1264 
     | 
    
         
             
                            FactoryGirl.create(:metasploit_credential_public)
         
     | 
| 
       1190 
1265 
     | 
    
         
             
                          }
         
     | 
| 
       1191 
1266 
     | 
    
         | 
| 
       1192 
     | 
    
         
            -
                          it {  
     | 
| 
      
 1267 
     | 
    
         
            +
                          it { is_expected.to be_valid }
         
     | 
| 
       1193 
1268 
     | 
    
         
             
                        end
         
     | 
| 
       1194 
1269 
     | 
    
         
             
                      end
         
     | 
| 
       1195 
1270 
     | 
    
         
             
                    end
         
     |