for http_client_body is the same URI-like normalization applied to
http_header when no specific header is specified.
+===== http_raw_body
+
+This is the body of a request or response message. It will be dechunked
+and unzipped if applicable but will not be normalized in any other way.
+The difference between http_raw_body and packet data is a rule that uses
+packet data will search and may match an HTTP header, but http_raw_body
+is limited to the message body. Thus the latter is more efficient and
+more accurate for most uses.
+
===== http_method
The method field of a request message. Common values are "GET", "POST",
described above under gzip, normalize_utf, decompress_pdf, decompress_swf,
and normalize_javascript.
-The unnormalized message body is available in the packet data. If gzip is
-configured the packet data will be unzipped.
+The unnormalized message content is available in the packet data. If gzip
+is configured the packet data will be unzipped.
==== Timing issues and combining rule options
"http_raw_trailer",
"http_raw_request",
"http_raw_status",
+ "http_raw_body",
nullptr
};
extern const BaseApi* ips_http_raw_trailer;
extern const BaseApi* ips_http_raw_request;
extern const BaseApi* ips_http_raw_status;
+extern const BaseApi* ips_http_raw_body;
#ifdef BUILDING_SO
SO_PUBLIC const BaseApi* snort_plugins[] =
ips_http_raw_trailer,
ips_http_raw_request,
ips_http_raw_status,
+ ips_http_raw_body,
nullptr
};
HTTP_BUFFER_METHOD, HTTP_BUFFER_RAW_COOKIE, HTTP_BUFFER_RAW_HEADER, HTTP_BUFFER_RAW_URI,
HTTP_BUFFER_STAT_CODE, HTTP_BUFFER_STAT_MSG, HTTP_BUFFER_URI, HTTP_BUFFER_VERSION,
HTTP_BUFFER_TRAILER, HTTP_BUFFER_RAW_TRAILER, HTTP_BUFFER_RAW_REQUEST,
- HTTP_BUFFER_RAW_STATUS, HTTP_BUFFER_MAX };
+ HTTP_BUFFER_RAW_STATUS, HTTP_BUFFER_RAW_BODY, HTTP_BUFFER_MAX };
// Peg counts
// This enum must remain synchronized with HttpModule::peg_names[] in http_tables.cc
detect_data.print(output, "Detect data");
get_classic_buffer(HTTP_BUFFER_CLIENT_BODY, 0, 0).print(output,
HttpApi::classic_buffer_names[HTTP_BUFFER_CLIENT_BODY-1]);
+ get_classic_buffer(HTTP_BUFFER_RAW_BODY, 0, 0).print(output,
+ HttpApi::classic_buffer_names[HTTP_BUFFER_RAW_BODY-1]);
HttpMsgSection::print_section_wrapup(output);
}
HttpMsgTrailer* trailer = transaction->get_trailer(buffer_side);
return (trailer != nullptr) ? trailer->get_classic_raw_header() : Field::FIELD_NULL;
}
+ case HTTP_BUFFER_RAW_BODY:
+ {
+ HttpMsgBody* body = transaction->get_body();
+ return (body != nullptr) ? body->msg_text : Field::FIELD_NULL;
+ }
default:
assert(false);
return Field::FIELD_NULL;
inspect_section = IS_DETECTION;
break;
case HTTP_BUFFER_CLIENT_BODY:
+ case HTTP_BUFFER_RAW_BODY:
inspect_section = IS_BODY;
break;
case HTTP_BUFFER_TRAILER:
nullptr
};
+//-------------------------------------------------------------------------
+// http_raw_body
+//-------------------------------------------------------------------------
+
+#undef IPS_OPT
+#define IPS_OPT "http_raw_body"
+#undef IPS_HELP
+#define IPS_HELP "rule option to set the detection cursor to the unnormalized message body"
+
+static Module* raw_body_mod_ctor()
+{
+ return new HttpCursorModule(IPS_OPT, IPS_HELP, HTTP_BUFFER_RAW_BODY, CAT_SET_OTHER,
+ PSI_RAW_BODY);
+}
+
+static const IpsApi raw_body_api =
+{
+ {
+ PT_IPS_OPTION,
+ sizeof(IpsApi),
+ IPSAPI_VERSION,
+ 1,
+ API_RESERVED,
+ API_OPTIONS,
+ IPS_OPT,
+ IPS_HELP,
+ raw_body_mod_ctor,
+ HttpCursorModule::mod_dtor
+ },
+ OPT_TYPE_DETECTION,
+ 0, PROTO_BIT__TCP,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ HttpIpsOption::opt_ctor,
+ HttpIpsOption::opt_dtor,
+ nullptr
+};
+
//-------------------------------------------------------------------------
// plugins
//-------------------------------------------------------------------------
const BaseApi* ips_http_raw_trailer = &raw_trailer_api.base;
const BaseApi* ips_http_raw_request = &raw_request_api.base;
const BaseApi* ips_http_raw_status = &raw_status_api.base;
+const BaseApi* ips_http_raw_body = &raw_body_api.base;
enum PsIdx { PSI_URI, PSI_CLIENT_BODY, PSI_METHOD, PSI_COOKIE, PSI_STAT_CODE, PSI_STAT_MSG,
PSI_RAW_URI, PSI_RAW_HEADER, PSI_RAW_COOKIE, PSI_HEADER, PSI_VERSION, PSI_TRAILER,
- PSI_RAW_TRAILER, PSI_RAW_REQUEST, PSI_RAW_STATUS, PSI_MAX };
+ PSI_RAW_TRAILER, PSI_RAW_REQUEST, PSI_RAW_STATUS, PSI_RAW_BODY, PSI_MAX };
class HttpCursorModule : public Module
{