This file is indexed.

/usr/lib/python2.7/dist-packages/PreludeNotify/threshold.py is in prelude-notify 0.9.1-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Copyright (C) 2008 PreludeIDS Technologies. All Rights Reserved.
# Author: Yoann Vandoorselaere <yoann.v@prelude-ids.com>
#
# This file is part of the Prelude-Notify program.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

import gobject

class ThresholdItem:
    pass

class Threshold:
    def __init__(self, threshold_timeout, expire_cb):
        self._limited = { }
        self._expire_cb = expire_cb
        self._limit_path = [ "alert.source(*).node.address(*).address", "alert.classification.text" ]
        self.setExpire(threshold_timeout)

    def _timer_cb(self, item):
        self._limited.pop(item.key)
        self._expire_cb(item)
        return False

    def _setTimer(self, item):
        item.timer = gobject.timeout_add(self._timeout, self._timer_cb, item)

    def _newEntry(self, key, idmef):
        item = self._limited[key] = ThresholdItem()
        item.key = key
        item.count = 1
        item.idmef = idmef
        item.messageid = [ idmef.Get("alert.messageid") ]
        self._setTimer(item)

    def _updateEntry(self, key, idmef):
        item = self._limited[key]
        item.count = item.count + 1
        item.messageid.append(idmef.Get("alert.messageid"))

        gobject.source_remove(item.timer)
        self._setTimer(item)

    def setExpire(self, threshold_timeout):
        self._timeout = int(threshold_timeout) * 1000

    def thresholdMessage(self, idmef):
        rl = []

        for i in self._limit_path:
            rl += [idmef.Get(i)]

        key = str(rl)
        if self._limited.has_key(key):
            self._updateEntry(key, idmef)
        else:
            self._newEntry(key, idmef)