evennia.contrib.utils.auditing.server

Auditable Server Sessions: Extension of the stock ServerSession that yields objects representing user inputs and system outputs.

Evennia contribution - Johnny 2017

class evennia.contrib.utils.auditing.server.AuditedServerSession[源代码]

基类:evennia.server.serversession.ServerSession

This particular implementation parses all server inputs and/or outputs and passes a dict containing the parsed metadata to a callback method of your creation. This is useful for recording player activity where necessary for security auditing, usage analysis or post-incident forensic discovery.

* WARNING * All strings are recorded and stored in plaintext. This includes those strings which might contain sensitive data (create, connect, @password). These commands have their arguments masked by default, but you must mask or mask any custom commands of your own that handle sensitive information.

See README.md for installation/configuration instructions.

audit(**kwargs)[源代码]

Extracts messages and system data from a Session object upon message send or receive.

关键字参数
  • src (str) – Source of data; ‘client’ or ‘server’. Indicates direction.

  • text (str or list) – Client sends messages to server in the form of lists. Server sends messages to client as string.

返回

log (dict)

Dictionary object containing parsed system and user data

related to this message.

mask(msg)[源代码]

Masks potentially sensitive user information within messages before writing to log. Recording cleartext password attempts is bad policy.

参数

msg (str) – Raw text string sent from client <-> server

返回

msg (str) – Text string with sensitive information masked out.

data_out(**kwargs)[源代码]

Generic hook for sending data out through the protocol.

关键字参数

kwargs (any) – Other data to the protocol.

data_in(**kwargs)[源代码]

Hook for protocols to send incoming data to the engine.

关键字参数

kwargs (any) – Other data from the protocol.