A session is the logical unit of user connections: it starts with logging in to the target, and ends when the connection ends.
SPS executes the
session_id hook when the session is closed. It is called exactly once for the same session.
TIP: You can use this hook to send a log message related to the entire session or close the ticket related to the session if the plugin interacts with a ticketing system.
You must implement the session_ended method in the plugin.
This hook does not return values.
The following example formats every information received in the cookie into key-value pairs and prints a log message that includes this information.
Key-value pairs in log message
def session_ended(self, session_id, session_cookie, cookie):
session_details = ','.join([
'{0}={1}'.format(key, cookie[key])
for key in sorted(cookie.keys())
])
print("Session ended; session_id='{0}', session_details='{1}'".
format(session_id, session_details))