Sha256: 0e53276e30e807ff4c0de7a9f7d9e5c4340088cfb97985c1f2213d201f8c55dc

Contents?: true

Size: 1.24 KB

Versions: 59

Compression:

Stored size: 1.24 KB

Contents

class Mdm::WebSite < ActiveRecord::Base
  #
  # Relations
  #

  belongs_to :service,
             class_name: 'Mdm::Service',
             foreign_key: 'service_id',
             inverse_of: :web_sites

  has_many :web_forms,
           class_name: 'Mdm::WebForm',
           dependent: :destroy,
           inverse_of: :web_site

  has_many :web_pages,
           class_name: 'Mdm::WebPage',
           dependent: :destroy,
           inverse_of: :web_site

  has_many :web_vulns,
           class_name: 'Mdm::WebVuln',
           dependent: :destroy,
           inverse_of: :web_site

  #
  # Serializations
  #

  serialize :options, ::MetasploitDataModels::Base64Serializer.new

  def form_count
    web_forms.size
  end

  def page_count
    web_pages.size
  end

  def to_url(ignore_vhost=false)
    proto = self.service.name == "https" ? "https" : "http"
    host = ignore_vhost ? self.service.host.address : self.vhost
    port = self.service.port

    if Rex::Socket.is_ipv6?(host)
      host = "[#{host}]"
    end

    url = "#{proto}://#{host}"
    if not ((proto == "http" and port == 80) or (proto == "https" and port == 443))
      url += ":#{port}"
    end
    url
  end

  def vuln_count
    web_vulns.size
  end

  Metasploit::Concern.run(self)
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
metasploit_data_models-0.24.5 app/models/mdm/web_site.rb
metasploit_data_models-0.24.1.pre.rspec.pre.3.pre.1 app/models/mdm/web_site.rb
metasploit_data_models-0.24.1 app/models/mdm/web_site.rb
metasploit_data_models-0.24.0 app/models/mdm/web_site.rb
metasploit_data_models-0.23.3.pre.autoload app/models/mdm/web_site.rb
metasploit_data_models-0.23.2 app/models/mdm/web_site.rb
metasploit_data_models-0.23.2-java app/models/mdm/web_site.rb
metasploit_data_models-0.23.1 app/models/mdm/web_site.rb
metasploit_data_models-0.23.1-java app/models/mdm/web_site.rb
metasploit_data_models-0.23.0 app/models/mdm/web_site.rb
metasploit_data_models-0.23.0-java app/models/mdm/web_site.rb
metasploit_data_models-0.22.8 app/models/mdm/web_site.rb
metasploit_data_models-0.22.8-java app/models/mdm/web_site.rb
metasploit_data_models-0.22.7 app/models/mdm/web_site.rb
metasploit_data_models-0.22.7-java app/models/mdm/web_site.rb
metasploit_data_models-0.22.6 app/models/mdm/web_site.rb
metasploit_data_models-0.22.6-java app/models/mdm/web_site.rb
metasploit_data_models-0.22.5 app/models/mdm/web_site.rb
metasploit_data_models-0.22.5-java app/models/mdm/web_site.rb
metasploit_data_models-0.22.4 app/models/mdm/web_site.rb