class Mdm::NexposeConsole < ActiveRecord::Base # # Associations # # @!attribute vuln_details # Details for vulnerabilities supplied by this Nexpose console. # # @return [ActiveRecord::Relation] has_many :vuln_details, class_name: 'Mdm::VulnDetail', foreign_key: :nx_console_id, inverse_of: :nexpose_console before_save :strip_protocol # # Serializations # serialize :cached_sites, MetasploitDataModels::Base64Serializer.new # # Validations # validates :address, :presence => true validates :name, :presence => true validates :password, :presence => true validates :port, :numericality => { :only_integer => true }, :inclusion => {:in => 1..65535} validates :username, :presence => true def strip_protocol self.address.gsub!(/^http(s)*:\/\//i,'') end Metasploit::Concern.run(self) end