Skip to content

Instantly share code, notes, and snippets.

@sethhall
Created July 15, 2014 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sethhall/cc16e3829c86ac342388 to your computer and use it in GitHub Desktop.
Save sethhall/cc16e3829c86ac342388 to your computer and use it in GitHub Desktop.
bro website watcher
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