diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a557470b29..da07da7d62 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: language: python files: '\.(h|c|cpp|cc|spicy|evt)$' types: [file] - exclude: '^(testing/btest/(Baseline|plugins|spicy|scripts)/.*|testing/builtin-plugins/.*|src/3rdparty/.*)$' + exclude: '^(testing/btest/(Baseline|plugins|spicy|scripts)/.*|testing/builtin-plugins/.*|src/3rdparty/.*|doc/.*)$' - id: btest-command-commented name: Check that all BTest command lines are commented out diff --git a/doc/.typos.toml b/doc/.typos.toml index 0f3aee7a94..f54d93bcad 100644 --- a/doc/.typos.toml +++ b/doc/.typos.toml @@ -55,6 +55,7 @@ tha = "tha" uses_seh = "uses_seh" exat = "exat" EXAT = "EXAT" +tpe = "tpe" [default.extend-words] caf = "caf" diff --git a/doc/devel/plugins/connkey-vxlan-fivetuple-plugin-src/CMakeLists.txt b/doc/devel/plugins/connkey-vxlan-fivetuple-plugin-src/CMakeLists.txt index 541256ad8e..4a3e7c627b 100644 --- a/doc/devel/plugins/connkey-vxlan-fivetuple-plugin-src/CMakeLists.txt +++ b/doc/devel/plugins/connkey-vxlan-fivetuple-plugin-src/CMakeLists.txt @@ -5,10 +5,5 @@ project(ZeekPluginConnKeyVxlanVniFivetuple) include(ZeekPlugin) zeek_add_plugin( - Zeek - ConnKey_Vxlan_Vni_Fivetuple - SOURCES - src/Factory.cc - src/Plugin.cc - SCRIPT_FILES scripts/__load__.zeek -) + Zeek ConnKey_Vxlan_Vni_Fivetuple + SOURCES src/Factory.cc src/Plugin.cc SCRIPT_FILES scripts/__load__.zeek) diff --git a/doc/devel/plugins/event-metadata-plugin-src/CMakeLists.txt b/doc/devel/plugins/event-metadata-plugin-src/CMakeLists.txt index e27c17e0b7..c8362b96f1 100644 --- a/doc/devel/plugins/event-metadata-plugin-src/CMakeLists.txt +++ b/doc/devel/plugins/event-metadata-plugin-src/CMakeLists.txt @@ -5,9 +5,5 @@ project(ZeekPluginEventLatency) include(ZeekPlugin) zeek_add_plugin( - Zeek - EventLatency - SOURCES - src/Plugin.cc - SCRIPT_FILES scripts/__load__.zeek -) + Zeek EventLatency + SOURCES src/Plugin.cc SCRIPT_FILES scripts/__load__.zeek) diff --git a/doc/devel/spicy/autogen-spicy-docs b/doc/devel/spicy/autogen-spicy-docs index e09044fffe..9b74aacec7 100755 --- a/doc/devel/spicy/autogen-spicy-docs +++ b/doc/devel/spicy/autogen-spicy-docs @@ -22,7 +22,7 @@ fi set -o errexit set -o nounset -ZEEK="$(cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)/../../.." +ZEEK="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)/../../.." DOC="${ZEEK}/doc" SPICY="${ZEEK}/auxil/spicy" SPICYDOC="${ZEEK}/build/auxil/spicy/bin/spicy-doc" @@ -33,16 +33,15 @@ if [ ! -x "${SPICYDOC}" ]; then exit 0 fi -"${SPICY}/doc/scripts/autogen-spicy-lib" functions zeek < "${ZEEK}/scripts/spicy/zeek.spicy" > "${AUTOGEN_FINAL}/zeek-functions.spicy" || exit 1 +"${SPICY}/doc/scripts/autogen-spicy-lib" functions zeek <"${ZEEK}/scripts/spicy/zeek.spicy" >"${AUTOGEN_FINAL}/zeek-functions.spicy" || exit 1 # Copy some static files over. cp "${TFTP}"/scripts/main.zeek "${AUTOGEN_FINAL}"/tftp.zeek || exit 1 cp "${TFTP}"/analyzer/tftp.spicy "${AUTOGEN_FINAL}"/tftp.spicy || exit 1 cp "${TFTP}"/analyzer/tftp.evt "${AUTOGEN_FINAL}"/tftp.evt || exit 1 -cat "${TFTP}"/analyzer/tftp.spicy | grep -v spicy::accept_input > "${AUTOGEN_FINAL}"/tftp-no-accept.spicy || exit 1 +cat "${TFTP}"/analyzer/tftp.spicy | grep -v spicy::accept_input >"${AUTOGEN_FINAL}"/tftp-no-accept.spicy || exit 1 # Copy some files from the Zeek source tree so that zeek-docs remains standaline for CI. cp "${ZEEK}/scripts/base/frameworks/spicy/init-bare.zeek" "${AUTOGEN_FINAL}/" cp "${ZEEK}/scripts/base/frameworks/spicy/init-framework.zeek" "${AUTOGEN_FINAL}/" cp "${ZEEK}/auxil/spicy/doc/scripts/spicy-pygments.py" "${DOC}/ext" - diff --git a/doc/devel/spicy/autogen/tftp-no-accept.spicy b/doc/devel/spicy/autogen/tftp-no-accept.spicy index 07b7c39e3f..20c27685d4 100644 --- a/doc/devel/spicy/autogen/tftp-no-accept.spicy +++ b/doc/devel/spicy/autogen/tftp-no-accept.spicy @@ -15,15 +15,16 @@ import spicy; # | TFTP Opcode | # --------------- -public type Packet = unit { # public top-level entry point for parsing +public type Packet = unit { + # public top-level entry point for parsing op: uint16 &convert=Opcode($$); - switch ( self.op ) { - Opcode::RRQ -> rrq: Request(True); - Opcode::WRQ -> wrq: Request(False); - Opcode::DATA -> data: Data; - Opcode::ACK -> ack: Acknowledgement; + switch (self.op) { + Opcode::RRQ -> rrq: Request(True); + Opcode::WRQ -> wrq: Request(False); + Opcode::DATA -> data: Data; + Opcode::ACK -> ack: Acknowledgement; Opcode::ERROR -> error: Error; - }; + }; }; # TFTP supports five types of packets [...]: @@ -39,7 +40,7 @@ type Opcode = enum { WRQ = 0x02, DATA = 0x03, ACK = 0x04, - ERROR = 0x05 + ERROR = 0x05, }; # Figure 5-1: RRQ/WRQ packet @@ -51,8 +52,7 @@ type Opcode = enum { type Request = unit(is_read: bool) { filename: bytes &until=b"\x00"; - mode: bytes &until=b"\x00"; - + mode: bytes &until=b"\x00"; }; # Figure 5-2: DATA packet @@ -63,7 +63,7 @@ type Request = unit(is_read: bool) { # ---------------------------------- type Data = unit { - num: uint16; + num: uint16; data: bytes &eod; }; @@ -87,5 +87,5 @@ type Acknowledgement = unit { type Error = unit { code: uint16; - msg: bytes &until=b"\x00"; + msg: bytes &until=b"\x00"; }; diff --git a/doc/devel/spicy/autogen/tftp.spicy b/doc/devel/spicy/autogen/tftp.spicy index 7927c6e90c..264b8bdc2e 100644 --- a/doc/devel/spicy/autogen/tftp.spicy +++ b/doc/devel/spicy/autogen/tftp.spicy @@ -15,15 +15,16 @@ import spicy; # | TFTP Opcode | # --------------- -public type Packet = unit { # public top-level entry point for parsing +public type Packet = unit { + # public top-level entry point for parsing op: uint16 &convert=Opcode($$); - switch ( self.op ) { - Opcode::RRQ -> rrq: Request(True); - Opcode::WRQ -> wrq: Request(False); - Opcode::DATA -> data: Data; - Opcode::ACK -> ack: Acknowledgement; + switch (self.op) { + Opcode::RRQ -> rrq: Request(True); + Opcode::WRQ -> wrq: Request(False); + Opcode::DATA -> data: Data; + Opcode::ACK -> ack: Acknowledgement; Opcode::ERROR -> error: Error; - }; + }; }; # TFTP supports five types of packets [...]: @@ -39,7 +40,7 @@ type Opcode = enum { WRQ = 0x02, DATA = 0x03, ACK = 0x04, - ERROR = 0x05 + ERROR = 0x05, }; # Figure 5-1: RRQ/WRQ packet @@ -51,9 +52,11 @@ type Opcode = enum { type Request = unit(is_read: bool) { filename: bytes &until=b"\x00"; - mode: bytes &until=b"\x00"; + mode: bytes &until=b"\x00"; - on %done { spicy::accept_input(); } + on %done { + spicy::accept_input(); + } }; # Figure 5-2: DATA packet @@ -64,7 +67,7 @@ type Request = unit(is_read: bool) { # ---------------------------------- type Data = unit { - num: uint16; + num: uint16; data: bytes &eod; }; @@ -88,5 +91,5 @@ type Acknowledgement = unit { type Error = unit { code: uint16; - msg: bytes &until=b"\x00"; + msg: bytes &until=b"\x00"; }; diff --git a/doc/devel/spicy/autogen/zeek-functions.spicy b/doc/devel/spicy/autogen/zeek-functions.spicy index 53126ad50f..3eca1c67fc 100644 --- a/doc/devel/spicy/autogen/zeek-functions.spicy +++ b/doc/devel/spicy/autogen/zeek-functions.spicy @@ -733,4 +733,3 @@ id: fully-qualified name of the global Zeek vector to check Returns the size of a Zeek vector. v: opaque handle to the Zeek vector, as returned by other functions - diff --git a/doc/devel/spicy/examples/my-http.spicy b/doc/devel/spicy/examples/my-http.spicy index a11b30402e..831c0f9bf4 100644 --- a/doc/devel/spicy/examples/my-http.spicy +++ b/doc/devel/spicy/examples/my-http.spicy @@ -3,24 +3,24 @@ module MyHTTP; -const Token = /[^ \t\r\n]+/; +const Token = /[^ \t\r\n]+/; const WhiteSpace = /[ \t]+/; -const NewLine = /\r?\n/; +const NewLine = /\r?\n/; type Version = unit { - : /HTTP\//; + : /HTTP\//; number: /[0-9]+\.[0-9]+/; }; public type RequestLine = unit { - method: Token; - : WhiteSpace; - uri: Token; - : WhiteSpace; + method: Token; + : WhiteSpace; + uri: Token; + : WhiteSpace; version: Version; - : NewLine; + : NewLine; on %done { print self.method, self.uri, self.version.number; - } + } }; diff --git a/doc/frameworks/packet-analysis-2-llc.cc b/doc/frameworks/packet-analysis-2-llc.cc index 4d72b7cf9e..aa980b39de 100644 --- a/doc/frameworks/packet-analysis-2-llc.cc +++ b/doc/frameworks/packet-analysis-2-llc.cc @@ -1,23 +1,18 @@ -bool LLCDemo::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet) - { - // Rudimentary parsing of 802.2 LLC - if ( 17 >= len ) - { - packet->Weird("truncated_llc_header"); - return false; - } +bool LLCDemo::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet) { + // Rudimentary parsing of 802.2 LLC + if ( 17 >= len ) { + packet->Weird("truncated_llc_header"); + return false; + } - if ( ! llc_demo_message ) - return true; + if ( ! llc_demo_message ) + return true; - auto dsap = data[14]; - auto ssap = data[15]; - auto control = data[16]; + auto dsap = data[14]; + auto ssap = data[15]; + auto control = data[16]; - event_mgr.Enqueue(llc_demo_message, - val_mgr->Count(dsap), - val_mgr->Count(ssap), - val_mgr->Count(control)); + event_mgr.Enqueue(llc_demo_message, val_mgr->Count(dsap), val_mgr->Count(ssap), val_mgr->Count(control)); - return true; - } + return true; +}