Sha256: 4e79f4ba51db6bf394d17ba27d1beb53dfe6d0ae0a064708f36d934662e125f0

Contents?: true

Size: 829 Bytes

Versions: 2

Compression:

Stored size: 829 Bytes

Contents

FactoryBot.define do
  factory :metasploit_credential_ssh_key,
          class: Metasploit::Credential::SSHKey do
    transient do
      key_type { generate :metasploit_credential_ssh_key_key_type }
      # key size tuned for speed.  DO NOT use for production, it is below current recommended key size of 2048
      key_size { 512 }
    end

    data {
      key_class = OpenSSL::PKey.const_get(key_type)
      key_class.generate(key_size).to_s
    }

    factory :metasploit_credential_dsa_key do
      transient do
        key_type :DSA
      end
    end

    factory :metasploit_credential_rsa_key do
      transient do
        key_type :RSA
      end
    end
  end

  metasploit_credential_ssh_key_key_types = [:DSA, :RSA]
  sequence :metasploit_credential_ssh_key_key_type, metasploit_credential_ssh_key_key_types.cycle
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
metasploit-credential-3.0.1 spec/factories/metasploit/credential/ssh_keys.rb
metasploit-credential-3.0.0 spec/factories/metasploit/credential/ssh_keys.rb