Sha256: 20729830930b819e9171b8bcef546f74a05681b78aef96308d9abb3bcf297609
Contents?: true
Size: 1.07 KB
Versions: 5
Compression:
Stored size: 1.07 KB
Contents
class Mdm::Session < ActiveRecord::Base # # Callbacks # before_destroy :stop # # Relations # has_many :events, :class_name => 'Mdm::SessionEvent', :order => 'created_at', :dependent => :delete_all belongs_to :host, :class_name => 'Mdm::Host' has_many :routes, :class_name => 'Mdm::Route', :dependent => :delete_all # # Through :host # has_one :workspace, :through => :host, :class_name => 'Mdm::Workspace' # # Scopes # scope :alive, where('closed_at IS NULL') scope :dead, where('closed_at IS NOT NULL') scope :upgradeable, where("closed_at IS NULL AND stype = 'shell' and platform ILIKE '%win%'") # # Serializations # serialize :datastore, ::MetasploitDataModels::Base64Serializer.new def upgradeable? (self.platform =~ /win/ and self.stype == 'shell') end private def stop c = Pro::Client.get rescue nil # ignore exceptions (XXX - ideally, stopped an already-stopped session wouldn't throw XMLRPCException) c.session_stop(self.local_id) rescue nil end ActiveSupport.run_load_hooks(:mdm_session, self) end
Version data entries
5 entries across 5 versions & 1 rubygems