Commit graph

4515 commits

Author SHA1 Message Date
Robin Sommer
e8292be0ce
Merge remote-tracking branch 'origin/topic/robin/spicy-export-extensions'
* origin/topic/robin/spicy-export-extensions:
  [Spicy] Clean up representation of EVT record fields.
  [Spicy] Extend functionality of `export` in EVT files.
  [Spicy] Refactor parsing of `export` in EVT files.
2023-08-22 15:04:05 +02:00
Robin Sommer
cdadd934ce
[Spicy] Extend functionality of export in EVT files.
We now support selecting which fields of a unit type get exported into
the automatically created Zeek record; as well as selecting which
fields get a `&log` attribute added automatically to either all fields
or to selected fields.

Syntax:

- To export only selected fields:

    export Foo::X with { field1, field3 };

- To export all but selected fields:

    export Foo::X without { field2, field3 };

- To `&log` all fields:

    export Foo::X &log;

- To `&log` only selected fields:

    export Foo::X with { field1 &log, field3 }; # exports (only) field1 and field3, and marks field1 for logging

Syntax is still subject to change.

Closes #3218.
Closes #3219.
2023-08-21 10:26:25 +02:00
Tim Wojtulewicz
e8ef169b27 Merge remote-tracking branch 'origin/topic/timw/3059-set-vector-conversion'
* origin/topic/timw/3059-set-vector-conversion:
  Fix conversion with record types
  Add conversion between set and vector using 'as' keyword
  Add std::move for a couple of variables passed by value
2023-08-11 10:35:06 -07:00
Tim Wojtulewicz
fe9926e538 Fix conversion with record types 2023-08-10 13:42:23 -07:00
Tim Wojtulewicz
af9e852c28 Add conversion between set and vector using 'as' keyword 2023-08-09 14:41:54 -07:00
Tim Wojtulewicz
1dc9235cee Pass parsed file record information with ReadFile/WriteFile events 2023-08-07 13:44:38 -07:00
Tim Wojtulewicz
18fd384469 Add length field from header to ModbusHeaders record type 2023-08-07 13:44:37 -07:00
Tim Wojtulewicz
406a406813 Modbus: Add support for Encapsulation Interface Transport (FC=2B) requests and responses 2023-08-07 13:44:37 -07:00
Tim Wojtulewicz
f14be0de29 Modbus: Add support for Diagnostics (FC=8) requests and responses 2023-08-07 13:44:37 -07:00
Arne Welzel
431767d04b Add &default_insert attribute for tables
This is based on the discussion in zeek/zeek#2668. Using &default with tables
can be confusing as the default value is not inserted. The following example
prints an empty table at the end even new Service records was instantiated.

    type Service: record {
        occurrences: count &default=0;
        last_seen: time &default=network_time();
    };

    global services: table[string] of Service &default=Service();

    event zeek_init()
        {
        services["http"]$occurrences += 1;
        services["http"]$last_seen = network_time();

        print services;
        }

Changing above &default to &default_insert will insert the newly created
default value upon a missed lookup and act less surprising.

Other examples that caused confusion previously revolved around table of sets
 or table of vectors and `add` or `+=` not working as expected.

    tbl_of_vector["http"] += 1
    add tbl_of_set["http"][1];
2023-08-04 12:30:36 +02:00
Johanna Amann
81ce83590d Merge remote-tracking branch 'origin/topic/johanna/tcp-padding'
* origin/topic/johanna/tcp-padding:
  Do not forward padding to downstream TCP packet analyzer
2023-08-03 07:18:49 +01:00
Johanna Amann
940e3afab4 Do not forward padding to downstream TCP packet analyzer
This is similar to GH-3206. There do not seem to be practical
consequences - but we should still fix it.

This also includes the udp-testcase that was forgotten in GH-3206.
2023-08-02 17:17:01 +01:00
Arne Welzel
ab388844bf UsageAnalyzer: Collect identifiers found in attributes as seeds
This marks every identifier used within an attribute as seeds. The scenario
this avoids is functions referenced through attributes on unused tables or
record types (&default, &expire_func, ...) being dinged as unused as
that's rather confusing.

Also adds test for the above and a light smoke test into language/ as it
doesn't appear we had coverage here.

Closes #3122
2023-08-01 15:46:10 +02:00
Johanna Amann
a391367c36 Do not forward more than the remaining data to downstream UDP analyzer
This fixes a bug introduced in 2b9de839b0
/ GH-3080, which causes UDP padding to be sent to UDP based analyzers.

Fixes GH-3205.
2023-07-27 13:35:41 +01:00
Tim Wojtulewicz
bd75d72f3f Merge remote-tracking branch 'origin/topic/vern/zam-memory-reduction'
* origin/topic/vern/zam-memory-reduction:
  Baseline "-a zam" update
  increase BTest wait time to abide ZAM compilation times
  avoid script coverage overhead (especially memory) when using ZAM
  fixes for correctly tracking which functions have been fully inlined
  support for discarding ASTs once compiled via ZAM script optimization
  some code simplifications and streamlining
2023-07-26 14:46:23 -07:00
Vern Paxson
ed75b82b3b Baseline "-a zam" update 2023-07-26 13:32:00 -07:00
Vern Paxson
35a6efbfa7 increase BTest wait time to abide ZAM compilation times 2023-07-26 13:32:00 -07:00
Johanna Amann
33d6e1a011 Better input framework error messages for unset non-optionals
The input framework currently gives a rather opaque error message when
encountering a line in which a required value is not provided. This
change updates this behavior; the error message now provides the record
element (or the name or the index element) which was not set in the
input data, even though it is required to be set by the underlying Zeek
type.
2023-07-21 15:11:31 +01:00
Tim Wojtulewicz
0e40f7e6af More test updates for opaqueval changes 2023-07-20 14:01:33 -07:00
Tim Wojtulewicz
5b74e717bc Fix plugin.hooks test for opaque-printing change 2023-07-20 10:43:36 -07:00
Tim Wojtulewicz
1f39a33442 Merge remote-tracking branch 'origin/topic/vern/ZAM-maint.Jul23'
* origin/topic/vern/ZAM-maint.Jul23:
  ZAM btest baseline update
  more extensive ZAM inlining & compilation of lambdas
  fixes for ZAM compilation of switch statements
  fix for ZAM inlining failing to inline function call arguments
  avoid constructing TypeList's on-the-fly for ListVal's with fixed types
  ZAM optimization for ?$ operator applied to non-optional fields
  ASSERT seatbelts for low-level vector accesses
  comment typo
  low-level ZAM micro-optimizations
  fix for recent smart pointer change
2023-07-17 16:33:46 -07:00
Vern Paxson
57e5d1462e ZAM btest baseline update 2023-07-17 16:31:31 -07:00
Vern Paxson
bf6d030894 -a cpp Btest baseline updates 2023-07-13 13:11:26 -07:00
Vern Paxson
42697d72f2 minor BTest generalizations & simplifications 2023-07-13 13:10:14 -07:00
Arne Welzel
b6bff8aa37 Merge remote-tracking branch 'origin/topic/awelzel/2709-colon-colon-for-global'
* origin/topic/awelzel/2709-colon-colon-for-global:
  ci: Bust Ubuntu 22.10 image cache
  Support :: prefix to reference global namespace, deprecate GLOBAL::
2023-07-12 17:29:51 +02:00
Tim Wojtulewicz
f9904511ab Merge remote-tracking branch 'origin/topic/awelzel/3145-dcerpc-state-clean'
* origin/topic/awelzel/3145-dcerpc-state-clean:
  dce-rpc: Test cases for unbounded state growth
  dce-rpc: Handle smb2_close_request() in scripts
  smb/dce-rpc: Cleanup DCE-RPC analyzers when fid is closed and limit them
  dce-rpc: Do not repeatedly register removal hooks
2023-07-11 16:17:12 -07:00
Arne Welzel
12a5616f4d Support :: prefix to reference global namespace, deprecate GLOBAL::
Closes #2709
2023-07-11 12:51:21 +02:00
Robin Sommer
cd2c193cb2
Merge remote-tracking branch 'origin/topic/robin/gh-3157-export-switch'
* origin/topic/robin/gh-3157-export-switch:
  [Spicy] Support `switch` fields when exporting Spicy types to Zeek.
2023-07-07 11:46:29 +02:00
Arne Welzel
f00dac544e Merge remote-tracking branch 'origin/topic/vern/GH-3159.B'
* origin/topic/vern/GH-3159.B:
  Fix for nested "when" statements leading to confusion over scoping
2023-07-06 11:35:47 +02:00
Robin Sommer
65e5e739d0
[Spicy] Support switch fields when exporting Spicy types to Zeek.
Closes #3157.
2023-07-06 08:40:54 +02:00
Vern Paxson
a1d25670fc Fix for nested "when" statements leading to confusion over scoping 2023-07-05 17:10:38 -07:00
Tim Wojtulewicz
d1ed0e577b Merge remote-tracking branch 'origin/topic/awelzel/3028-connection-flipped'
* origin/topic/awelzel/3028-connection-flipped:
  Update dump-events baseline, not running with OpenSSL 3
  Conn: In-place val flip and connection_flipped()
  Conn: Remove is_version_sep()
  Remove icmp_conn leftovers
2023-07-05 13:32:34 -07:00
Arne Welzel
fe71202f25 Merge remote-tracking branch 'origin/topic/awelzel/global-ids-with-modules'
* origin/topic/awelzel/global-ids-with-modules:
  global_ids(): Include module names
2023-07-05 15:33:30 +02:00
Arne Welzel
4cde1c3c3f global_ids(): Include module names
Ad-hoc include module names in the global_ids() table. Table values will
have the type_name field set to "module" and their key in the table is
prefixed with "module " to avoid clashes with existing global identifiers
shadowing module names (Management::Node being an existing example).

Closes #3136
2023-07-05 14:09:20 +02:00
Arne Welzel
cbdeb4abf2 Update dump-events baseline, not running with OpenSSL 3 2023-07-05 10:25:14 +02:00
Arne Welzel
a2214ad611 Conn: In-place val flip and connection_flipped()
Avoids loosing state on a connection value when a connection is flipped.

Fixes up the NTP baseline as well where this was visible: analyzer_confirmation_info()
was raised for a connection value which was immediately forgotten due to
the subsequent connection flipping.

Closed #3028
2023-07-04 20:01:17 +02:00
Arne Welzel
23e9928ca2 dce-rpc: Test cases for unbounded state growth
Pcaps produced as shown in #3145 using a samba container and rpcclient.
2023-06-30 15:14:35 +02:00
Arne Welzel
ccfc68fccd Fixup external hashes modified during merge 2023-06-30 11:53:59 +02:00
Arne Welzel
fcc38d3b4f Merge remote-tracking branch 'origin/topic/vern/zam-feature-complete'
* origin/topic/vern/zam-feature-complete: (23 commits)
  documentation updates
  updates to ZAM-specific BTest baseline
  Address PR review feedback on zam-feature-complete
  Updates to BTest baselines due to previous BTest tweaks
  tweaks to BTests for ZAM feature completeness; new ZAM-only btest
  removal of unused functionality and some follow-on simplifications
  feature completeness for ZAM
  -O gen-C++ tweaks to be compatible with ZAM changes
  ZAM support for "when" statements
  ZAM changes intermixed with lambda and "when" support
  WhenStmt/WhenInfo restructuring in support of ZAM "when" statements
  ZAM support for lambdas
  ZAM internals have a notion of "captures" as global-like variables
  AST profiling enhnacements in support of script optimization for lambdas/whens
  refinements to LambdaExpr's to provide flexibility, support for ZVal captures
  support in ScriptFunc class for ZVal-oriented vector of captures
  simplifications to the Frame class now that it no longer has to support old-style captures
  use Ingredients directly for constructing functions
  the "Capture" struct is now a class
  more debugging information when dumping script optimization data structures
  ...
2023-06-30 10:19:44 +02:00
Vern Paxson
bd30baf42f updates to ZAM-specific BTest baseline 2023-06-30 09:59:29 +02:00
Vern Paxson
46d3526b40 Updates to BTest baselines due to previous BTest tweaks 2023-06-30 09:36:14 +02:00
Vern Paxson
a4cf10e34d tweaks to BTests for ZAM feature completeness; new ZAM-only btest 2023-06-30 09:36:14 +02:00
Arne Welzel
95529ef7c0 Add test with MUD example
This came up as a use-case on GitHub showing the limitations of the
opinionated approach. Add it as an example.

Reference https://www.rfc-editor.org/rfc/rfc8520#section-9
2023-06-29 15:57:52 +02:00
Arne Welzel
480d52ca1f from_json: Support function to normalize key names
When a JSON document contains key names containing colons or other
special characters that are not valid in Zeek identifiers, from_json()
cannot be used to parse such input.

This change allows a customizable normalization function.

Closes #3142.
2023-06-29 15:57:49 +02:00
Arne Welzel
b18122da08 Merge branch 'master' of https://github.com/progmboy/zeek
* 'master' of https://github.com/progmboy/zeek:
  fix http AUTHORIZATION base64 decode failed

Added a test during merge.
2023-06-27 18:21:34 +02:00
Arne Welzel
0b317aced3 telemetry: Disable metrics centralization by default
Move the telemetry/cluster.zeek file over into policy/frameworks/telemetry/prometheus.zeek.

Mention it in local.zeek.

Relates to zeek/broker#366.
2023-06-21 20:13:55 +02:00
Tim Wojtulewicz
24f184fd8a Update external testing hashes for 6.1 deprecation changes 2023-06-15 19:45:05 -07:00
Tim Wojtulewicz
c45015bcb7 Remove leftover baseline files from 6.1 deprecation removal 2023-06-15 19:45:05 -07:00
Tim Wojtulewicz
3ad0bee7a2 Update external testing repo hashes to current master commits 2023-06-15 16:27:17 -07:00
Tim Wojtulewicz
38a3385daa Merge remote-tracking branch 'origin/topic/vern/CPP-Jun23-maint'
* origin/topic/vern/CPP-Jun23-maint:
  -O gen-C++ refinements for BiF failures, negative vector indices, boolean vector operations
2023-06-15 16:25:58 -07:00