Sha256: 59e520d18b479bae865636858cabb6b4437bdb46751d1707bd9acf36e197cd23

Contents?: true

Size: 842 Bytes

Versions: 30

Compression:

Stored size: 842 Bytes

Contents

FactoryBot.define do
  factory :mdm_service, :class => Mdm::Service do
    #
    # Associations
    #
    association :host, :factory => :mdm_host

    #
    # Attributes
    #
    name { generate :mdm_service_name }
    port { generate :port }
    proto { generate :mdm_service_proto }
    state { 'open' }

    factory :web_service do
      proto { 'tcp' }
      name { FactoryBot.generate(:web_service_name) }
    end
  end

  sequence(:mdm_service_name) { |n|
    "mdm_service_name#{n}"
  }

  sequence :mdm_service_proto, Mdm::Service::PROTOS.cycle

  port_bits = 16
  port_limit = 1 << port_bits

  sequence :port do |n|
    n % port_limit
  end

  web_service_names = ['http', 'https']
  web_service_name_count = web_service_names.length

  sequence :web_service_name do |n|
    web_service_names[n % web_service_name_count]
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
wg-metasploit_data_models-4.1.4.02 spec/factories/mdm/services.rb
metasploit_data_models-6.0.5 spec/factories/mdm/services.rb
metasploit_data_models-6.0.4 spec/factories/mdm/services.rb
metasploit_data_models-6.0.3 spec/factories/mdm/services.rb
metasploit_data_models-6.0.2 spec/factories/mdm/services.rb
metasploit_data_models-6.0.1 spec/factories/mdm/services.rb
metasploit_data_models-6.0.0 spec/factories/mdm/services.rb
metasploit_data_models-5.0.6 spec/factories/mdm/services.rb
metasploit_data_models-5.0.5 spec/factories/mdm/services.rb
metasploit_data_models-5.0.4 spec/factories/mdm/services.rb
metasploit_data_models-5.0.3 spec/factories/mdm/services.rb
metasploit_data_models-5.0.2 spec/factories/mdm/services.rb
metasploit_data_models-5.0.1 spec/factories/mdm/services.rb
metasploit_data_models-5.0.0 spec/factories/mdm/services.rb
metasploit_data_models-4.1.4 spec/factories/mdm/services.rb
metasploit_data_models-4.1.3 spec/factories/mdm/services.rb
metasploit_data_models-4.1.2 spec/factories/mdm/services.rb
metasploit_data_models-4.1.1 spec/factories/mdm/services.rb
metasploit_data_models-4.1.0 spec/factories/mdm/services.rb
metasploit_data_models-4.0.2 spec/factories/mdm/services.rb