Пример #1
0
    def __enter__(self):
        # Is ESC supported?
        if IS_ESC_SUPPORT_ENABLED:
            tmp = self._variables.copy()

            for variable, value in tmp.items():
                if isinstance(value, (list, tuple)):
                    tmp[variable] = ','.join([str(x) for x in value])

            self._tmp = current_event_vars.copy()
            current_event_vars.clear()
            current_event_vars.update(tmp)
            current_event_vars['es_event'] = self._name

            userid = current_event_vars.get('userid')

            if userid:
                fill_event_vars(userid, 'user')

            attacker = current_event_vars.get('attacker')

            if attacker:
                fill_event_vars(attacker, 'attacker')

        return self
Пример #2
0
    def __exit__(self, exc_type, exc_val, exc_tb):
        # Is ESC supported?
        if IS_ESC_SUPPORT_ENABLED:
            current_event_vars.clear()
            current_event_vars.update(self._tmp)

            self._tmp = None