Sha256: 26303c3bd31722e7d6fd2398f97a4ca7805d794e4423a53f1cf09dd59e7d6a7c

Contents?: true

Size: 1.9 KB

Versions: 2

Compression:

Stored size: 1.9 KB

Contents

FactoryGirl.define do
  factory :mdm_host, :class => Mdm::Host do
    #
    # Associations
    #
    association :workspace, :factory => :mdm_workspace

    #
    # Attributes
    #
    address { generate :mdm_ipv4_address }
    name { generate :mdm_host_name }

    factory :full_mdm_host do
      arch { generate :mdm_host_arch }
      comm { generate :mdm_host_comm }
      comments { generate :mdm_host_comments }
      info { generate :mdm_host_info }
      mac { generate :mdm_host_mac }
      os_flavor { generate :mdm_host_os_flavor }
      os_lang { generate :mdm_host_os_lang }
      os_name { generate :mdm_host_os_name }
      os_sp { generate :mdm_host_os_sp }
      purpose { generate :mdm_host_purpose }
      scope { generate :mdm_host_scope }
      state { generate :mdm_host_state }
      virtual_host { generate :mdm_host_virtual_host }
    end
  end

  sequence :mdm_host_name do |n|
    "mdm_host_#{n}"
  end

  sequence :mdm_host_arch, Mdm::Host::ARCHITECTURES.cycle

  sequence :mdm_host_comm do |n|
    "Mdm::Host#comm #{n}"
  end

  sequence :mdm_host_comments do |n|
    "Mdm::Host#comments #{n}"
  end

  sequence :mdm_host_info do |n|
    "Mdm::Host#info #{n}"
  end

  sequence :mdm_host_mac do |n|
    without_separators = "%012X" % n
    octet_strings = without_separators.scan(/.{2}/)
    formatted = octet_strings.join(':')

    formatted
  end

  sequence :mdm_host_os_flavor do |n|
    "Mdm::Host#os_flavor #{n}"
  end

  sequence :mdm_host_os_lang do |n|
    "Mdm::Host#os_lang #{n}"
  end

  sequence :mdm_host_os_name, Mdm::Host::OPERATING_SYSTEM_NAMES.cycle

  sequence :mdm_host_os_sp do |n|
    "Mdm::Host#os_sp #{n}"
  end

  sequence :mdm_host_purpose do |n|
    "Mdm::Host#purpose #{n}"
  end

  sequence :mdm_host_scope do |n|
    n.to_s
  end

  sequence :mdm_host_state, Mdm::Host::STATES.cycle

  virtual_hosts = ['VMWare', 'QEMU', 'XEN']
  sequence :mdm_host_virtual_host, virtual_hosts.cycle
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
metasploit_data_models-0.11.2-java spec/factories/mdm/hosts.rb
metasploit_data_models-0.11.2 spec/factories/mdm/hosts.rb