Commit graph

10798 commits

Author SHA1 Message Date
Jon Siwek
9243341e8c Fix frame size allocation of alternate event/hook handlers
When the only existing handler doesn't use the full argument list, still
have to ensure the full frame is allocated because all arguments get set
regardless.
2020-04-09 22:05:34 -07:00
Jon Siwek
070b28ac05 Emit error for alternate event/hook prototype args with attributes
Argument attributes are only allowed in the canonical prototype.
2020-04-09 21:00:09 -07:00
Jon Siwek
9b6934eab8 Improve alternate event/hook prototype matching
This fixes it to again allow the old behavior of matching a handler
against the canonical prototype as long as all argument types, but not
necessarily names, match.
2020-04-09 20:20:38 -07:00
Johanna Amann
c83567246e Fix include in X509Common.h
Give full path to Analyzer.h, so that X509Common.h is include-able by
plugins.
2020-04-09 16:15:36 -07:00
Johanna Amann
876c803d75 Merge remote-tracking branch 'origin/topic/timw/776-using-statements'
* origin/topic/timw/776-using-statements:
  Remove 'using namespace std' from SerialTypes.h
  Remove other using statements from headers
  GH-776: Remove using statements added by PR 770

Includes small fixes in files that changed since the merge request was
made.

Also includes a few small indentation fixes.
2020-04-09 13:31:07 -07:00
Johanna Amann
a3a38f0849 Merge remote-tracking branch 'origin/topic/timw/nullptr'
* origin/topic/timw/nullptr:
  The remaining nulls
  plugin/probabilistic/zeekygen: Replace nulls with nullptr
  file_analysis: Replace nulls with nullptr
  analyzer: Replace nulls with nullptr
  iosource/threading/input/logging: Replace nulls with nullptr
2020-04-09 08:59:53 -07:00
Jon Siwek
1210257af9 Update submodule(s)
[nomail]
2020-04-08 14:06:56 -07:00
Jon Siwek
5fe2a57356 Merge remote-tracking branch 'origin/topic/timw/structure-packing'
During merge, changed a bit of how Frame OffsetMap
assignments/contruction were handled to keep parity with old version.

* origin/topic/timw/structure-packing:
  Lazy-initalize some of the fields in Frame to reduce the size of all Frames when they're not used
  Set InternalHashTag to a uint16_t so CompositeHash doesn't have a gap in it.
  Mark constants in List constexpr so they don't actually take up space in created objects
  Reorder some class variables to fill in gaps in structure packing
2020-04-08 13:57:44 -07:00
Jon Siwek
ce27b21d67 Merge remote-tracking branch 'origin/topic/timw/finals'
* origin/topic/timw/finals:
  Revert final keywords for PcapSource and reader/writer backends
  Mark the majority of the analyzer classes as final, where appropriate.
  More final markings.
  Mark a large number of common types as final that shouldn't be overrideden
  Mark all timers as final
2020-04-08 13:34:17 -07:00
Tim Wojtulewicz
06bb478552 Revert final keywords for PcapSource and reader/writer backends 2020-04-08 11:35:18 -07:00
Tim Wojtulewicz
0a47588d0b The remaining nulls 2020-04-07 16:08:34 -07:00
Tim Wojtulewicz
41c3256faa plugin/probabilistic/zeekygen: Replace nulls with nullptr 2020-04-07 16:08:34 -07:00
Tim Wojtulewicz
393b8353cb file_analysis: Replace nulls with nullptr 2020-04-07 16:08:34 -07:00
Tim Wojtulewicz
6897912909 analyzer: Replace nulls with nullptr 2020-04-07 16:08:34 -07:00
Tim Wojtulewicz
cb01e098df iosource/threading/input/logging: Replace nulls with nullptr 2020-04-07 16:08:34 -07:00
Tim Wojtulewicz
d53c1454c0 Remove 'using namespace std' from SerialTypes.h
This unfortunately cuases a ton of flow-down changes because a lot of other
code was depending on that definition existing. This has a fairly large chance
to break builds of external plugins, considering how many internal ones it broke.
2020-04-07 15:59:59 -07:00
Tim Wojtulewicz
a525f9532e Remove other using statements from headers 2020-04-07 15:47:44 -07:00
Tim Wojtulewicz
eb010290eb GH-776: Remove using statements added by PR 770 2020-04-07 15:47:07 -07:00
Johanna Amann
4ee84b69f2 Merge remote-tracking branch 'origin/topic/jsiwek/udp_content_delivery_ports_use_resp'
* origin/topic/jsiwek/udp_content_delivery_ports_use_resp:
  Add "udp_content_ports" option
  Add new "udp_content_delivery_ports_use_resp" option
2020-04-07 14:28:49 -07:00
Johanna Amann
8e4656bc61 Merge remote-tracking branch 'origin/topic/jsiwek/fix-duration-threshold'
* origin/topic/jsiwek/fix-duration-threshold:
  Fix connection duration thresholding
2020-04-07 13:44:56 -07:00
Jon Siwek
c1b3c9593b Add "udp_content_ports" option
Any port in that set found as either source or destination port
of a UDP packet will cause the "udp_contents" event to be raised.
2020-04-07 13:02:29 -07:00
Tim Wojtulewicz
08fbdb1418 Merge remote-tracking branch 'origin/topic/jsiwek/fix-patterns-as-table-index'
* origin/topic/jsiwek/fix-patterns-as-table-index:
  Fix using patterns stored as table/set indices
2020-04-07 12:05:44 -07:00
Jon Siwek
7e75eb750b Merge branch 'topic/ak/rdpeudp' of https://github.com/anthonykasza/zeek
Minor whitespace adjusted during merge.

* 'topic/ak/rdpeudp' of https://github.com/anthonykasza/zeek:
  change: -C flag to btest
  add: ignore checksum added to btest script
  change: update btest baselines for rdpeudp-handshake-success
  add: rdpeudp2-handshake-success btest baseline
  Update src/analyzer/protocol/rdp/rdpeudp-protocol.pac
  Update src/analyzer/protocol/rdp/rdpeudp-analyzer.pac
  add: btest for rdpeudp2
  add: more robust handling of RDPEUDP2 negotiation
  change: RDPUDP_CORRELATION_ID_PAYLOAD definition
  change: debugging why the orig synex flags aren't parsed correctly but the resp synex flags are...
  add: handling for orig SYNEX flags
  add: test trace for when RDPEUDP negotiates RDPEUDP2
  add: more SYN PDU parsing structs
2020-04-06 17:29:36 -07:00
Jon Siwek
da56cd44d9 Fix using patterns stored as table/set indices
Pattern values used as table/set indices are stored in serialized form
using just the pattern text, but re-creating the value from that didn't
fully initialize/compile the regex matcher after (re-)creating it from
that pattern text.
2020-04-06 17:12:33 -07:00
Tim Wojtulewicz
f5865b6b97 Lazy-initalize some of the fields in Frame to reduce the size of all Frames when they're not used 2020-04-06 15:32:39 -07:00
Jon Siwek
2da84020cf Add new "udp_content_delivery_ports_use_resp" option
This controls whether ports given by "udp_content_delivery_ports_orig" and
"udp_content_delivery_ports_orig" are in terms of the UDP packet's
destination port or by the Connection's "responder" port (the former is
the unchanged default behavior).
2020-04-06 14:51:34 -07:00
Tim Wojtulewicz
6f8bbadcf9 Set InternalHashTag to a uint16_t so CompositeHash doesn't have a gap in it.
Resizes CompositeHash from 32 bytes to 24 bytes.
2020-04-06 14:07:42 -07:00
Tim Wojtulewicz
471cf8587b Mark constants in List constexpr so they don't actually take up space in created objects
This resizes List from 24 bytes to 16 bytes.
2020-04-06 14:07:42 -07:00
Tim Wojtulewicz
2964093e5d Reorder some class variables to fill in gaps in structure packing
The big hitters:
Dict: Fills in four 4-byte holes in the structure. This shrinks Dictionary from 136 bytes to 114 bytes.
Desc: Fills in a 6-byte hole in the structure. This shrinks ODesc from 152 bytes to 144 bytes.
Frame: Moves and combines 4 bool variables from a few places into one single 4-byte block. This resolves all of the holes at once. This shrinks Frame from 216 bytes to 192 bytes and removes one cache line.
Func: Moves one int32_t variable to fill in a 4-byte hole. This shrinks Func from 112 bytes to 104 bytes.
ID: Moves two bool variables to fill in a 3-byte hole. This leaves behind a 1-byte hole, but removes a 6-byte pad from the end of the structure. This shrinks ID from 144 bytes to 136 bytes.

Other changes:
RuleHdrTest: Fills in one 4-byte hole in the structure. This shrinks RuleHdrTest from 248 bytes to 240 bytes.
RuleEndpointState: Moves one bool variable down in the structure to reduce a 7-byte hole. This unfortunately causes a 3-byte hole later in the structure but there’s no easy way to filll it in. This does shrink RuleEndpointState from 128 bytes to 120 bytes though.
ScannedFile: Moves two bool values to reduce a 4-byte hole by 2 bytes. This shrinks ScannedFile from 64 bytes to 56 bytes.
Brofiler: Moves one char value to reduce a 4-byte hole by 1 byte. This shrinks Brofiler from 96 bytes to 88 bytes and removes one cache line.
DbgBreakpoint: Moves some values around to fill in a 4-byte hole and reduce a second. A 2-byte hole still exists, but the structure shrinks from 632 bytes to 624 bytes. It’s possible on this one that one of the int32_t values could be an int16_t and remove the last 2-byte gap.
ParseLocationRec: Moves one int to fill in a 4-byte hole. This shrinks ParseLocationRec from 32 bytes to 24 bytes.
DebugCmdInfo: Moves one bool variable to shift a few others up. This results in a 6-byte pad at the end of the structure but removes a 7-byte hole in the middle. This shrinks DebugCmdInfo from 56 bytes to 48 bytes.
FragReassembler: Moves one variable down to fill in a 4-byte hole. This shrinks FragReassembler from 272 bytes to 264 bytes.
nb_dns_result: Moves ones uint32_t variable to fill in a 4-byte hole, also removing a 4-byte pad from the end of the structure. This shrinks nb_dns_result from 32 bytes to 24 bytes.
nb_dns_entry: Moves one short value to fill in a 2-byte hole, also removing a 6-byte hole. This shrinks nb_dns_entry from 1064 bytes to 1056 bytes.
2020-04-06 14:07:29 -07:00
Jon Siwek
bc5844b24c Fix connection duration thresholding
Connection durations were being compared "less than" instead of "greater
than" the desired duration threshold as provided to
set_current_conn_bytes_threshold() or
ConnThreshold::set_duration_threshold()
2020-04-06 13:32:32 -07:00
Anthony Kasza
19bb5210f4 change: -C flag to btest 2020-04-06 10:17:37 -06:00
Anthony Kasza
980e6299d3 add: ignore checksum added to btest script 2020-04-06 10:17:06 -06:00
Tim Wojtulewicz
485d9d5458 Mark the majority of the analyzer classes as final, where appropriate.
Most of these came from use of the -Wsuggest-final-types flag for gcc.
2020-04-03 18:44:09 -04:00
Tim Wojtulewicz
4035ec7760 More final markings.
These classes were recommended by gcc's -Wsugggest-final-types as places where
large numbers of virtual functions could be optimized away.
2020-04-03 18:35:24 -04:00
Tim Wojtulewicz
9c89cd4a47 Mark a large number of common types as final that shouldn't be overrideden 2020-04-03 18:33:51 -04:00
Anthony Kasza
01decee777 Merge branch 'topic/ak/rdpeudp' of https://github.com/anthonykasza/zeek into topic/ak/rdpeudp 2020-04-03 16:18:50 -06:00
Anthony Kasza
d10c9ab667 change: update btest baselines for rdpeudp-handshake-success 2020-04-03 16:11:18 -06:00
Anthony Kasza
243095fd9b add: rdpeudp2-handshake-success btest baseline 2020-04-03 16:09:53 -06:00
anthonykasza
bf05b1ebc9
Update src/analyzer/protocol/rdp/rdpeudp-protocol.pac
Co-Authored-By: Jon Siwek <jsiwek@corelight.com>
2020-04-03 16:00:14 -06:00
anthonykasza
caa46e010d
Update src/analyzer/protocol/rdp/rdpeudp-analyzer.pac
Co-Authored-By: Jon Siwek <jsiwek@corelight.com>
2020-04-03 16:00:00 -06:00
Tim Wojtulewicz
c2375fc88d Mark all timers as final 2020-04-03 15:20:19 -04:00
Anthony Kasza
d38599ecb4 add: btest for rdpeudp2 2020-04-03 11:48:26 -06:00
Anthony Kasza
339cb4e993 add: more robust handling of RDPEUDP2 negotiation 2020-04-03 11:42:08 -06:00
Anthony Kasza
bf97b41856 change: RDPUDP_CORRELATION_ID_PAYLOAD definition 2020-04-03 11:37:13 -06:00
Anthony Kasza
32a52590d0 change: debugging why the orig synex flags aren't parsed correctly but the resp synex flags are... 2020-04-03 11:07:13 -06:00
Anthony Kasza
8a915b19d7 add: handling for orig SYNEX flags 2020-04-03 10:20:03 -06:00
Anthony Kasza
9b1b8ae292 add: test trace for when RDPEUDP negotiates RDPEUDP2 2020-04-03 09:59:39 -06:00
Anthony Kasza
88951d2d71 add: more SYN PDU parsing structs 2020-04-03 09:48:48 -06:00
Jon Siwek
e66148a13a Merge branch 'topic/ak/rdpeudp'
- Squashed the original commit set
- Cleaned up formatting
- Fixed register_for_ports() for right RDPEUDP analyzer

* topic/ak/rdpeudp:
  Add RDP over UDP analyzer
2020-04-02 18:31:40 -07:00
Anthony Kasza
60644bc85f Add RDP over UDP analyzer 2020-04-02 17:53:47 -07:00