Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/msf/ui/console/framework_event_manager.rb
Views: 11783
# -*- coding: binary -*-1module Msf2module Ui3module Console45###6#7# Handles events of various types that are sent from the framework.8#9###10module FrameworkEventManager1112include Msf::SessionEvent1314#15# Subscribes to the framework as a subscriber of various events.16#17def register_event_handlers18framework.events.add_session_subscriber(self)19end2021#22# Unsubscribes from the framework.23#24def deregister_event_handlers25framework.events.remove_session_subscriber(self)26end2728#29# Called when a session is registered with the framework.30#31def on_session_open(session)32select(nil,nil,nil,0.125) # Give the session time enough to register itself properly.33output.print_status("#{session.desc} session #{session.name} opened (#{session.tunnel_to_s}) at #{Time.now}")34if (Msf::Logging.session_logging_enabled? == true)35Msf::Logging.start_session_log(session)36end37end3839def on_session_fail(reason='')40end4142#43# Called when a session is closed and removed from the framework.44#45def on_session_close(session, reason='')46if (session.interacting == true)47output.print_line48end4950# If logging had been enabled for this session, stop it now.51Msf::Logging::stop_session_log(session)5253msg = "#{session.session_host} - #{session.desc} session #{session.name} closed."54if reason and reason.length > 055msg << " Reason: #{reason}"56end57output.print_status(msg)58end5960end6162end63end64end65666768