pcre Modifier Options
You can use modifying options after you specify regular
expression syntax in the
pcre
keyword’s value. These modifiers perform Perl,
PCRE, and Snort-specific processing functions. Modifiers always appear at the
end of the PCRE value, and appear in the following format:
/pcre/ismxAEGRBUIPHDMCKSY
where
ismxAEGRBUPHMC
can include any of the modifying options
that appear in the following tables.
Tip | Optionally, you can surround the regular expression and any
modifying options with quotes, for example,
|
The following table describes options you can use to perform Perl processing functions.
Option |
Description |
---|---|
i |
Makes the regular expression case-insensitive. |
s |
The dot character (.) describes all characters except the
newline or
|
m |
By default, a string is treated as a single line of characters,
and
|
x |
Ignores white space data characters that may appear within the pattern, except when escaped (preceded by a backslash) or included inside a character class. |
The following table describes the PCRE modifiers you can use after the regular expression.
Option |
Description |
---|---|
A |
The pattern must match at the beginning of the string (same as
using
|
E |
Sets
|
G |
By default,
|
The following table describes the Snort-specific modifiers that you can use after the regular expression.
.
Option |
Description |
---|---|
R |
Searches for matching content relative to the end of the last match found by the rules engine. |
B |
Searches for the content within data before it is decoded by a
preprocessor (this option is similar to using the
|
U |
Searches for the content within the URI of a normalized HTTP
request message decoded by the HTTP Inspect preprocessor. Note that you cannot
use this option in combination with the
Note that a pipelined HTTP request packet contains multiple
URIs. A PCRE expression that includes the U option causes the rules engine to
search for a content match only in the first URI in a pipelined HTTP request
packet. To search all URIs in the packet, use the
|
I |
Searches for the content within the URI of a raw HTTP request
message decoded by the HTTP Inspect preprocessor. Note that you cannot use this
option in combination with the
|
P |
Searches for the content within the body of a normalized HTTP request message decoded by the HTTP Inspect preprocessor. |
H |
Searches for the content within the header, excluding cookies,
of an HTTP request or response message decoded by the HTTP Inspect
preprocessor. Note that you cannot use this option in combination with the
|
D |
Searches for the content within the header, excluding cookies,
of a raw HTTP request or response message decoded by the HTTP Inspect
preprocessor. Note that you cannot use this option in combination with the
|
M |
Searches for the content within the method field of a normalized HTTP request message decoded by the HTTP Inspect preprocessor; the method field identifies the action such as GET, PUT, CONNECT, and so on to take on the resource identified in the URI. |
C |
When the HTTP Inspect preprocessor Inspect HTTP Cookies option is enabled, searches for the normalized content within any cookie in an HTTP request header, and also within any set-cookie in an HTTP response header when the preprocessor Inspect HTTP Responses option is enabled. When Inspect HTTP Cookies is not enabled, searches the entire header, including the cookie or set-cookie data. Note the following:
|
K |
When the HTTP Inspect preprocessor Inspect HTTP Cookies option is enabled, searches for the raw content within any cookie in an HTTP request header, and also within any set-cookie in an HTTP response header when the preprocessor Inspect HTTP Responses option is enabled. When Inspect HTTP Cookies is not enabled, searches the entire header, including the cookie or set-cookie data. Note the following:
|
S |
Searches the 3-digit status code in an HTTP response. |
Y |
Searches the textual description that accompanies the status code in an HTTP response. |
Note | Do not use the U option in combination with the R option. This could cause performance problems. Also, do not use the U option in combination with any other HTTP content option (I, P, H, D, M, C, K, S, or Y). |