-
Notifications
You must be signed in to change notification settings - Fork 24
/
livecheck.bro
executable file
·50 lines (40 loc) · 1.25 KB
/
livecheck.bro
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
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Initial Developer of the Original Code is
# Mozilla Corporation
# Portions created by the Initial Developer are Copyright (C) 2014
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Michal Purzynski [email protected]
@load base/frameworks/notice
module MozillaAlive;
export {
redef enum Notice::Type += {
Bro_Is_Watching_You,
};
global wpad_dat_sum: set[string] &redef;
}
event MozillaAlive::check()
{
local message = current_time() - network_time();
NOTICE([$note=Bro_Is_Watching_You,
$msg=fmt("Aliveness check succeeded"),
$sub=fmt("falling behind by %s", cat(message))]);
schedule 5mins { MozillaAlive::check() };
}
function start_liveness_check()
{
schedule 5mins { MozillaAlive::check() };
}
event bro_init()
{
start_liveness_check();
}