2009-12-14 22:52:34 +00:00
|
|
|
module Msf
|
|
|
|
class DBManager
|
|
|
|
|
|
|
|
class Host < ActiveRecord::Base
|
|
|
|
include DBSave
|
|
|
|
|
|
|
|
belongs_to :workspace
|
|
|
|
has_many :services, :dependent => :destroy
|
|
|
|
has_many :clients, :dependent => :destroy
|
|
|
|
has_many :vulns, :dependent => :destroy
|
|
|
|
has_many :notes, :dependent => :destroy
|
2010-05-07 06:37:00 +00:00
|
|
|
has_many :loots, :dependent => :destroy, :order => "loots.created_at desc"
|
2009-12-14 22:52:34 +00:00
|
|
|
|
2009-12-29 23:48:45 +00:00
|
|
|
has_many :service_notes, :through => :services
|
2010-08-18 00:58:20 +00:00
|
|
|
has_many :creds, :through => :services
|
2010-08-24 21:57:04 +00:00
|
|
|
has_many :exploited_hosts, :dependent => :destroy
|
2009-12-29 23:48:45 +00:00
|
|
|
|
2010-03-20 14:38:50 +00:00
|
|
|
validates_exclusion_of :address, :in => ['127.0.0.1']
|
2009-12-14 22:52:34 +00:00
|
|
|
validates_uniqueness_of :address, :scope => :workspace_id
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-12-29 23:48:45 +00:00
|
|
|
end
|