Class: Mdm::Session
- Inherits:
 - 
      ApplicationRecord
      
        
- Object
 - ApplicationRecord
 - Mdm::Session
 
 
- Defined in:
 - app/models/mdm/session.rb
 
Overview
Instance Attribute Summary collapse
- 
  
    
      #close_reason  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Why the session was closed.
 - 
  
    
      #closed_at  ⇒ DateTime 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
When the session was closed on #host.
 - 
  
    
      #datastore  ⇒ Hash 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Options for exploit and #via_payload modules.
 - 
  
    
      #desc  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Description of session.
 - 
  
    
      #events  ⇒ Array<Mdm::Event> 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Events that occurred when this session was open.
 - 
  
    
      #exploit_attempt  ⇒ Mdm::ExploitAttempt 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Exploit attempt that created this session.
 - 
  
    
      #host  ⇒ Mdm::Host 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Host on which this session was opened.
 - 
  
    
      #last_seen  ⇒ DateTime 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
The last time the session was checked to see that it was still open.
 - 
  
    
      #local_id  ⇒ Integer 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
The ID number of the in-memory session.
 - 
  
    
      #opened_at  ⇒ DateTime 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
When the session was opened on #host.
 - 
  
    
      #originating_module_run  ⇒ MetasploitDataModels::ModuleRun 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Records the Metasploit modules run that created this session.
 - 
  
    
      #platform  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
The #host platform.
 - 
  
    
      #port  ⇒ Integer 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
The remote port on which this session is running on #host.
 - 
  
    
      #routes  ⇒ ActiveRecord::Relation<Mdm::Route> 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Routes tunneled throug this session.
 - 
  
    
      #stype  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
The type of the session.
 - 
  
    
      #target_module_runs  ⇒ ActiveRecord::Relation<MetasploitDataModels::ModuleRun> 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Records the Metasploit modules run on this session.
 - 
  
    
      #task  ⇒ Mdm::Session 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Session this task touched.
 - 
  
    
      #task_sessions  ⇒ Array<Mdm::TaskSession> 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Details about sessions this task touched.
 - 
  
    
      #via_exploit  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
The full name of the exploit module that opened this session.
 - 
  
    
      #via_payload  ⇒ String 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
The full name if the payload module that's running this session.
 - 
  
    
      #vuln_attempt  ⇒ Mdm::VulnAttempt 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Vulnerability attempt that created this session.
 - 
  
    
      #workspace  ⇒ Mdm::Workspace 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The workspace in which this session exists.
 
Instance Method Summary collapse
- 
  
    
      #upgradeable?  ⇒ true, false 
    
    
  
  
  
  
  
  
  
  
  
    
Returns whether the session can be upgraded to a meterpreter session from a shell session on Windows.
 
Instance Attribute Details
#close_reason ⇒ String
Why the session was closed. Used to differentiate between user killing it local and the session being killed on the remote end.
| 
       | 
    
      # File 'app/models/mdm/session.rb', line 101
     | 
  
#closed_at ⇒ DateTime
When the session was closed on #host.
| 
       | 
    
      # File 'app/models/mdm/session.rb', line 96
     | 
  
#datastore ⇒ Hash
Options for exploit and #via_payload modules.
| 
       | 
    
      # File 'app/models/mdm/session.rb', line 107
     | 
  
#desc ⇒ String
Description of session.
| 
       | 
    
      # File 'app/models/mdm/session.rb', line 112
     | 
  
#events ⇒ Array<Mdm::Event>
Events that occurred when this session was open.
      13 14 15 16 17  | 
    
      # File 'app/models/mdm/session.rb', line 13 has_many :events, -> { order('created_at') }, class_name: 'Mdm::SessionEvent', dependent: :delete_all, inverse_of: :session  | 
  
#exploit_attempt ⇒ Mdm::ExploitAttempt
Exploit attempt that created this session.
      23 24 25  | 
    
      # File 'app/models/mdm/session.rb', line 23 has_one :exploit_attempt, class_name: 'Mdm::ExploitAttempt', inverse_of: :session  | 
  
#host ⇒ Mdm::Host
Host on which this session was opened.
      31 32 33  | 
    
      # File 'app/models/mdm/session.rb', line 31 belongs_to :host, class_name: 'Mdm::Host', inverse_of: :sessions  | 
  
#last_seen ⇒ DateTime
The last time the session was checked to see that it was still open.
| 
       | 
    
      # File 'app/models/mdm/session.rb', line 117
     | 
  
#local_id ⇒ Integer
The ID number of the in-memory session.
| 
       | 
    
      # File 'app/models/mdm/session.rb', line 122
     | 
  
#opened_at ⇒ DateTime
When the session was opened on #host.
| 
       | 
    
      # File 'app/models/mdm/session.rb', line 127
     | 
  
#originating_module_run ⇒ MetasploitDataModels::ModuleRun
Records the Metasploit modules run that created this session
      48 49 50 51 52  | 
    
      # File 'app/models/mdm/session.rb', line 48 belongs_to :originating_module_run, class_name: 'MetasploitDataModels::ModuleRun', optional: true, # no code currently generates a module_run foreign_key: :module_run_id, inverse_of: :spawned_session  | 
  
#port ⇒ Integer
The remote port on which this session is running on #host.
| 
       | 
    
      # File 'app/models/mdm/session.rb', line 137
     | 
  
#routes ⇒ ActiveRecord::Relation<Mdm::Route>
Routes tunneled throug this session.
      39 40 41 42  | 
    
      # File 'app/models/mdm/session.rb', line 39 has_many :routes, class_name: 'Mdm::Route', dependent: :delete_all, inverse_of: :session  | 
  
#stype ⇒ String
The type of the session.
| 
       | 
    
      # File 'app/models/mdm/session.rb', line 142
     | 
  
#target_module_runs ⇒ ActiveRecord::Relation<MetasploitDataModels::ModuleRun>
Records the Metasploit modules run on this session
      58 59 60  | 
    
      # File 'app/models/mdm/session.rb', line 58 has_many :target_module_runs, class_name: 'MetasploitDataModels::ModuleRun', inverse_of: :target_session  | 
  
#task ⇒ Mdm::Session
Session this task touched
      90  | 
    
      # File 'app/models/mdm/session.rb', line 90 has_many :tasks, :through => :task_sessions, :class_name => 'Mdm::Task'  | 
  
#task_sessions ⇒ Array<Mdm::TaskSession>
Details about sessions this task touched
      84  | 
    
      # File 'app/models/mdm/session.rb', line 84 has_many :task_sessions, :dependent => :destroy, :class_name => 'Mdm::TaskSession'  | 
  
#via_exploit ⇒ String
The full name of the exploit module that opened this session.
| 
       | 
    
      # File 'app/models/mdm/session.rb', line 147
     | 
  
#via_payload ⇒ String
The full name if the payload module that's running this session.
| 
       | 
    
      # File 'app/models/mdm/session.rb', line 152
     | 
  
#vuln_attempt ⇒ Mdm::VulnAttempt
Vulnerability attempt that created this session.
      66 67 68  | 
    
      # File 'app/models/mdm/session.rb', line 66 has_one :vuln_attempt, class_name: 'Mdm::VulnAttempt', inverse_of: :session  | 
  
#workspace ⇒ Mdm::Workspace (readonly)
The workspace in which this session exists.
      78  | 
    
      # File 'app/models/mdm/session.rb', line 78 has_one :workspace, :through => :host, :class_name => 'Mdm::Workspace'  | 
  
Instance Method Details
#upgradeable? ⇒ true, false
Returns whether the session can be upgraded to a meterpreter session from a shell session on Windows.
      185 186 187 188 189 190 191  | 
    
      # File 'app/models/mdm/session.rb', line 185 def upgradeable? if (self.platform =~ /win/i and self.stype == 'shell') return true else return false end end  |