Connor Borchgrevink
unread,Jul 12, 2016, 5:24:06 PM7/12/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to security-onion
I recently began poking around Bro and had my first attempt of writing a script. The purpose of it was to detect whether or not traffic on port 443 used SSL. After finishing the code I ran broctl, and deployed it with no errors. Now nothing is happening with the notifications or the log that was supposed to be created. It is more than likely that its an error with my code, but maybe you all can help out. The code is as follows (be warned its pretty rough):
@load base/protocols/ssl
@load base/frameworks/notice
@load base/protocols/conn
@load base/utils/directions-and-hosts
module conn;
module Unencrypted_Traffic;
export {
redef enum Log::ID += { LOG };
redef enum Notice::Type += {
Unencrypted_Traffic
};
const List_of_Hosts = ALL_HOSTS &redef;
const Encryption = "SSL" &redef;
type Info: record {
ts: time &log;
src: addr &log;
dst: addr &log;
proto: string &log &optional;
};
global log_unencrypted_traffic:event(rec: Info);
}
event new_connection(c: connection) &priority=3
{
Log::create_stream(Unencrypted_Traffic::LOG, [$columns=Info, $ev=log_unencrypted_traffic, $path="Unencrypted Traffic"]);
if ( ! addr_matches_host(c$id$resp_h, List_of_Hosts) )
return;
local port_number=c$conn$id$resp_p;
local encrypted=c$conn$service;
local src =c$conn$id$resp_h;
local dst =c$conn$id$orig_h;
local proto =c$conn$proto;
if ( port_number != 443/tcp )
return;
if ( encrypted != Encryption )
Log::write(LOG, [$ts=network_time(), $src=src, $dst=dst, $proto=proto]);
NOTICE([$note=Unencrypted_Traffic,
$msg=fmt("Unencrypted traffic"),
$conn=c,
$identifier=cat(c$id$resp_h, c$id$resp_p)
]);
}
It is probably something I am not catching in my code or a limited knowledge of bro, but any help is much appreciated.
Thanks
Connor