Skip to content

StreamQL

StreamQL is the query language used in Caido that gives you the ability to filter WebSocket messages. The constructing primitives of a StreamQL query statement, in order of position, are the:

  1. Namespace
  2. Field
  3. Operator
  4. Value
Parts of a filter clause

Namespaces

INFO

Namespaces are project-specific.

NamespaceDescription
wsAll WebSocket traffic.
streamAll stream messages.
presetFilter presets.

NOTE

The preset namespace does not have any fields available and instead takes a direct value of a filter preset's name/alias.

Fields

ws

Available FieldsDescriptionValue Type
created_atThe date and time the message was sent.Date/Time: RFC3339 (2024-06-24T17:03:48+00:00) / ISO 8601 (2024-06-24T17:03:48+0000) / RFC2822 (Mon, 24 Jun 2024 17:03:48 +0000) / RFC7231 (Mon, 24 Jun 2024 17:03:48 GMT) / ISO9075 (2024-06-24T17:03:48Z)
directionThe direction of the message.String/Byte: To Server/To Client
formatThe message type.String/Byte: Binary, Text, Close, Ping, Pong
lenThe message size in bytes.Integer
rawThe full raw data of the message.String/Byte

stream

Available FieldsDescriptionValue Type
hostThe hostname of the destination server.String/Byte
pathThe URL path.String/Byte
portThe port of the destination server.Integer
protocolThe protocol of the destination server.String/Byte
sourceThe Caido feature source of the stream message.String/Byte
tlsIf the connection used TLS/SSL encryption.Boolean (true/false)

Operators

OperatorDescriptionValue TypeAdditional Details
eqEqual to the supplied value.String/Byte, IntegerCase sensitive.
gtGreater than the supplied value.Date/Time, Integer
gteGreater than or equal to the supplied value.Integer
ltLess than the supplied value.Date/Time, Integer
lteLess than or equal to the supplied value.Integer
neNot equal to the supplied value.String/Byte, IntegerCase sensitive.
contContains the supplied value.String/ByteCase insensitive.
likeThe SQLite LIKE Operator.String/ByteCase sensitive for Unicode characters beyond the ASCII range.
ncontDoes not contain the supplied value.String/ByteCase insensitive.
nlikeThe SQLite NOT LIKE Operator.String/ByteCase sensitive for Unicode characters beyond the ASCII range.
regexMatches to the regular expression.String/ByteRust-flavored syntax.
nregexDoes not match to the regular expression.String/ByteRust-flavored syntax.

TIP

In SQLite - the % character matches zero or more characters (%.js matches .map.js) and the _ character matches one character (v_lue matches vAlue). Visit https://regex101.com/ and select Rust syntax to test regular expressions.

NOTE

Not all regex features are currently supported by Caido (such as look-ahead expressions) as they are not included in the regex library of Rust.

Values

preset

Available ValuesExample
A filter preset's alias.preset:"no-health-check"
A filter preset's name.preset:"No Health Check"

source

Available ValuesAdditional DetailsExample
automate, intercept, plugin, replay, workflowRequires lowercase. Autocomplete is not supported.stream.source.eq:"intercept"

Combining Statements

Query statements can be combined together using logical operators and logical grouping.

Logical Operators

OperatorDescription
ANDBoth the left and right clauses must be true.
OREither the left or right clause must be true.

INFO

Operators are case insensitive. Both have the same priority.

Logical Grouping

Caido supports the priority of operations: AND has a higher priority than OR.

  • <Clause1> AND <Clause2> OR <Clause3> is equivalent to ((<Clause1> AND <Clause2>) OR <Clause3>).
  • <Clause1> OR <Clause2> AND <Clause3> is equivalent to (<Clause1> OR (<Clause2> AND <Clause3>)).
  • <Clause1> AND <Clause2> AND <Clause3> is equivalent to ((<Clause1> AND <Clause2>) AND <Clause3>).

TIP

While parentheses are optional, we recommend using them to make your logical grouping clear.

Comments

Caido supports both single-line and multi-line comments in StreamQL queries.

TIP

Comments can be used to write descriptions or temporarily disable certain query statements.