shellbot.commands.audit module

class shellbot.commands.audit.Audit(engine=None, **kwargs)[source]

Bases: shellbot.commands.base.Command

Checks and changes audit status

In essence, audit starts with the capture of information in real-time, and continues with the replication of information.

A typical use case is the monitoring of interactions happening in a channel, for security reasons, for compliancy or, simply speaking, for traceability.

Audit can be suspended explicitly by channel participants. This allows for some private exchanges that are not audited at all. However, then command is put in the audit log itself, so that people can be queried afterwards on their private interactions. If the parameter off_duration is set, then it is used by a watchdog to restart auditing. Else it is up to channel participants to activate or to de-activate auditing, at will.

The command itself allows for suspending or restarting the audit process. When audit has been activated in a channel, the attribute audit.switch.<channel_id> is set to on in the context. This can be checked by the observer while handling inbound records.

The audit has to be armed beforehand, and this is checked from the context attribute audit.has_been_armed. In normal cases, audit is armed from the underlying space by setting this attribute to True.

audit_off(bot)[source]

Activates private mode

Parameters:bot (Shellbot) – The bot for this execution
audit_on(bot)[source]

Activates audit mode

Parameters:bot (Shellbot) – The bot for this execution
audit_status(bot)[source]

Reports on audit status

Parameters:bot (Shellbot) – The bot for this execution
execute(bot, arguments=None, **kwargs)[source]

Checks and changes audit status

Parameters:
  • bot (Shellbot) – The bot for this execution
  • arguments (str) – either ‘on’ or ‘off’
has_been_enabled

Are we ready for auditing or not?

Return type:bool
in_direct = False
off_duration = 60
on_bond(bot)[source]

Activates audit when a bot joins a channel

on_init()[source]

Localize strings for this command and register event

on_off(bot)[source]

Triggers watchdog when audit is disabled

watchdog(bot)[source]

Ensures that audit is restarted