Skip to content

Commit

Permalink
doc: update syntax for flow.pkts & flow.bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
inashivb committed Nov 29, 2024
1 parent caeff9e commit ac98119
Showing 1 changed file with 24 additions and 59 deletions.
83 changes: 24 additions & 59 deletions doc/userguide/rules/flow-keywords.rst
Original file line number Diff line number Diff line change
Expand Up @@ -318,90 +318,55 @@ Signature example::

In this example, we combine `flow.age` and `flowbits` to get an alert on the first packet after the flow's age is older than one hour.

flow.pkts_toclient
------------------
flow.pkts
---------

Flow number of packets to client (integer)
Flow number of packets (integer)
This keyword does not wait for the end of the flow, but will be checked at each packet.

flow.pkts_toclient uses an :ref:`unsigned 32-bit integer <rules-integer-keywords>`.
flow.pkts uses an :ref:`unsigned 32-bit integer <rules-integer-keywords>` and supports
following directions:

Syntax::

flow.pkts_toclient: [op]<number>

The number of packets can be matched exactly, or compared using the _op_ setting::

flow.pkts_toclient:3 # exactly 3
flow.pkts_toclient:<3 # smaller than 3
flow.pkts_toclient:>=2 # greater than or equal to 2

Signature example::

alert ip any any -> any any (msg:"Flow has 20 packets"; flow.pkts_toclient:20; sid:1;)

flow.pkts_toserver
------------------
* toclient

Flow number of packets to server (integer)
This keyword does not wait for the end of the flow, but will be checked at each packet.

flow.pkts_toserver uses an :ref:`unsigned 32-bit integer <rules-integer-keywords>`.
* toserver

Syntax::

flow.pkts_toserver: [op]<number>
flow.pkts:<direction>,[op]<number>

The number of packets can be matched exactly, or compared using the _op_ setting::

flow.pkts_toserver:3 # exactly 3
flow.pkts_toserver:<3 # smaller than 3
flow.pkts_toserver:>=2 # greater than or equal to 2
flow.pkts:toclient,3 # exactly 3
flow.pkts:toserver,<3 # smaller than 3

Signature example::

alert ip any any -> any any (msg:"Flow has 20 packets"; flow.pkts_toserver:20; sid:1;)

flow.bytes_toclient
-------------------
alert ip any any -> any any (msg:"Flow has 20 packets in toclient dir"; flow.pkts:toclient,20; sid:1;)

Flow number of bytes to client (integer)
This keyword does not wait for the end of the flow, but will be checked at each packet.

flow.bytes_toclient uses an :ref:`unsigned 64-bit integer <rules-integer-keywords>`.

Syntax::

flow.bytes_toclient: [op]<number>

The number of packets can be matched exactly, or compared using the _op_ setting::

flow.bytes_toclient:3 # exactly 3
flow.bytes_toclient:<3 # smaller than 3
flow.bytes_toclient:>=2 # greater than or equal to 2

Signature example::
flow.bytes
----------

alert ip any any -> any any (msg:"Flow has less than 2000 bytes"; flow.bytes_toclient:<2000; sid:1;)
Flow number of bytes (integer)
This keyword does not wait for the end of the flow, but will be checked at each packet.

flow.bytes_toserver
-------------------
flow.bytes uses an :ref:`unsigned 64-bit integer <rules-integer-keywords>` and supports
following directions:

Flow number of bytes to server (integer)
This keyword does not wait for the end of the flow, but will be checked at each packet.
* toclient

flow.bytes_toserver uses an :ref:`unsigned 64-bit integer <rules-integer-keywords>`.
* toserver

Syntax::

flow.bytes_toserver: [op]<number>
flow.bytes:<direction>,[op]<number>

The number of packets can be matched exactly, or compared using the _op_ setting::
The number of bytes can be matched exactly, or compared using the _op_ setting::

flow.bytes_toserver:3 # exactly 3
flow.bytes_toserver:<3 # smaller than 3
flow.bytes_toserver:>=2 # greater than or equal to 2
flow.bytes:toclient,3 # exactly 3
flow.bytes:toserver,<3 # smaller than 3

Signature example::

alert ip any any -> any any (msg:"Flow has less than 2000 bytes"; flow.bytes_toserver:<2000; sid:1;)
alert ip any any -> any any (msg:"Flow has less than 2000 bytes in toserver dir"; flow.bytes:toserver,<2000; sid:1;)

0 comments on commit ac98119

Please sign in to comment.