Fix some scripting tutorial examples

Some of the examples in the scripting tutorial were regularly getting
out of sync with the base scripts (because the line numbering would need
to be updated).  Fixed this maintenance burden by using small example
scripts instead of actual Bro scripts.  These small example scripts
do not need to be kept in sync with the bro base scripts.
This commit is contained in:
Daniel Thayer 2016-05-05 17:23:15 -05:00
parent 2d9127888f
commit f596d30386
7 changed files with 38 additions and 8 deletions

View file

@ -0,0 +1,25 @@
module Conn;
export {
## The record type which contains column fields of the connection log.
type Info: record {
ts: time &log;
uid: string &log;
id: conn_id &log;
proto: transport_proto &log;
service: string &log &optional;
duration: interval &log &optional;
orig_bytes: count &log &optional;
resp_bytes: count &log &optional;
conn_state: string &log &optional;
local_orig: bool &log &optional;
local_resp: bool &log &optional;
missed_bytes: count &log &default=0;
history: string &log &optional;
orig_pkts: count &log &optional;
orig_ip_bytes: count &log &optional;
resp_pkts: count &log &optional;
resp_ip_bytes: count &log &optional;
tunnel_parents: set[string] &log;
};
}

View file

@ -0,0 +1,7 @@
module HTTP;
export {
## This setting changes if passwords used in Basic-Auth are captured or
## not.
const default_capture_password = F &redef;
}

View file

@ -362,8 +362,7 @@ decrypted from HTTP streams is stored in
:bro:see:`HTTP::default_capture_password` as shown in the stripped down
excerpt from :doc:`/scripts/base/protocols/http/main.bro` below.
.. btest-include:: ${BRO_SRC_ROOT}/scripts/base/protocols/http/main.bro
:lines: 9-11,20-22,125
.. btest-include:: ${DOC_ROOT}/scripting/http_main.bro
Because the constant was declared with the ``&redef`` attribute, if we
needed to turn this option on globally, we could do so by adding the
@ -825,8 +824,7 @@ example of the ``record`` data type in the earlier sections, the
:bro:type:`Conn::Info`, which corresponds to the fields logged into
``conn.log``, is shown by the excerpt below.
.. btest-include:: ${BRO_SRC_ROOT}/scripts/base/protocols/conn/main.bro
:lines: 10-12,16-17,19,21,23,25,28,31,35,38,57,63,69,75,98,101,105,108,112,116-117,122
.. btest-include:: ${DOC_ROOT}/scripting/data_type_record.bro
Looking at the structure of the definition, a new collection of data
types is being defined as a type called ``Info``. Since this type

View file

@ -1,6 +1,6 @@
# @TEST-EXEC: cat %INPUT >output && btest-diff output
main.bro
data_type_record.bro
module Conn;

View file

@ -1,6 +1,6 @@
# @TEST-EXEC: cat %INPUT >output && btest-diff output
main.bro
http_main.bro
module HTTP;

View file

@ -1,6 +1,6 @@
# @TEST-EXEC: cat %INPUT >output && btest-diff output
main.bro
data_type_record.bro
module Conn;

View file

@ -1,6 +1,6 @@
# @TEST-EXEC: cat %INPUT >output && btest-diff output
main.bro
http_main.bro
module HTTP;