Last active
December 22, 2015 20:39
-
-
Save grigorescu/6527829 to your computer and use it in GitHub Desktop.
Add ASN to Bro's conn.log
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
##! Add ASNs for the originator and responder of a connection | |
##! to the connection logs. | |
module Conn; | |
export { | |
redef record Conn::Info += { | |
## ASN for the originator of the connection based | |
## on a GeoIP lookup. | |
orig_asn: string &optional &log; | |
## ASN for the responser of the connection based | |
## on a GeoIP lookup. | |
resp_asn: string &optional &log; | |
}; | |
} | |
event connection_state_remove(c: connection) | |
{ | |
local orig_asn = lookup_asn(c$id$orig_h); | |
if ( orig_asn != 0 ) | |
c$conn$orig_cc = orig_asn; | |
local resp_asn = lookup_asn(c$id$resp_h); | |
if ( resp_asn != 0 ) | |
c$conn$resp_cc = resp_asn; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment