Module: Msf::Ui::Console::FrameworkEventManager
- Includes:
- SessionEvent
- Included in:
- Driver
- Defined in:
- lib/msf/ui/console/framework_event_manager.rb
Overview
Handles events of various types that are sent from the framework.
Instance Method Summary collapse
-
#deregister_event_handlers ⇒ Object
Unsubscribes from the framework.
-
#on_session_close(session, reason = '') ⇒ Object
Called when a session is closed and removed from the framework.
- #on_session_fail(reason = '') ⇒ Object
-
#on_session_open(session) ⇒ Object
Called when a session is registered with the framework.
-
#register_event_handlers ⇒ Object
Subscribes to the framework as a subscriber of various events.
Methods included from SessionEvent
#on_session_command, #on_session_download, #on_session_filedelete, #on_session_interact, #on_session_output, #on_session_upload
Instance Method Details
#deregister_event_handlers ⇒ Object
Unsubscribes from the framework.
25 26 27 |
# File 'lib/msf/ui/console/framework_event_manager.rb', line 25 def deregister_event_handlers framework.events.remove_session_subscriber(self) end |
#on_session_close(session, reason = '') ⇒ Object
Called when a session is closed and removed from the framework.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/msf/ui/console/framework_event_manager.rb', line 46 def on_session_close(session, reason='') if (session.interacting == true) output.print_line end # If logging had been enabled for this session, stop it now. Msf::Logging::stop_session_log(session) msg = "#{session.session_host} - #{session.desc} session #{session.name} closed." if reason and reason.length > 0 msg << " Reason: #{reason}" end output.print_status(msg) end |
#on_session_fail(reason = '') ⇒ Object
40 41 |
# File 'lib/msf/ui/console/framework_event_manager.rb', line 40 def on_session_fail(reason='') end |
#on_session_open(session) ⇒ Object
Called when a session is registered with the framework.
32 33 34 35 36 37 38 |
# File 'lib/msf/ui/console/framework_event_manager.rb', line 32 def on_session_open(session) select(nil,nil,nil,0.125) # Give the session time enough to register itself properly. output.print_status("#{session.desc} session #{session.name} opened (#{session.tunnel_to_s}) at #{Time.now}") if (Msf::Logging.session_logging_enabled? == true) Msf::Logging.start_session_log(session) end end |
#register_event_handlers ⇒ Object
Subscribes to the framework as a subscriber of various events.
18 19 20 |
# File 'lib/msf/ui/console/framework_event_manager.rb', line 18 def register_event_handlers framework.events.add_session_subscriber(self) end |