Go to the documentation of this file.
61 static int rule_warnings_only = 0;
117 { 0,
false,
false,
true,
"http_uri",
"http uri" },
118 { 0,
false,
false,
false,
"http_raw_uri",
"http raw uri" },
119 { 0,
false,
true,
false,
"http_method",
"http method" },
120 { 0,
false,
false,
false,
"http_request_line",
"http request line" },
121 { 0,
false,
false,
false,
"http_client_body",
"http client body" },
122 { 0,
false,
false,
true,
"http_header",
"http header" },
123 { 0,
false,
false,
false,
"http_raw_header",
"http raw header" },
124 { 0,
false,
false,
true,
"http_cookie",
"http cookie" },
125 { 0,
false,
false,
false,
"http_user_agent",
"http user agent" },
126 { 0,
false,
false,
false,
"http_host",
"http host" },
127 { 0,
false,
false,
false,
"http_raw_host",
"http raw host" },
128 { 0,
false,
false,
false,
"http_accept_enc",
"http accept enc" },
129 { 0,
false,
false,
false,
"http_referer",
"http referer" },
130 { 0,
false,
false,
false,
"http_content_type",
"http content type" },
131 { 0,
false,
false,
false,
"http_header_names",
"http header names" },
134 { 0,
false,
false,
false,
"http_stat_msg",
"http stat msg" },
135 { 0,
false,
false,
false,
"http_stat_code",
"http stat code" },
136 { 0,
false,
true,
false,
"file_data",
"http server body" },
139 { 0,
false,
false,
false,
"http_request_line",
"http request line" },
140 { 0,
false,
false,
false,
"http_accept",
"http accept" },
141 { 0,
false,
false,
false,
"http_accept_lang",
"http accept lang" },
142 { 0,
false,
false,
false,
"http_connection",
"http connection" },
143 { 0,
false,
false,
false,
"http_content_len",
"http content len" },
144 { 0,
false,
false,
false,
"http_protocol",
"http protocol" },
145 { 0,
false,
false,
false,
"http_start",
"http start" },
148 { 0,
false,
false,
false,
"http_response_line",
"http response line" },
149 { 0,
false,
false,
false,
"http.server",
"http server" },
150 { 0,
false,
false,
false,
"http.location",
"http location" },
153 static void FpPatternStatsAdd(
FpPatternStats *fp,
int list, uint16_t patlen)
162 else if (patlen < f->min)
174 int fast_pattern_set = 0;
175 int fast_pattern_only_set = 0;
176 int fast_pattern_chop_set = 0;
181 if (mpm_sm != NULL) {
184 fast_pattern_set = 1;
186 fast_pattern_only_set = 1;
188 fast_pattern_chop_set = 1;
194 fprintf(fp,
"== Sid: %u ==\n", s->
id);
195 fprintf(fp,
"%s\n", line);
197 fprintf(fp,
" Fast Pattern analysis:\n");
199 fprintf(fp,
" Prefilter on: %s\n",
206 fprintf(fp,
" No content present\n");
211 fprintf(fp,
" Fast pattern matcher: ");
212 int list_type = mpm_sm_list;
214 fprintf(fp,
"content\n");
219 fprintf(fp,
"%s (%s)\n", desc,
name);
224 fprintf(fp,
" Flags:");
226 fprintf(fp,
" Offset");
229 fprintf(fp,
" Depth");
233 fprintf(fp,
" Within");
237 fprintf(fp,
" Distance");
241 fprintf(fp,
" Nocase");
245 fprintf(fp,
" Negated");
249 fprintf(fp,
" None");
252 fprintf(fp,
" Fast pattern set: %s\n", fast_pattern_set ?
"yes" :
"no");
253 fprintf(fp,
" Fast pattern only set: %s\n", fast_pattern_only_set ?
"yes" :
"no");
254 fprintf(fp,
" Fast pattern chop set: %s\n", fast_pattern_chop_set ?
"yes" :
"no");
255 if (fast_pattern_chop_set) {
256 fprintf(fp,
" Fast pattern offset, length: %u, %u\n", fp_cd->
fp_chop_offset,
267 fprintf(fp,
" Original content: ");
271 if (fast_pattern_chop_set) {
280 fprintf(fp,
" Final content: ");
286 fprintf(fp,
" Final content: ");
315 char *log_path =
SCMalloc(PATH_MAX);
316 if (log_path == NULL) {
317 FatalError(
"Unable to allocate scratch memory for rule filename");
319 snprintf(log_path, PATH_MAX,
"%s/%s%s", log_dir,
322 FILE *fp = fopen(log_path,
"w");
324 SCLogError(
"failed to open %s: %s", log_path, strerror(errno));
331 SCLogInfo(
"Engine-Analysis for fast_pattern printed to file - %s",
336 gettimeofday(&tval, NULL);
338 struct tm *tms =
SCLocalTime(tval.tv_sec, &local_tm);
339 fprintf(fp,
"----------------------------------------------"
340 "---------------------\n");
342 "Date: %" PRId32
"/%" PRId32
"/%04d -- "
344 tms->tm_mday, tms->tm_mon + 1, tms->tm_year + 1900, tms->tm_hour, tms->tm_min,
346 fprintf(fp,
"----------------------------------------------"
347 "---------------------\n");
360 #define DETECT_PERCENT_ENCODING_REGEX "%[0-9|a-f|A-F]{2}"
366 PCRE2_ZERO_TERMINATED, opts, &en, &eo, NULL);
368 PCRE2_UCHAR errbuffer[256];
369 pcre2_get_error_message(en, errbuffer,
sizeof(errbuffer));
390 }
else if (value && strcasecmp(value,
"warnings-only") == 0) {
392 rule_warnings_only = 1;
397 char log_path[PATH_MAX];
398 snprintf(log_path,
sizeof(log_path),
"%s/%s%s", log_dir,
402 SCLogError(
"failed to open %s: %s", log_path, strerror(errno));
406 SCLogInfo(
"Engine-Analysis for rules printed to file - %s",
410 gettimeofday(&tval, NULL);
412 struct tm *tms =
SCLocalTime(tval.tv_sec, &local_tm);
414 "----------------------------------------------"
415 "---------------------\n");
417 "Date: %" PRId32
"/%" PRId32
"/%04d -- "
419 tms->tm_mday, tms->tm_mon + 1, tms->tm_year + 1900, tms->tm_hour, tms->tm_min,
422 "----------------------------------------------"
423 "---------------------\n");
426 if (!PerCentEncodingSetup(
de_ctx->
ea)) {
428 "Error compiling regex; can't check for percent encoding in normalized "
434 SCLogInfo(
"Conf parameter \"engine-analysis.rules\" not found. "
435 "Defaulting to not printing the rules analysis report.");
438 SCLogInfo(
"Engine-Analysis for rules disabled in conf file.");
447 fprintf(fp,
"============\n"
448 "Summary:\n============\n");
456 "%s, smallest pattern %u byte(s), longest pattern %u byte(s), number of patterns "
457 "%u, avg pattern len %.2f byte(s)\n",
459 (
float)((
double)f->
tot / (
float)f->
cnt));
479 *fp_analysis =
false;
480 *rule_analysis =
false;
484 FatalError(
"Unable to allocate per-engine analysis context");
489 if (cfg_prefix_len > 0) {
494 FatalError(
"Unable to allocate per-engine analysis context name buffer");
500 *fp_analysis = SetupFPAnalyzer(
de_ctx);
501 *rule_analysis = SetupRuleAnalyzer(
de_ctx);
503 if (!(*fp_analysis || *rule_analysis)) {
516 CleanupRuleAnalyzer(
de_ctx);
517 CleanupFPAnalyzer(
de_ctx);
534 static int PerCentEncodingMatch(
EngineAnalysisCtx *ea_ctx, uint8_t *content, uint16_t content_len)
538 pcre2_match_data *match = pcre2_match_data_create_from_pattern(ea_ctx->
percent_re, NULL);
539 ret = pcre2_match(ea_ctx->
percent_re, (PCRE2_SPTR8)content, content_len, 0, 0, match, NULL);
542 }
else if (ret < -1) {
543 SCLogError(
"Error parsing content - %s; error code is %d", content, ret);
546 pcre2_match_data_free(match);
556 if (mpm_sm != NULL) {
594 const int list_type = mpm_sm_list;
603 payload ? (stream ?
"payload and reassembled stream" :
"payload")
604 :
"reassembled stream");
611 }
else if (desc ||
name) {
631 fprintf(tmp_fp,
"== Sid: UNKNOWN ==\n");
632 fprintf(tmp_fp,
"%s\n", line);
633 fprintf(tmp_fp,
" FAILURE: invalid rule.\n");
634 fprintf(tmp_fp,
" File: %s.\n", file);
635 fprintf(tmp_fp,
" Line: %d.\n", lineno);
636 fprintf(tmp_fp,
"\n");
653 vsnprintf(
str,
sizeof(
str), fmt, ap);
657 ctx->js_notes = SCJbNewArray();
659 SCJbAppendString(
ctx->js_notes,
str);
668 vsnprintf(
str,
sizeof(
str), fmt, ap);
671 if (!
ctx->js_warnings)
672 ctx->js_warnings = SCJbNewArray();
673 if (
ctx->js_warnings)
674 SCJbAppendString(
ctx->js_warnings,
str);
677 #define CHECK(pat) if (strlen((pat)) <= len && memcmp((pat), buf, MIN(len, strlen((pat)))) == 0) return true;
679 static bool LooksLikeHTTPMethod(
const uint8_t *buf, uint16_t
len)
688 static bool LooksLikeHTTPUA(
const uint8_t *buf, uint16_t
len)
690 CHECK(
"User-Agent: ");
691 CHECK(
"\nUser-Agent: ");
697 char pattern_str[1024] =
"";
700 SCJbSetString(js,
"pattern", pattern_str);
709 SCJbSetUint(js,
"offset", cd->
offset);
712 SCJbSetUint(js,
"depth", cd->
depth);
715 SCJbSetInt(js,
"distance", cd->
distance);
718 SCJbSetInt(js,
"within", cd->
within);
737 SCJbOpenArray(js,
"matches");
741 SCJbSetString(js,
"name", mname);
747 SCJbOpenObject(js,
"content");
750 AnalyzerNote(
ctx, (
char *)
"'fast_pattern:only' option is silently ignored and "
751 "is interpreted as regular 'fast_pattern'");
755 (
char *)
"pattern looks like it inspects HTTP, use http.request_line or "
756 "http.method and http.uri instead for improved performance");
760 (
char *)
"pattern looks like it inspects HTTP, use http.user_agent "
761 "or http.header for improved performance");
764 AnalyzerNote(
ctx, (
char *)
"'within' option for pattern w/o previous content "
765 "was converted to 'depth'");
768 AnalyzerNote(
ctx, (
char *)
"'distance' option for pattern w/o previous content "
769 "was converted to 'offset'");
777 SCJbOpenObject(js,
"pcre");
782 (
char *)
"'/B' (rawbytes) option is a no-op and is silently ignored");
789 SCJbOpenObject(js,
"byte_jump");
790 SCJbSetUint(js,
"nbytes", cd->
nbytes);
791 SCJbSetInt(js,
"offset", cd->
offset);
792 SCJbSetUint(js,
"multiplier", cd->
multiplier);
796 SCJbSetString(js,
"base",
"unset");
799 SCJbSetString(js,
"base",
"oct");
802 SCJbSetString(js,
"base",
"dec");
805 SCJbSetString(js,
"base",
"hex");
808 SCJbOpenArray(js,
"flags");
810 SCJbAppendString(js,
"from_beginning");
812 SCJbAppendString(js,
"little_endian");
814 SCJbAppendString(js,
"big_endian");
816 SCJbAppendString(js,
"string");
818 SCJbAppendString(js,
"relative");
820 SCJbAppendString(js,
"align");
822 SCJbAppendString(js,
"dce");
824 SCJbAppendString(js,
"offset_be");
826 SCJbAppendString(js,
"from_end");
834 SCJbOpenObject(js,
"byte_test");
835 SCJbSetUint(js,
"nbytes", cd->
nbytes);
836 SCJbSetInt(js,
"offset", cd->
offset);
839 SCJbSetString(js,
"base",
"unset");
842 SCJbSetString(js,
"base",
"oct");
845 SCJbSetString(js,
"base",
"dec");
848 SCJbSetString(js,
"base",
"hex");
851 SCJbOpenArray(js,
"flags");
853 SCJbAppendString(js,
"little_endian");
855 SCJbAppendString(js,
"big_endian");
857 SCJbAppendString(js,
"string");
859 SCJbAppendString(js,
"relative");
861 SCJbAppendString(js,
"dce");
868 SCJbOpenObject(js,
"absent");
869 SCJbSetBool(js,
"or_else", dad->
or_else);
877 SCJbOpenObject(js,
"ipopts");
879 SCJbSetString(js,
"option", flag);
886 SCJbOpenObject(js,
"flowbits");
889 SCJbSetString(js,
"cmd",
"isset");
892 SCJbSetString(js,
"cmd",
"isnotset");
895 SCJbSetString(js,
"cmd",
"set");
898 SCJbSetString(js,
"cmd",
"unset");
901 SCJbSetString(js,
"cmd",
"toggle");
905 SCJbOpenArray(js,
"names");
911 const char *varname =
913 SCJbAppendString(js, varname);
918 SCJbSetString(js,
"operator",
"or");
926 SCJbOpenObject(js,
"xbits");
929 SCJbSetString(js,
"cmd",
"isset");
932 SCJbSetString(js,
"cmd",
"isnotset");
935 SCJbSetString(js,
"cmd",
"set");
938 SCJbSetString(js,
"cmd",
"unset");
941 SCJbSetString(js,
"cmd",
"toggle");
947 SCJbSetString(js,
"track",
"ip_src");
950 SCJbSetString(js,
"track",
"ip_dst");
953 SCJbSetString(js,
"track",
"ip_pair");
956 SCJbSetString(js,
"track",
"tx");
960 SCJbSetUint(js,
"expire", xd->
expire);
967 SCJbOpenObject(js,
"flowint");
970 SCJbSetString(js,
"cmd",
"set");
973 SCJbSetString(js,
"cmd",
"add");
976 SCJbSetString(js,
"cmd",
"sub");
979 SCJbSetString(js,
"cmd",
"lt");
982 SCJbSetString(js,
"cmd",
"lte");
985 SCJbSetString(js,
"cmd",
"eq");
988 SCJbSetString(js,
"cmd",
"ne");
991 SCJbSetString(js,
"cmd",
"gte");
994 SCJbSetString(js,
"cmd",
"gt");
997 SCJbSetString(js,
"cmd",
"isset");
1000 SCJbSetString(js,
"cmd",
"isnotset");
1004 if (varname != NULL) {
1005 SCJbSetString(js,
"var", varname);
1019 SCJbOpenObject(js,
"ack");
1020 SCDetectU32ToJson(js, cd);
1026 SCJbOpenObject(js,
"seq");
1027 SCDetectU32ToJson(js, cd);
1033 SCJbOpenObject(js,
"tcp_mss");
1034 SCDetectU16ToJson(js, cd);
1040 SCJbOpenObject(js,
"dsize");
1041 SCDetectU16ToJson(js, cd);
1047 SCJbOpenObject(js,
"code");
1048 SCDetectU8ToJson(js, cd);
1054 SCJbOpenObject(js,
"ttl");
1055 SCDetectU8ToJson(js, cd);
1061 SCJbOpenObject(js,
"id");
1062 SCDetectU16ToJson(js, cd);
1068 SCJbOpenObject(js,
"window");
1069 SCDetectU16ToJson(js, cd);
1075 SCJbOpenObject(js,
"flow_age");
1076 SCDetectU32ToJson(js, cd);
1081 const uint8_t *dfd = (
const uint8_t *)smd->
ctx;
1082 SCJbOpenObject(js,
"flow_elephant");
1084 case DETECT_FLOW_TOSERVER:
1085 SCJbSetString(js,
"dir",
"toserver");
1087 case DETECT_FLOW_TOCLIENT:
1088 SCJbSetString(js,
"dir",
"toclient");
1090 case DETECT_FLOW_TOEITHER:
1091 SCJbSetString(js,
"dir",
"either");
1093 case DETECT_FLOW_TOBOTH:
1094 SCJbSetString(js,
"dir",
"both");
1117 ctx.js = SCJbNewObject();
1128 SCJbSetUint(
ctx.js,
"id", s->
id);
1129 SCJbSetUint(
ctx.js,
"gid", s->
gid);
1130 SCJbSetUint(
ctx.js,
"rev", s->
rev);
1131 SCJbSetString(
ctx.js,
"msg", s->
msg);
1134 SCJbSetString(
ctx.js,
"app_proto", alproto);
1136 SCJbOpenArray(
ctx.js,
"requirements");
1138 SCJbAppendString(
ctx.js,
"payload");
1141 SCJbAppendString(
ctx.js,
"no_payload");
1144 SCJbAppendString(
ctx.js,
"flow");
1147 SCJbAppendString(
ctx.js,
"tcp_flags_init_deinit");
1150 SCJbAppendString(
ctx.js,
"tcp_flags_unusual");
1153 SCJbAppendString(
ctx.js,
"engine_event");
1156 SCJbAppendString(
ctx.js,
"real_pkt");
1160 SCJbOpenObject(
ctx.js,
"match_policy");
1161 SCJbOpenArray(
ctx.js,
"actions");
1163 SCJbAppendString(
ctx.js,
"alert");
1166 SCJbAppendString(
ctx.js,
"drop");
1169 SCJbAppendString(
ctx.js,
"reject");
1172 SCJbAppendString(
ctx.js,
"reject_dst");
1175 SCJbAppendString(
ctx.js,
"reject_both");
1178 SCJbAppendString(
ctx.js,
"config");
1181 SCJbAppendString(
ctx.js,
"pass");
1184 SCJbAppendString(
ctx.js,
"accept");
1190 switch (flow_action) {
1192 SCJbSetString(
ctx.js,
"scope",
"packet");
1195 SCJbSetString(
ctx.js,
"scope",
"flow");
1198 SCJbSetString(
ctx.js,
"scope",
"flow_if_stateful");
1205 SCJbSetString(
ctx.js,
"scope",
"packet");
1208 SCJbSetString(
ctx.js,
"scope",
"flow");
1211 SCJbSetString(
ctx.js,
"scope",
"hook");
1214 SCJbSetString(
ctx.js,
"scope",
"tx");
1224 SCJbSetString(
ctx.js,
"type",
"unset");
1227 SCJbSetString(
ctx.js,
"type",
"ip_only");
1230 SCJbSetString(
ctx.js,
"type",
"like_ip_only");
1233 SCJbSetString(
ctx.js,
"type",
"pd_only");
1236 SCJbSetString(
ctx.js,
"type",
"de_only");
1239 SCJbSetString(
ctx.js,
"type",
"pkt");
1242 SCJbSetString(
ctx.js,
"type",
"pkt_stream");
1245 SCJbSetString(
ctx.js,
"type",
"stream");
1248 SCJbSetString(
ctx.js,
"type",
"app_layer");
1251 SCJbSetString(
ctx.js,
"type",
"app_tx");
1254 SCJbSetString(
ctx.js,
"type",
"error");
1260 SCJbOpenObject(
ctx.js,
"dependencies");
1261 SCJbOpenObject(
ctx.js,
"flowbits");
1262 SCJbOpenObject(
ctx.js,
"upstream");
1264 SCJbOpenObject(
ctx.js,
"state_modifying_rules");
1265 SCJbOpenArray(
ctx.js,
"sids");
1270 SCJbOpenArray(
ctx.js,
"names");
1273 SCJbAppendString(
ctx.js,
1286 SCJbOpenArray(
ctx.js,
"flags");
1288 SCJbAppendString(
ctx.js,
"src_any");
1291 SCJbAppendString(
ctx.js,
"dst_any");
1294 SCJbAppendString(
ctx.js,
"sp_any");
1297 SCJbAppendString(
ctx.js,
"dp_any");
1300 SCJbAppendString(
ctx.js,
"noalert");
1303 SCJbAppendString(
ctx.js,
"dsize");
1306 SCJbAppendString(
ctx.js,
"applayer");
1309 SCJbAppendString(
ctx.js,
"need_packet");
1312 SCJbAppendString(
ctx.js,
"need_stream");
1315 SCJbAppendString(
ctx.js,
"negated_mpm");
1318 SCJbAppendString(
ctx.js,
"flush");
1321 SCJbAppendString(
ctx.js,
"need_flowvar");
1324 SCJbAppendString(
ctx.js,
"filestore");
1327 SCJbAppendString(
ctx.js,
"toserver");
1330 SCJbAppendString(
ctx.js,
"toclient");
1333 SCJbAppendString(
ctx.js,
"tlsstore");
1336 SCJbAppendString(
ctx.js,
"bypass");
1339 SCJbAppendString(
ctx.js,
"prefilter");
1342 SCJbAppendString(
ctx.js,
"src_is_target");
1345 SCJbAppendString(
ctx.js,
"dst_is_target");
1352 SCJbOpenArray(
ctx.js,
"pkt_engines");
1354 for ( ; pkt != NULL; pkt = pkt->
next) {
1369 SCJbStartObject(
ctx.js);
1370 SCJbSetString(
ctx.js,
"name",
name);
1371 SCJbSetBool(
ctx.js,
"is_mpm", pkt->
mpm);
1373 SCJbOpenArray(
ctx.js,
"transforms");
1375 SCJbStartObject(
ctx.js);
1376 SCJbSetString(
ctx.js,
"name",
1389 SCJbOpenArray(
ctx.js,
"frame_engines");
1391 for (; frame != NULL; frame = frame->
next) {
1393 SCJbStartObject(
ctx.js);
1394 SCJbSetString(
ctx.js,
"name",
name);
1395 SCJbSetBool(
ctx.js,
"is_mpm", frame->
mpm);
1397 SCJbOpenArray(
ctx.js,
"transforms");
1399 SCJbStartObject(
ctx.js);
1400 SCJbSetString(
ctx.js,
"name",
1412 bool has_stream =
false;
1413 bool has_client_body_mpm =
false;
1414 bool has_file_data_mpm =
false;
1416 SCJbOpenArray(
ctx.js,
"engines");
1418 for ( ; app != NULL; app = app->
next) {
1433 }
else if (app->
mpm && strcmp(
name,
"http_client_body") == 0) {
1434 has_client_body_mpm =
true;
1435 }
else if (app->
mpm && strcmp(
name,
"file_data") == 0) {
1436 has_file_data_mpm =
true;
1439 SCJbStartObject(
ctx.js);
1440 SCJbSetString(
ctx.js,
"name",
name);
1441 const char *direction = app->
dir == 0 ?
"toserver" :
"toclient";
1442 SCJbSetString(
ctx.js,
"direction", direction);
1443 SCJbSetBool(
ctx.js,
"is_mpm", app->
mpm);
1448 SCJbOpenArray(
ctx.js,
"transforms");
1450 SCJbStartObject(
ctx.js);
1451 SCJbSetString(
ctx.js,
"name",
1465 if (has_stream && has_client_body_mpm)
1466 AnalyzerNote(&
ctx, (
char *)
"mpm in http_client_body combined with stream match leads to stream buffering");
1467 if (has_stream && has_file_data_mpm)
1468 AnalyzerNote(&
ctx, (
char *)
"mpm in file_data combined with stream match leads to stream buffering");
1471 SCJbOpenObject(
ctx.js,
"lists");
1481 if (pkt_mpm || app_mpm) {
1482 SCJbOpenObject(
ctx.js,
"mpm");
1490 SCJbSetString(
ctx.js,
"buffer",
name);
1498 switch (smd->
type) {
1502 DumpContent(
ctx.js, cd);
1514 SCJbOpenObject(
ctx.js,
"prefilter");
1521 SCJbSetString(
ctx.js,
"buffer",
name);
1523 SCJbSetString(
ctx.js,
"name", mname);
1527 if (
ctx.js_warnings) {
1528 SCJbClose(
ctx.js_warnings);
1529 SCJbSetObject(
ctx.js,
"warnings",
ctx.js_warnings);
1530 SCJbFree(
ctx.js_warnings);
1531 ctx.js_warnings = NULL;
1534 SCJbClose(
ctx.js_notes);
1535 SCJbSetObject(
ctx.js,
"notes",
ctx.js_notes);
1536 SCJbFree(
ctx.js_notes);
1537 ctx.js_notes = NULL;
1541 const char *filename =
"rules.json";
1543 char json_path[PATH_MAX] =
"";
1544 snprintf(json_path,
sizeof(json_path),
"%s/%s%s", log_dir,
1548 FILE *fp = fopen(json_path,
"a");
1550 fwrite(SCJbPtr(
ctx.js), SCJbLen(
ctx.js), 1, fp);
1564 SCJsonBuilder *root_jb = SCJbNewObject();
1568 SCJbOpenArray(root_jb,
"buffers");
1572 char str[1024] =
"";
1576 SCJsonBuilder *jb = arrays[p->
sm_list];
1577 if (arrays[p->
sm_list] == NULL) {
1578 jb = arrays[p->
sm_list] = SCJbNewObject();
1584 SCJbSetString(jb,
"name",
name);
1585 SCJbSetUint(jb,
"list_id", p->
sm_list);
1587 SCJbOpenArray(jb,
"patterns");
1590 SCJbStartObject(jb);
1591 SCJbSetString(jb,
"pattern",
str);
1593 SCJbSetUint(jb,
"cnt", p->
cnt);
1594 SCJbSetUint(jb,
"mpm", p->
mpm);
1595 SCJbOpenObject(jb,
"flags");
1606 SCJsonBuilder *jb = arrays[i];
1613 SCJbAppendObject(root_jb, jb);
1619 const char *filename =
"patterns.json";
1621 char json_path[PATH_MAX] =
"";
1622 snprintf(json_path,
sizeof(json_path),
"%s/%s%s", log_dir,
1626 FILE *fp = fopen(json_path,
"a");
1628 fwrite(SCJbPtr(root_jb), SCJbLen(root_jb), 1, fp);
1649 EngineAnalysisItemsReset(ea_ctx);
1657 FatalError(
"Unable to allocate analysis scratch pad");
1667 analyzer_item->
item_id = (uint16_t)item_id;
1668 if (analyzer_item->
item_id == -1) {
1670 FatalError(
"unable to initialize engine-analysis table: detect buffer \"%s\" not "
1703 uint32_t rule_bidirectional = 0;
1704 uint32_t rule_pcre = 0;
1705 uint32_t rule_pcre_http = 0;
1706 uint32_t rule_content = 0;
1707 uint32_t rule_flow = 0;
1708 uint32_t rule_flags = 0;
1709 uint32_t rule_flow_toserver = 0;
1710 uint32_t rule_flow_toclient = 0;
1711 uint32_t rule_flow_nostream = 0;
1712 uint32_t rule_ipv4_only = 0;
1713 uint32_t rule_ipv6_only = 0;
1714 uint32_t rule_flowbits = 0;
1715 uint32_t rule_flowint = 0;
1716 uint32_t rule_content_http = 0;
1717 uint32_t rule_content_offset_depth = 0;
1718 int32_t list_id = 0;
1719 uint32_t rule_warning = 0;
1720 uint32_t stream_buf = 0;
1721 uint32_t packet_buf = 0;
1722 uint32_t file_store = 0;
1723 uint32_t warn_pcre_no_content = 0;
1724 uint32_t warn_pcre_http_content = 0;
1725 uint32_t warn_pcre_http = 0;
1726 uint32_t warn_content_http_content = 0;
1727 uint32_t warn_content_http = 0;
1728 uint32_t warn_tcp_no_flow = 0;
1729 uint32_t warn_client_ports = 0;
1730 uint32_t warn_direction = 0;
1731 uint32_t warn_method_toclient = 0;
1732 uint32_t warn_method_serverbody = 0;
1733 uint32_t warn_pcre_method = 0;
1734 uint32_t warn_encoding_norm_http_buf = 0;
1735 uint32_t warn_file_store_not_present = 0;
1736 uint32_t warn_offset_depth_pkt_stream = 0;
1737 uint32_t warn_offset_depth_alproto = 0;
1738 uint32_t warn_non_alproto_fp_for_alproto_sig = 0;
1739 uint32_t warn_no_direction = 0;
1740 uint32_t warn_both_direction = 0;
1742 EngineAnalysisItemsInit(
de_ctx->
ea);
1748 rule_bidirectional = 1;
1762 rule_ipv4_only += 1;
1765 rule_ipv6_only += 1;
1773 if (item_slot == -1) {
1781 if (item_slot == -1) {
1786 rule_content_offset_depth++;
1792 rule_content_http++;
1799 warn_encoding_norm_http_buf += 1;
1806 rule_flow_toserver = 1;
1809 rule_flow_toclient = 1;
1814 rule_flow_nostream = 1;
1828 if (sm->
ctx != NULL) {
1838 warn_file_store_not_present = 1;
1841 if (rule_pcre > 0 && rule_content == 0 && rule_content_http == 0) {
1843 warn_pcre_no_content = 1;
1846 if (rule_content_http > 0 && rule_pcre > 0 && rule_pcre_http == 0) {
1848 warn_pcre_http_content = 1;
1854 if (rule_content > 0 && rule_content_http > 0) {
1856 warn_content_http_content = 1;
1860 warn_content_http = 1;
1862 if (rule_content == 1) {
1867 (rule_content || rule_content_http || rule_pcre || rule_pcre_http || rule_flowbits ||
1870 warn_tcp_no_flow = 1;
1872 if (rule_flow && !rule_bidirectional && (rule_flow_toserver || rule_flow_toclient)
1877 warn_client_ports = 1;
1880 if (rule_flow && rule_bidirectional && (rule_flow_toserver || rule_flow_toclient)) {
1885 if (*http_method_item_seen_ptr) {
1886 if (rule_flow && rule_flow_toclient) {
1888 warn_method_toclient = 1;
1890 if (*http_server_body_item_seen_ptr) {
1892 warn_method_serverbody = 1;
1894 if (rule_content == 0 && rule_content_http == 0 && (rule_pcre > 0 || rule_pcre_http > 0)) {
1896 warn_pcre_method = 1;
1899 if (rule_content_offset_depth > 0 && stream_buf && packet_buf) {
1901 warn_offset_depth_pkt_stream = 1;
1905 warn_offset_depth_alproto = 1;
1910 warn_non_alproto_fp_for_alproto_sig = 1;
1914 warn_no_direction += 1;
1922 warn_both_direction += 1;
1927 if (!rule_warnings_only || (rule_warnings_only && rule_warning > 0)) {
1929 fprintf(fp,
"== Sid: %u ==\n", s->
id);
1930 fprintf(fp,
"%s\n", line);
1936 fprintf(fp,
" Rule is ip only.\n");
1939 fprintf(fp,
" Rule is like ip only.\n");
1942 fprintf(fp,
" Rule is PD only.\n");
1945 fprintf(fp,
" Rule is DE only.\n");
1948 fprintf(fp,
" Rule is packet inspecting.\n");
1951 fprintf(fp,
" Rule is packet and stream inspecting.\n");
1954 fprintf(fp,
" Rule is stream inspecting.\n");
1957 fprintf(fp,
" Rule is app-layer inspecting.\n");
1960 fprintf(fp,
" Rule is App-layer TX inspecting.\n");
1966 fprintf(fp,
" Rule is IPv6 only.\n");
1968 fprintf(fp,
" Rule is IPv4 only.\n");
1970 fprintf(fp,
" Rule matches on packets.\n");
1971 if (!rule_flow_nostream && stream_buf &&
1972 (rule_flow || rule_flowbits || rule_flowint || rule_content || rule_pcre)) {
1973 fprintf(fp,
" Rule matches on reassembled stream.\n");
1978 fprintf(fp,
" Rule matches on %s buffer.\n", ai->
display_name);
1984 if (rule_content || rule_content_http || rule_pcre || rule_pcre_http) {
1986 " Rule contains %u content options, %u http content options, %u pcre "
1987 "options, and %u pcre options with http modifiers.\n",
1988 rule_content, rule_content_http, rule_pcre, rule_pcre_http);
1993 fprintf(fp,
" Prefilter on: %s.\n",
1996 EngineAnalysisRulesPrintFP(
de_ctx, s);
2000 if (warn_pcre_no_content ) {
2001 fprintf(fp,
" Warning: Rule uses pcre without a content option present.\n"
2002 " -Consider adding a content to improve performance of this "
2005 if (warn_pcre_http_content ) {
2006 fprintf(fp,
" Warning: Rule uses content options with http_* and pcre options "
2007 "without http modifiers.\n"
2008 " -Consider adding http pcre modifier.\n");
2010 else if (warn_pcre_http ) {
2011 fprintf(fp,
" Warning: Rule app layer protocol is http, but pcre options do not "
2012 "have http modifiers.\n"
2013 " -Consider adding http pcre modifiers.\n");
2015 if (warn_content_http_content ) {
2017 " Warning: Rule contains content with http_* and content without http_*.\n"
2018 " -Consider adding http content modifiers.\n");
2020 if (warn_content_http ) {
2021 fprintf(fp,
" Warning: Rule app layer protocol is http, but content options do not "
2022 "have http_* modifiers.\n"
2023 " -Consider adding http content modifiers.\n");
2025 if (rule_content == 1) {
2028 if (warn_encoding_norm_http_buf) {
2029 fprintf(fp,
" Warning: Rule may contain percent encoded content for a normalized "
2030 "http buffer match.\n");
2032 if (warn_tcp_no_flow
2034 fprintf(fp,
" Warning: TCP rule without a flow or flags option.\n"
2035 " -Consider adding flow or flags to improve performance of "
2038 if (warn_client_ports
2043 " Warning: Rule contains ports or port variables only on the client side.\n"
2044 " -Flow direction possibly inconsistent with rule.\n");
2046 if (warn_direction ) {
2047 fprintf(fp,
" Warning: Rule is bidirectional and has a flow option with a specific "
2050 if (warn_method_toclient ) {
2051 fprintf(fp,
" Warning: Rule uses content or pcre for http_method with "
2052 "flow:to_client or from_server\n");
2054 if (warn_method_serverbody ) {
2055 fprintf(fp,
" Warning: Rule uses content or pcre for http_method with content or "
2056 "pcre for http_server_body.\n");
2058 if (warn_pcre_method
2060 fprintf(fp,
" Warning: Rule uses pcre with only a http_method content; possible "
2061 "performance issue.\n");
2063 if (warn_offset_depth_pkt_stream) {
2064 fprintf(fp,
" Warning: Rule has depth"
2065 "/offset with raw content keywords. Please note the "
2066 "offset/depth will be checked against both packet "
2067 "payloads and stream. If you meant to have the offset/"
2068 "depth checked against just the payload, you can update "
2069 "the signature as \"alert tcp-pkt...\"\n");
2071 if (warn_offset_depth_alproto) {
2073 " Warning: Rule has "
2074 "offset/depth set along with a match on a specific "
2075 "app layer protocol - %d. This can lead to FNs if we "
2076 "have a offset/depth content match on a packet payload "
2077 "before we can detect the app layer protocol for the "
2081 if (warn_non_alproto_fp_for_alproto_sig) {
2082 fprintf(fp,
" Warning: Rule app layer "
2083 "protocol is http, but the fast_pattern is set on the raw "
2084 "stream. Consider adding fast_pattern over a http "
2085 "buffer for increased performance.");
2087 if (warn_no_direction) {
2088 fprintf(fp,
" Warning: Rule has no direction indicator.\n");
2090 if (warn_both_direction) {
2091 fprintf(fp,
" Warning: Rule is inspecting both the request and the response.\n");
2093 if (warn_file_store_not_present) {
2094 fprintf(fp,
" Warning: Rule requires file-store but the output file-store is not "
2097 if (rule_warning == 0) {
2098 fprintf(fp,
" No warnings for this rule.\n");
2107 const uint8_t state,
const uint8_t direction)
2109 char policy_string[64] =
"";
2112 if (direction == STREAM_TOSERVER) {
2113 p = &fw_policies->
app[a].
ts[state];
2115 p = &fw_policies->
app[a].
tc[state];
2123 snprintf(policy_string,
sizeof(policy_string),
"rejectdst:%s", as);
2125 snprintf(policy_string,
sizeof(policy_string),
"rejectboth:%s", as);
2127 snprintf(policy_string,
sizeof(policy_string),
"rejectsrc:%s", as);
2130 snprintf(policy_string,
sizeof(policy_string),
"drop:%s", as);
2132 snprintf(policy_string,
sizeof(policy_string),
"accept:%s", as);
2138 strlcat(policy_string,
",pass:flow",
sizeof(policy_string));
2143 SCJbSetString(
ctx->js,
"policy", policy_string);
2149 uint32_t accept_rules = 0;
2150 AddPolicy(
de_ctx,
ctx, a, state, direction);
2151 SCJbOpenArray(
ctx->js,
"rules");
2160 if (direction == STREAM_TOSERVER) {
2182 if (accept_rules == 0) {
2183 AnalyzerWarning(
ctx, (
char *)
"no accept rules for state, default policy will be applied");
2190 ctx.js = SCJbNewObject();
2194 SCJbOpenObject(
ctx.js,
"tables");
2195 SCJbOpenObject(
ctx.js,
"packet:filter");
2196 SCJbSetString(
ctx.js,
"policy",
"drop:packet");
2197 SCJbOpenArray(
ctx.js,
"rules");
2198 uint32_t accept_rules = 0;
2199 uint32_t last_sid = 0;
2206 if (last_sid == s->
id)
2213 if (accept_rules == 0) {
2214 AnalyzerWarning(&
ctx,
2215 (
char *)
"no accept rules for \'packet:filter\', default policy will be applied");
2217 if (
ctx.js_warnings) {
2218 SCJbClose(
ctx.js_warnings);
2219 SCJbSetObject(
ctx.js,
"warnings",
ctx.js_warnings);
2220 SCJbFree(
ctx.js_warnings);
2221 ctx.js_warnings = NULL;
2226 if (!AppProtoIsValid(a))
2229 const uint8_t complete_state_ts =
2232 for (uint8_t state = 0; state <= complete_state_ts; state++) {
2237 name =
"request-started";
2238 else if (state == complete_state_ts)
2239 name =
"request-complete";
2244 char table_name[128];
2246 SCJbOpenObject(
ctx.js, table_name);
2247 FirewallAddRulesForState(
de_ctx, a, state, STREAM_TOSERVER, &
ctx);
2248 if (
ctx.js_warnings) {
2249 SCJbClose(
ctx.js_warnings);
2250 SCJbSetObject(
ctx.js,
"warnings",
ctx.js_warnings);
2251 SCJbFree(
ctx.js_warnings);
2252 ctx.js_warnings = NULL;
2256 const uint8_t complete_state_tc =
2258 for (uint8_t state = 0; state <= complete_state_tc; state++) {
2263 name =
"response-started";
2264 else if (state == complete_state_tc)
2265 name =
"response-complete";
2269 char table_name[128];
2271 SCJbOpenObject(
ctx.js, table_name);
2272 FirewallAddRulesForState(
de_ctx, a, state, STREAM_TOCLIENT, &
ctx);
2273 if (
ctx.js_warnings) {
2274 SCJbClose(
ctx.js_warnings);
2275 SCJbSetObject(
ctx.js,
"warnings",
ctx.js_warnings);
2276 SCJbFree(
ctx.js_warnings);
2277 ctx.js_warnings = NULL;
2283 SCJbOpenObject(
ctx.js,
"packet:td");
2284 SCJbSetString(
ctx.js,
"policy",
"accept:hook");
2286 SCJbOpenArray(
ctx.js,
"rules");
2292 if (last_sid == s->
id)
2299 SCJbOpenObject(
ctx.js,
"app:td");
2300 SCJbSetString(
ctx.js,
"policy",
"accept:hook");
2302 SCJbOpenArray(
ctx.js,
"rules");
2308 if (last_sid == s->
id)
2317 SCJbOpenObject(
ctx.js,
"lists");
2318 SCJbOpenObject(
ctx.js,
"firewall");
2320 SCJbOpenArray(
ctx.js,
"rules");
2324 if (last_sid == s->
id)
2332 SCJbOpenObject(
ctx.js,
"td");
2334 SCJbOpenArray(
ctx.js,
"rules");
2338 if (last_sid == s->
id)
2346 SCJbOpenObject(
ctx.js,
"all");
2348 SCJbOpenArray(
ctx.js,
"rules");
2350 if (last_sid == s->
id)
2362 const char *filename =
"firewall.json";
2364 char json_path[PATH_MAX] =
"";
2365 snprintf(json_path,
sizeof(json_path),
"%s/%s", log_dir, filename);
2368 FILE *fp = fopen(json_path,
"w");
2370 fwrite(SCJbPtr(
ctx.js), SCJbLen(
ctx.js), 1, fp);
#define DETECT_PCRE_CASELESS
#define DETECT_CONTENT_NOCASE
int SignatureHasPacketContent(const Signature *s)
check if a signature has patterns that are to be inspected against a packets payload (as opposed to t...
#define HashListTableGetListData(hb)
uint32_t rule_state_dependant_sids_idx
#define DETECT_CONTENT_RELATIVE_NEXT
struct DetectEngineAppInspectionEngine_::@82 v2
int SCConfValIsTrue(const char *val)
Check if a value is true.
#define SIG_MASK_REQUIRE_REAL_PKT
#define DETECT_CONTENT_FAST_PATTERN_CHOP
struct SigMatch_ * smlists[DETECT_SM_LIST_MAX]
#define SIG_FLAG_FW_HOOK_LTE
SigTableElmt * sigmatch_table
struct DetectFirewallPolicy tc[48]
const char * AppLayerParserGetStateNameById(uint8_t ipproto, AppProto alproto, const int id, const uint8_t direction)
struct DetectEngineAppInspectionEngine_ * next
#define DETECT_PROTO_IPV6
#define DETECT_FLOW_FLAG_NOSTREAM
const char * DetectListToHumanString(int list)
HashListTable * pattern_hash_table
void DumpPatterns(DetectEngineCtx *de_ctx)
#define DETECT_BYTEJUMP_LITTLE
void SetupEngineAnalysis(DetectEngineCtx *de_ctx, bool *fp_analysis, bool *rule_analysis)
uint8_t app_progress_hook
FILE * rule_engine_analysis_fp
bool is_rule_state_dependant
#define DETECT_BYTETEST_BASE_HEX
const char * ActionScopeToString(enum ActionScope s)
void DetectContentPatternPrettyPrint(const uint8_t *pat, const uint16_t pat_len, char *str, size_t str_len)
SCMutex g_rules_analyzer_write_m
const char * display_name
#define DETECT_CONTENT_WITHIN2DEPTH
@ DETECT_SM_LIST_DYNAMIC_START
#define DETECT_FLOWBITS_CMD_ISNOTSET
#define SIG_FLAG_DEST_IS_TARGET
#define DETECT_CONTENT_NO_DOUBLE_INSPECTION_REQUIRED
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its string equivalent.
#define DETECT_BYTEJUMP_BASE_OCT
const DetectEngineTransforms * transforms
main detection engine ctx
int AppLayerParserGetStateProgressCompletionStatus(AppProto alproto, uint8_t direction)
#define DETECT_BYTETEST_DCE
HashListTableBucket * HashListTableGetListHead(HashListTable *ht)
FpPatternStats fp_pattern_stats[DETECT_SM_LIST_MAX]
const char * DetectEngineBufferTypeGetNameById(const DetectEngineCtx *de_ctx, const int id)
#define SIG_FLAG_REQUIRE_STREAM
#define DETECT_XBITS_TRACK_IPDST
FILE * fp_engine_analysis_fp
int SCConfGetBool(const char *name, int *val)
Retrieve a configuration value as a boolean.
bool analyzer_initialized
#define ACTION_REJECT_ANY
#define DETECT_BYTEJUMP_DCE
const struct DetectContentData_ * cd
const char * VarNameStoreSetupLookup(const uint32_t id, const enum VarTypes type)
#define SCMUTEX_INITIALIZER
SigMatchData * sm_arrays[DETECT_SM_LIST_MAX]
#define DETECT_FLOWBITS_CMD_TOGGLE
struct DetectFirewallAppPolicy app[]
#define DETECT_FLOWBITS_CMD_ISSET
const char * SCConfNodeLookupChildValue(const SCConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
int16_t analyzer_item_map[256]
#define SIG_FLAG_TOCLIENT
#define DETECT_BYTEJUMP_BIG
void EngineAnalysisRulesFailure(const DetectEngineCtx *de_ctx, const char *line, const char *file, int lineno)
DetectEngineFrameInspectionEngine * frame_inspect
const DetectEngineTransforms * transforms
DetectEngineAnalyzerItems * analyzer_items
#define DETECT_PERCENT_ENCODING_REGEX
int FirewallAnalyzer(const DetectEngineCtx *de_ctx)
#define SIG_FLAG_APPLAYER
int DetectBufferTypeGetByName(const char *name)
#define SIG_FLAG_FIREWALL
#define ACTION_REJECT_DST
#define ATTR_FMT_PRINTF(x, y)
#define HashListTableGetListNext(hb)
SignaturePropertyFlowAction
#define SIG_FLAG_TOSERVER
#define DETECT_XBITS_CMD_ISNOTSET
#define DETECT_BYTETEST_RELATIVE
const char * IpOptsFlagToString(uint16_t flag)
Return human readable value for ipopts flag.
#define JB_SET_STRING(jb, key, val)
struct EngineAnalysisCtx_ EngineAnalysisCtx
struct DetectFirewallPolicies * fw_policies
#define DETECT_CONTENT_ENDS_WITH
#define DETECT_PCRE_RAWBYTES
#define DETECT_CONTENT_DISTANCE
#define SIG_FLAG_INIT_BIDIREC
size_t strlcat(char *, const char *src, size_t siz)
#define SIG_MASK_REQUIRE_ENGINE_EVENT
#define DETECT_BYTETEST_BASE_UNSET
#define DETECT_BYTEJUMP_ALIGN
const char * DetectEngineBufferTypeGetDescriptionById(const DetectEngineCtx *de_ctx, const int id)
#define SCMutexUnlock(mut)
#define DETECT_BYTETEST_BASE_DEC
#define SIG_MASK_REQUIRE_FLOW
#define DETECT_CONTENT_DEPTH
#define DETECT_CONTENT_DISTANCE2OFFSET
#define DETECT_BYTEJUMP_END
DetectEnginePktInspectionEngine * pkt_inspect
struct DetectEngineAnalyzerItems DetectEngineAnalyzerItems
#define SIG_MASK_REQUIRE_FLAGS_INITDEINIT
uint32_t rule_state_flowbits_ids_size
#define DETECT_XBITS_TRACK_IPPAIR
#define DETECT_CONTENT_NEGATED
DetectUintData_u8 DetectU8Data
struct DetectFirewallPolicy ts[48]
void EngineAnalysisRules(const DetectEngineCtx *de_ctx, const Signature *s, const char *line)
Prints analysis of loaded rules.
DetectEngineAppInspectionEngine * app_inspect
SCJsonBuilder * js_warnings
#define SIG_FLAG_REQUIRE_FLOWVAR
struct DetectEngineFrameInspectionEngine::@86 v1
#define DETECT_BYTETEST_BIG
struct tm * SCLocalTime(time_t timep, struct tm *result)
const char * SCConfigGetLogDirectory(void)
const DetectBufferType * DetectEngineBufferTypeGetById(const DetectEngineCtx *de_ctx, const int id)
#define DETECT_BYTEJUMP_BASE_UNSET
SignatureInitData * init_data
#define SIG_FLAG_SRC_IS_TARGET
uint32_t * rule_state_dependant_sids_array
bool fp_engine_analysis_set
uint32_t rule_state_dependant_sids_size
#define DETECT_BYTEJUMP_BASE_HEX
@ SIG_PROP_FLOW_ACTION_PACKET
const struct SignatureProperties signature_properties[SIG_TYPE_MAX]
#define SIG_MASK_REQUIRE_PAYLOAD
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
#define DETECT_BYTEJUMP_OFFSET_BE
const char * DetectSigmatchListEnumToString(enum DetectSigmatchListEnum type)
const DetectEngineAnalyzerItems analyzer_items[]
#define SIG_FLAG_INIT_STATE_MATCH
#define DETECT_XBITS_TRACK_TX
void EngineAnalysisRules2(const DetectEngineCtx *de_ctx, const Signature *s)
#define ACTION_REJECT_BOTH
union DetectFlowintData_::@68 target
#define DETECT_CONTENT_STARTS_WITH
#define DETECT_PROTO_IPV4
int SignatureHasStreamContent(const Signature *s)
check if a signature has patterns that are to be inspected against the stream payload (as opposed to ...
#define SIG_MASK_REQUIRE_NO_PAYLOAD
struct DetectEnginePktInspectionEngine::@85 v1
@ SIG_PROP_FLOW_ACTION_FLOW_IF_STATEFUL
void HashListTableFree(HashListTable *ht)
bool check_encoding_match
void CleanupEngineAnalysis(DetectEngineCtx *de_ctx)
struct DetectEngineFrameInspectionEngine * next
DetectUintData_u32 DetectU32Data
struct DetectEnginePktInspectionEngine * next
#define DETECT_BYTEJUMP_BASE_DEC
void PrintRawUriFp(FILE *fp, const uint8_t *buf, uint32_t buflen)
#define SIG_MASK_REQUIRE_FLAGS_UNUSUAL
@ FLOWINT_MODIFIER_ISNOTSET
struct EngineAnalysisCtx_ * ea
#define DETECT_BYTETEST_BASE_OCT
void EngineAnalysisFP(const DetectEngineCtx *de_ctx, const Signature *s, const char *line)
struct FpPatternStats_ FpPatternStats
SCConfNode * SCConfGetNode(const char *name)
Get a SCConfNode by name.
#define SCLogError(...)
Macro used to log ERROR messages.
int SigMatchListSMBelongsTo(const Signature *s, const SigMatch *key_sm)
#define DETECT_CONTENT_OFFSET
#define DETECT_XBITS_TRACK_IPSRC
#define DETECT_FLOWBITS_CMD_UNSET
#define DETECT_CONTENT_FAST_PATTERN_ONLY
#define DETECT_CONTENT_MPM
DetectEngineTransforms transforms
a single match condition for a signature
const DetectEngineTransforms * transforms
bool SCRequiresFeature(const char *feature_name)
#define DETECT_XBITS_CMD_ISSET
#define DETECT_BYTETEST_STRING
#define DETECT_PCRE_RELATIVE_NEXT
#define DETECT_BYTEJUMP_STRING
#define DETECT_XBITS_CMD_SET
#define DETECT_BYTEJUMP_BEGIN
uint32_t * rule_state_flowbits_ids_array
@ SIG_PROP_FLOW_ACTION_FLOW
#define DETECT_PCRE_RELATIVE
struct RuleAnalyzer RuleAnalyzer
#define SIG_FLAG_TLSSTORE
#define DETECT_XBITS_CMD_TOGGLE
DetectUintData_u16 DetectU16Data
#define DETECT_XBITS_CMD_UNSET
#define DETECT_CONTENT_FAST_PATTERN
#define DETECT_PCRE_NEGATE
struct ExposedItemSeen exposed_item_seen_list[2]
#define DETECT_BYTETEST_LITTLE
#define DEBUG_VALIDATE_BUG_ON(exp)
#define SIG_FLAG_PREFILTER
enum SignaturePropertyFlowAction flow_action
#define SIG_FLAG_FILESTORE
#define DETECT_CONTENT_WITHIN
#define DETECT_BYTEJUMP_RELATIVE
#define DETECT_FLOWBITS_CMD_SET
int DetectProtoContainsProto(const DetectProto *dp, int proto)
see if a DetectProto contains a certain proto
#define SIG_FLAG_REQUIRE_PACKET