Created
July 15, 2014 16:59
-
-
Save sethhall/cc16e3829c86ac342388 to your computer and use it in GitHub Desktop.
bro website watcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redef exit_only_after_terminate = T; | |
module BroExchangeWatch; | |
export { | |
redef enum Notice::Type += { | |
Woo, | |
}; | |
} | |
# We store the current etag here so we can watch for it to change. | |
global current_etag = ""; | |
event check_website() | |
{ | |
when ( local resp = ActiveHTTP::request([$url="http://www.bro.org/community/exchange2013.html"]) ) | |
{ | |
if ( current_etag == "" ) | |
current_etag = resp$headers["ETag"]; | |
if ( current_etag != resp$headers["ETag"] ) | |
{ | |
print "Bro Exchange 2013 webpage updated!"; | |
NOTICE([$note=BroExchangeWatch::Woo, | |
$msg=fmt("Are the videos posted?")]); | |
} | |
schedule 30secs { check_website() }; | |
} | |
timeout 1min | |
{ | |
schedule 30secs { check_website() }; | |
} | |
} | |
event bro_init() | |
{ | |
event check_website(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment