Skip to content

Instantly share code, notes, and snippets.

@jsiwek
jsiwek / print-log-info.bro
Last active October 30, 2019 21:06
Prints out field descriptions of all logs generated by Bro/Zeek.
# Prints out field descriptions of all logs generated by Zeek 3.0+.
#
# * Set environment variable ZEEK_ALLOW_INIT_ERRORS=1 before running Zeek
# with this script.
#
# * Requires a version of Bro/Zeek with the improvements from:
# https://github.com/bro/bro/commit/1f450c05102be6dd7ebcc2c5901d5a3a231cd675
# (Was not included in 2.6 release)
@load zeekygen
@jsiwek
jsiwek / caf_timeout.cc
Created November 6, 2014 17:11
Testing the "after" pattern of actor-framework
#include <caf/all.hpp>
#include <unistd.h>
#include <sys/time.h>
using namespace std;
using namespace caf;
double now()
{
struct timeval tv;
@jsiwek
jsiwek / scoped_actor_example.cc
Created November 5, 2014 20:20
Example scoped_actor usage from actor-framework.
#include <caf/all.hpp>
#include <unistd.h>
using namespace std;
using namespace caf;
struct foo {
actor a;
@jsiwek
jsiwek / ssh-login-watch.bro
Created August 5, 2014 14:47
ssh-login-watch.bro
@load base/frameworks/notice
@load base/protocols/ssh
module SSH;
export {
const watched_servers: set[addr] = {
192.168.1.100,
192.168.1.101,
192.168.1.102,
@jsiwek
jsiwek / receiver.bro
Created March 12, 2014 15:46
Example of exchanging events between Bro instances.
@load frameworks/communication/listen
redef Communication::listen_port = 1337/tcp;
redef Communication::nodes += {
["foo"] = [$host = 127.0.0.1, $events = /my_event_request/, $connect = F]
};
event remote_connection_handshake_done(p: event_peer)
{
@jsiwek
jsiwek / sender.bro
Created March 12, 2014 15:45
Example of exchanging events between Bro instances.
redef Communication::nodes += {
["foo"] = [$host = 127.0.0.1, $p=1337/tcp, $events = /my_event_response/, $connect=T]
};
event my_event_request(details: string)
{
print "sent my_event_request", details;
}
event my_event_response(details: count)
@jsiwek
jsiwek / so-gethostname.bro
Created August 13, 2013 15:03
Revision to Security Onion's method of obtaining hostname.
module SecurityOnion;
@load base/frameworks/input
export {
## Event to capture when the hostname is discovered.
global SecurityOnion::found_hostname: event(hostname: string);
## Hostname for this box.
global hostname = "";