54 #define DETECT_BYTE_EXTRACT_ENDIAN_DEFAULT DETECT_BYTE_EXTRACT_ENDIAN_BIG
58 #define DETECT_BYTE_EXTRACT_BASE_NONE 0
59 #define DETECT_BYTE_EXTRACT_BASE_HEX 16
60 #define DETECT_BYTE_EXTRACT_BASE_DEC 10
61 #define DETECT_BYTE_EXTRACT_BASE_OCT 8
66 #define DETECT_BYTE_EXTRACT_MULTIPLIER_DEFAULT 1
68 #define DETECT_BYTE_EXTRACT_MULTIPLIER_MIN_LIMIT 1
69 #define DETECT_BYTE_EXTRACT_MULTIPLIER_MAX_LIMIT 65535
73 #define STRING_MAX_BYTES_TO_EXTRACT_FOR_OCT 23
74 #define STRING_MAX_BYTES_TO_EXTRACT_FOR_DEC 20
75 #define STRING_MAX_BYTES_TO_EXTRACT_FOR_HEX 14
77 #define NO_STRING_MAX_BYTES_TO_EXTRACT 8
79 #define PARSE_REGEX "^" \
81 ",\\s*(-?[0-9]+)\\s*" \
82 ",\\s*([^\\s,]+)\\s*" \
83 "(?:(?:,\\s*([^\\s,]+)\\s*)|(?:,\\s*([^\\s,]+)\\s+([^\\s,]+)\\s*))?" \
84 "(?:(?:,\\s*([^\\s,]+)\\s*)|(?:,\\s*([^\\s,]+)\\s+([^\\s,]+)\\s*))?" \
85 "(?:(?:,\\s*([^\\s,]+)\\s*)|(?:,\\s*([^\\s,]+)\\s+([^\\s,]+)\\s*))?" \
86 "(?:(?:,\\s*([^\\s,]+)\\s*)|(?:,\\s*([^\\s,]+)\\s+([^\\s,]+)\\s*))?" \
87 "(?:(?:,\\s*([^\\s,]+)\\s*)|(?:,\\s*([^\\s,]+)\\s+([^\\s,]+)\\s*))?" \
94 static void DetectByteExtractRegisterTests(
void);
120 const uint8_t *ptr = NULL;
133 SCLogDebug(
"relative, working with det_ctx->buffer_offset %"PRIu32
", "
150 ptr = payload + data->
offset;
155 if (ptr < payload || data->nbytes >
len) {
156 SCLogDebug(
"Data not within payload pkt=%p, ptr=%p, len=%"PRIu32
", nbytes=%d",
164 data->
nbytes, (
const char *)ptr);
171 SCLogDebug(
"error extracting %d bytes of string data: %d",
180 if (extbytes != data->
nbytes) {
181 SCLogDebug(
"error extracting %d bytes of numeric data: %d",
200 SCLogDebug(
"extracted value is %"PRIu64, val);
217 int ret = 0, res = 0;
222 if (ret < 3 || ret > 19) {
223 SCLogError(
"parse error, ret %" PRId32
", string \"%s\"", ret, arg);
224 SCLogError(
"Invalid arg to byte_extract : %s "
236 char nbytes_str[64] =
"";
237 pcre2len =
sizeof(nbytes_str);
238 res = pcre2_substring_copy_bynumber(
239 parse_regex.
match, 1, (PCRE2_UCHAR8 *)nbytes_str, &pcre2len);
241 SCLogError(
"pcre2_substring_copy_bynumber failed "
242 "for arg 1 for byte_extract");
246 (
const char *)nbytes_str) < 0) {
247 SCLogError(
"Invalid value for number of bytes"
248 " to be extracted: \"%s\".",
254 char offset_str[64] =
"";
255 pcre2len =
sizeof(offset_str);
256 res = pcre2_substring_copy_bynumber(
257 parse_regex.
match, 2, (PCRE2_UCHAR8 *)offset_str, &pcre2len);
259 SCLogError(
"pcre2_substring_copy_bynumber failed "
260 "for arg 2 for byte_extract");
265 SCLogError(
"Invalid value for offset: \"%s\".", offset_str);
271 char varname_str[256] =
"";
272 pcre2len =
sizeof(varname_str);
273 res = pcre2_substring_copy_bynumber(
274 parse_regex.
match, 3, (PCRE2_UCHAR8 *)varname_str, &pcre2len);
276 SCLogError(
"pcre2_substring_copy_bynumber failed "
277 "for arg 3 for byte_extract");
281 if (bed->
name == NULL)
285 for (i = 4; i < ret; i++) {
286 char opt_str[64] =
"";
287 pcre2len =
sizeof(opt_str);
290 SCLogError(
"pcre2_substring_copy_bynumber failed "
291 "for arg %d for byte_extract with %d",
296 if (strcmp(
"relative", opt_str) == 0) {
299 "than once for byte_extract");
303 }
else if (strcmp(
"multiplier", opt_str) == 0) {
306 "than once for byte_extract");
312 char multiplier_str[16] =
"";
313 pcre2len =
sizeof(multiplier_str);
314 res = pcre2_substring_copy_bynumber(
315 parse_regex.
match, i, (PCRE2_UCHAR8 *)multiplier_str, &pcre2len);
317 SCLogError(
"pcre2_substring_copy_bynumber failed "
318 "for arg %d for byte_extract",
327 "multiplier: \"%s\".",
332 }
else if (strcmp(
"big", opt_str) == 0) {
335 "more than once for byte_extract");
340 }
else if (strcmp(
"little", opt_str) == 0) {
343 "more than once for byte_extract");
348 }
else if (strcmp(
"dce", opt_str) == 0) {
351 "more than once for byte_extract");
356 }
else if (strcmp(
"string", opt_str) == 0) {
359 "than once for byte_extract");
364 "base is (string, base) and not (base, string) "
369 }
else if (strcmp(
"hex", opt_str) == 0) {
372 "without specifying string. The right way is "
373 "(string, base) and not (base, string)");
378 "specified for byte_extract");
382 }
else if (strcmp(
"oct", opt_str) == 0) {
385 "without specifying string. The right way is "
386 "(string, base) and not (base, string)");
391 "specified for byte_extract");
395 }
else if (strcmp(
"dec", opt_str) == 0) {
398 "without specifying string. The right way is "
399 "(string, base) and not (base, string)");
404 "specified for byte_extract");
408 }
else if (strcmp(
"align", opt_str) == 0) {
411 "than once for byte_extract");
417 char align_str[16] =
"";
418 pcre2len =
sizeof(align_str);
419 res = pcre2_substring_copy_bynumber(
420 parse_regex.
match, i, (PCRE2_UCHAR8 *)align_str, &pcre2len);
422 SCLogError(
"pcre2_substring_copy_bynumber failed "
423 "for arg %d in byte_extract",
428 (
const char *)align_str) < 0) {
436 "byte_extract - \"%d\"",
440 }
else if (strcmp(
"", opt_str) == 0) {
444 "specified in byte_extract",
463 "endian \"big\" or \"little\" specified along with "
472 "more than %d bytes in \"string\" extraction",
481 "more than %d bytes in \"string\" extraction",
490 "more than %d bytes in \"string\" extraction",
500 "more than %d bytes in \"non-string\" extraction",
513 DetectByteExtractFree(
de_ctx, bed);
537 data = DetectByteExtractParse(
de_ctx, arg);
553 if (prev_pm == NULL) {
573 if (prev_pm == NULL) {
596 "A byte_jump keyword with dce holds other invalid modifiers.");
603 if (prev_bed_sm == NULL)
615 sm->
ctx = (
void *)data;
637 DetectByteExtractFree(
de_ctx, data);
650 if (bed->
name != NULL)
673 if (strcmp(bed->
name, arg) == 0) {
686 if (strcmp(bed->
name, arg) == 0) {
701 static int g_file_data_buffer_id = 0;
702 static int g_http_uri_buffer_id = 0;
704 static int DetectByteExtractTest01(
void)
714 strcmp(bed->
name,
"one") != 0 ||
726 DetectByteExtractFree(NULL, bed);
730 static int DetectByteExtractTest02(
void)
740 strcmp(bed->
name,
"one") != 0 ||
752 DetectByteExtractFree(NULL, bed);
756 static int DetectByteExtractTest03(
void)
766 strcmp(bed->
name,
"one") != 0 ||
778 DetectByteExtractFree(NULL, bed);
782 static int DetectByteExtractTest04(
void)
792 strcmp(bed->
name,
"one") != 0 ||
805 DetectByteExtractFree(NULL, bed);
809 static int DetectByteExtractTest05(
void)
819 strcmp(bed->
name,
"one") != 0 ||
831 DetectByteExtractFree(NULL, bed);
835 static int DetectByteExtractTest06(
void)
845 strcmp(bed->
name,
"one") != 0 ||
857 DetectByteExtractFree(NULL, bed);
861 static int DetectByteExtractTest07(
void)
871 strcmp(bed->
name,
"one") != 0 ||
883 DetectByteExtractFree(NULL, bed);
887 static int DetectByteExtractTest08(
void)
897 strcmp(bed->
name,
"one") != 0 ||
909 DetectByteExtractFree(NULL, bed);
913 static int DetectByteExtractTest09(
void)
923 strcmp(bed->
name,
"one") != 0 ||
935 DetectByteExtractFree(NULL, bed);
939 static int DetectByteExtractTest10(
void)
949 strcmp(bed->
name,
"one") != 0 ||
961 DetectByteExtractFree(NULL, bed);
965 static int DetectByteExtractTest11(
void)
975 strcmp(bed->
name,
"one") != 0 ||
987 DetectByteExtractFree(NULL, bed);
991 static int DetectByteExtractTest12(
void)
1001 strcmp(bed->
name,
"one") != 0 ||
1014 DetectByteExtractFree(NULL, bed);
1018 static int DetectByteExtractTest13(
void)
1028 strcmp(bed->
name,
"one") != 0 ||
1042 DetectByteExtractFree(NULL, bed);
1046 static int DetectByteExtractTest14(
void)
1056 strcmp(bed->
name,
"one") != 0 ||
1070 DetectByteExtractFree(NULL, bed);
1074 static int DetectByteExtractTest15(
void)
1084 strcmp(bed->
name,
"one") != 0 ||
1098 DetectByteExtractFree(NULL, bed);
1102 static int DetectByteExtractTest16(
void)
1106 DetectByteExtractData *bed = DetectByteExtractParse(NULL,
"4, 2, one, align 4, relative, little, multiplier 2");
1112 strcmp(bed->
name,
"one") != 0 ||
1127 DetectByteExtractFree(NULL, bed);
1131 static int DetectByteExtractTest17(
void)
1136 "relative, little, "
1137 "multiplier 2, string hex");
1144 DetectByteExtractFree(NULL, bed);
1148 static int DetectByteExtractTest18(
void)
1153 "relative, little, "
1162 DetectByteExtractFree(NULL, bed);
1166 static int DetectByteExtractTest19(
void)
1171 "relative, little, "
1180 DetectByteExtractFree(NULL, bed);
1184 static int DetectByteExtractTest20(
void)
1198 DetectByteExtractFree(NULL, bed);
1202 static int DetectByteExtractTest21(
void)
1216 DetectByteExtractFree(NULL, bed);
1220 static int DetectByteExtractTest22(
void)
1234 DetectByteExtractFree(NULL, bed);
1238 static int DetectByteExtractTest23(
void)
1252 DetectByteExtractFree(NULL, bed);
1256 static int DetectByteExtractTest24(
void)
1269 DetectByteExtractFree(NULL, bed);
1273 static int DetectByteExtractTest25(
void)
1286 DetectByteExtractFree(NULL, bed);
1290 static int DetectByteExtractTest26(
void)
1297 "multiplier 65536");
1304 DetectByteExtractFree(NULL, bed);
1308 static int DetectByteExtractTest27(
void)
1322 DetectByteExtractFree(NULL, bed);
1326 static int DetectByteExtractTest28(
void)
1337 DetectByteExtractFree(NULL, bed);
1341 static int DetectByteExtractTest29(
void)
1352 DetectByteExtractFree(NULL, bed);
1356 static int DetectByteExtractTest30(
void)
1367 DetectByteExtractFree(NULL, bed);
1371 static int DetectByteExtractTest31(
void)
1382 DetectByteExtractFree(NULL, bed);
1386 static int DetectByteExtractTest32(
void)
1397 DetectByteExtractFree(NULL, bed);
1401 static int DetectByteExtractTest33(
void)
1412 DetectByteExtractFree(NULL, bed);
1416 static int DetectByteExtractTest34(
void)
1431 "(msg:\"Testing bytejump_body\"; "
1433 "byte_extract:4,2,two,relative,string,hex; "
1459 printf(
"one failed\n");
1492 static int DetectByteExtractTest35(
void)
1508 "(msg:\"Testing bytejump_body\"; "
1509 "content:\"one\"; pcre:/asf/; "
1510 "byte_extract:4,0,two,relative,string,hex; "
1536 printf(
"one failed\n");
1560 strcmp(bed->
name,
"two") != 0 ||
1580 static int DetectByteExtractTest36(
void)
1596 "(msg:\"Testing bytejump_body\"; "
1597 "content:\"one\"; byte_jump:1,13; "
1598 "byte_extract:4,0,two,relative,string,hex; "
1624 printf(
"one failed\n");
1635 if (bjd->
flags != 0) {
1648 strcmp(bed->
name,
"two") != 0 ||
1668 static int DetectByteExtractTest37(
void)
1684 "(msg:\"Testing bytejump_body\"; "
1685 "content:\"one\"; uricontent:\"two\"; "
1686 "byte_extract:4,0,two,relative,string,hex; "
1712 printf(
"one failed\n");
1717 if (sm->
next != NULL) {
1736 printf(
"two failed\n");
1749 strcmp(bed->
name,
"two") != 0 ||
1769 static int DetectByteExtractTest38(
void)
1785 "(msg:\"Testing bytejump_body\"; "
1786 "content:\"one\"; uricontent:\"two\"; "
1787 "byte_extract:4,0,two,string,hex; "
1813 printf(
"one failed\n");
1826 strcmp(bed->
name,
"two") != 0 ||
1849 printf(
"two failed\n");
1854 if (sm->
next != NULL) {
1869 static int DetectByteExtractTest39(
void)
1885 "(msg:\"Testing bytejump_body\"; "
1886 "content:\"one\"; content:\"two\"; http_uri; "
1887 "byte_extract:4,0,two,relative,string,hex; "
1913 printf(
"one failed\n");
1918 if (sm->
next != NULL) {
1937 printf(
"two failed\n");
1950 strcmp(bed->
name,
"two") != 0 ||
1970 static int DetectByteExtractTest40(
void)
1986 "(msg:\"Testing bytejump_body\"; "
1987 "content:\"one\"; content:\"two\"; http_uri; "
1988 "byte_extract:4,0,two,string,hex; "
2014 printf(
"one failed\n");
2027 strcmp(bed->
name,
"two") != 0 ||
2050 printf(
"two failed\n");
2055 if (sm->
next != NULL) {
2070 static int DetectByteExtractTest41(
void)
2085 "(msg:\"Testing bytejump_body\"; "
2087 "byte_extract:4,0,two,string,hex; "
2088 "byte_extract:4,0,three,string,hex; "
2114 printf(
"one failed\n");
2127 strcmp(bed->
name,
"two") != 0 ||
2148 strcmp(bed->
name,
"three") != 0 ||
2171 static int DetectByteExtractTest42(
void)
2187 "(msg:\"Testing bytejump_body\"; "
2189 "byte_extract:4,0,two,string,hex; "
2190 "uricontent: \"three\"; "
2191 "byte_extract:4,0,four,string,hex,relative; "
2192 "byte_extract:4,0,five,string,hex; "
2218 printf(
"one failed\n");
2231 strcmp(bed->
name,
"two") != 0 ||
2252 strcmp(bed->
name,
"five") != 0 ||
2265 if (sm->
next != NULL)
2282 printf(
"two failed\n");
2295 strcmp(bed->
name,
"four") != 0 ||
2309 if (sm->
next != NULL)
2322 static int DetectByteExtractTest43(
void)
2337 "(msg:\"Testing bytejump_body\"; "
2339 "byte_extract:4,0,two,string,hex; "
2340 "content: \"three\"; offset:two; "
2366 printf(
"one failed\n");
2379 strcmp(bed->
name,
"two") != 0 ||
2402 printf(
"three failed\n");
2407 if (sm->
next != NULL)
2420 static int DetectByteExtractTest44(
void)
2436 "(msg:\"Testing bytejump_body\"; "
2438 "byte_extract:4,0,two,string,hex; "
2439 "byte_extract:4,0,three,string,hex; "
2440 "content: \"four\"; offset:two; "
2441 "content: \"five\"; offset:three; "
2467 printf(
"one failed\n");
2480 strcmp(bed1->
name,
"two") != 0 ||
2510 printf(
"four failed\n");
2525 printf(
"five failed\n");
2530 if (sm->
next != NULL)
2543 static int DetectByteExtractTest45(
void)
2558 "(msg:\"Testing bytejump_body\"; "
2560 "byte_extract:4,0,two,string,hex; "
2561 "content: \"three\"; depth:two; "
2587 printf(
"one failed\n");
2600 strcmp(bed->
name,
"two") != 0 ||
2624 printf(
"three failed\n");
2629 if (sm->
next != NULL)
2642 static int DetectByteExtractTest46(
void)
2658 "(msg:\"Testing bytejump_body\"; "
2660 "byte_extract:4,0,two,string,hex; "
2661 "byte_extract:4,0,three,string,hex; "
2662 "content: \"four\"; depth:two; "
2663 "content: \"five\"; depth:three; "
2689 printf(
"one failed\n");
2702 strcmp(bed1->
name,
"two") != 0 ||
2732 printf(
"four failed\n");
2747 printf(
"five failed\n");
2752 if (sm->
next != NULL)
2765 static int DetectByteExtractTest47(
void)
2780 "(msg:\"Testing bytejump_body\"; "
2782 "byte_extract:4,0,two,string,hex; "
2783 "content: \"three\"; distance:two; "
2809 printf(
"one failed\n");
2822 strcmp(bed->
name,
"two") != 0 ||
2847 printf(
"three failed\n");
2852 if (sm->
next != NULL)
2865 static int DetectByteExtractTest48(
void)
2881 "(msg:\"Testing bytejump_body\"; "
2883 "byte_extract:4,0,two,string,hex; "
2884 "byte_extract:4,0,three,string,hex; "
2885 "content: \"four\"; distance:two; "
2886 "content: \"five\"; distance:three; "
2912 printf(
"one failed\n");
2925 strcmp(bed1->
name,
"two") != 0 ||
2958 printf(
"four failed\n");
2975 printf(
"five failed\n");
2980 if (sm->
next != NULL)
2993 static int DetectByteExtractTest49(
void)
3008 "(msg:\"Testing bytejump_body\"; "
3010 "byte_extract:4,0,two,string,hex; "
3011 "content: \"three\"; within:two; "
3037 printf(
"one failed\n");
3050 strcmp(bed->
name,
"two") != 0 ||
3076 printf(
"three failed\n");
3081 if (sm->
next != NULL)
3094 static int DetectByteExtractTest50(
void)
3110 "(msg:\"Testing bytejump_body\"; "
3112 "byte_extract:4,0,two,string,hex; "
3113 "byte_extract:4,0,three,string,hex; "
3114 "content: \"four\"; within:two; "
3115 "content: \"five\"; within:three; "
3141 printf(
"one failed\n");
3154 strcmp(bed1->
name,
"two") != 0 ||
3188 printf(
"four failed\n");
3206 printf(
"five failed\n");
3211 if (sm->
next != NULL)
3224 static int DetectByteExtractTest51(
void)
3240 "(msg:\"Testing bytejump_body\"; "
3242 "byte_extract:4,0,two,string,hex; "
3243 "byte_test: 2,=,10, two; "
3269 printf(
"one failed\n");
3282 strcmp(bed->
name,
"two") != 0 ||
3304 printf(
"three failed\n");
3309 if (sm->
next != NULL)
3322 static int DetectByteExtractTest52(
void)
3338 "(msg:\"Testing bytejump_body\"; "
3340 "byte_extract:4,0,two,string,hex; "
3341 "byte_extract:4,0,three,string,hex; "
3342 "byte_test: 2,=,two,three; "
3343 "byte_test: 3,=,10,three; "
3369 printf(
"one failed\n");
3382 strcmp(bed1->
name,
"two") != 0 ||
3411 printf(
"three failed\n");
3425 printf(
"four failed\n");
3430 if (sm->
next != NULL)
3443 static int DetectByteExtractTest53(
void)
3459 "(msg:\"Testing bytejump_body\"; "
3461 "byte_extract:4,0,two,string,hex; "
3462 "byte_jump: 2,two; "
3488 printf(
"one failed\n");
3501 strcmp(bed->
name,
"two") != 0 ||
3522 printf(
"three failed\n");
3527 if (sm->
next != NULL)
3540 static int DetectByteExtractTest54(
void)
3556 "(msg:\"Testing bytejump_body\"; "
3558 "byte_extract:4,0,two,string,hex; "
3559 "byte_extract:4,0,three,string,hex; "
3560 "byte_jump: 2,two; "
3561 "byte_jump: 3,three; "
3587 printf(
"one failed\n");
3600 strcmp(bed1->
name,
"two") != 0 ||
3627 printf(
"three failed\n");
3640 printf(
"four failed\n");
3645 if (sm->
next != NULL)
3658 static int DetectByteExtractTest55(
void)
3674 "(msg:\"Testing byte_extract\"; "
3676 "byte_extract:4,0,two,string,hex; "
3677 "byte_extract:4,0,three,string,hex; "
3678 "byte_extract:4,0,four,string,hex; "
3679 "byte_extract:4,0,five,string,hex; "
3680 "content: \"four\"; within:two; distance:three; "
3703 printf(
"one failed: ");
3714 strcmp(bed1->
name,
"two") != 0 ||
3754 printf(
"four failed: ");
3758 if (sm->
next != NULL) {
3772 static int DetectByteExtractTest56(
void)
3788 "(msg:\"Testing bytejump_body\"; "
3789 "uricontent:\"urione\"; "
3791 "byte_extract:4,0,two,string,hex; "
3792 "byte_extract:4,0,three,string,hex; "
3793 "byte_extract:4,0,four,string,hex; "
3794 "byte_extract:4,0,five,string,hex; "
3795 "content: \"four\"; within:two; distance:three; "
3821 printf(
"one failed\n");
3826 if (sm->
next != NULL)
3843 printf(
"one failed\n");
3856 strcmp(bed1->
name,
"two") != 0 ||
3901 printf(
"four failed\n");
3906 if (sm->
next != NULL) {
3920 static int DetectByteExtractTest57(
void)
3938 "(msg:\"Testing bytejump_body\"; "
3940 "uricontent: \"urione\"; "
3941 "byte_extract:4,0,two,string,hex,relative; "
3942 "byte_extract:4,0,three,string,hex,relative; "
3943 "byte_extract:4,0,four,string,hex,relative; "
3944 "byte_extract:4,0,five,string,hex,relative; "
3945 "uricontent: \"four\"; within:two; distance:three; "
3971 printf(
"one failed\n");
3976 if (sm->
next != NULL)
3993 printf(
"one failed\n");
4006 strcmp(bed1->
name,
"two") != 0 ||
4066 printf(
"four failed\n");
4071 if (sm->
next != NULL) {
4085 static int DetectByteExtractTest58(
void)
4102 "(msg:\"Testing bytejump_body\"; "
4104 "byte_extract:4,0,two,string,hex; "
4105 "byte_extract:4,0,three,string,hex; "
4106 "byte_jump: 2,two; "
4107 "byte_jump: 3,three; "
4134 printf(
"one failed\n");
4147 strcmp(bed1->
name,
"two") != 0 ||
4174 printf(
"three failed\n");
4187 printf(
"four failed\n");
4200 printf(
"isdataat failed\n");
4205 if (sm->
next != NULL)
4218 static int DetectByteExtractTest59(
void)
4235 "(msg:\"Testing bytejump_body\"; "
4237 "byte_extract:4,0,two,string,hex; "
4238 "byte_extract:4,0,three,string,hex; "
4239 "byte_jump: 2,two; "
4240 "byte_jump: 3,three; "
4241 "isdataat: three,relative; "
4267 printf(
"one failed\n");
4280 strcmp(bed1->
name,
"two") != 0 ||
4307 printf(
"three failed\n");
4320 printf(
"four failed\n");
4334 printf(
"isdataat failed\n");
4339 if (sm->
next != NULL)
4352 static int DetectByteExtractTest60(
void)
4368 "(msg:\"Testing bytejump_body\"; "
4370 "byte_extract:4,0,two,string,hex,relative; "
4371 "uricontent: \"three\"; "
4372 "byte_extract:4,0,four,string,hex,relative; "
4399 printf(
"one failed\n");
4412 strcmp(bed1->
name,
"two") != 0 ||
4434 printf(
"isdataat failed\n");
4439 if (sm->
next != NULL)
4454 printf(
"one failed\n");
4467 strcmp(bed1->
name,
"four") != 0 ||
4481 if (sm->
next != NULL)
4494 static int DetectByteExtractTest61(
void)
4510 "(msg:\"Testing bytejump_body\"; "
4512 "byte_extract:4,0,two,string,hex,relative; "
4513 "uricontent: \"three\"; "
4514 "byte_extract:4,0,four,string,hex,relative; "
4515 "isdataat: four, relative; "
4541 printf(
"one failed\n");
4554 strcmp(bed1->
name,
"two") != 0 ||
4568 if (sm->
next != NULL)
4583 printf(
"one failed\n");
4596 strcmp(bed1->
name,
"four") != 0 ||
4619 printf(
"isdataat failed\n");
4624 if (sm->
next != NULL)
4637 static int DetectByteExtractTest62(
void)
4651 "(file_data; byte_extract:4,2,two,relative,string,hex; "
4667 strncmp(bed->
name,
"two", 3) != 0 ||
4686 static int DetectByteExtractTest63(
void)
4696 strcmp(bed->
name,
"one") != 0 ||
4708 DetectByteExtractFree(NULL, bed);
4712 static int DetectByteExtractTestParseNoBase(
void)
4726 if (strcmp(bed->
name,
"one") != 0) {
4748 DetectByteExtractFree(NULL, bed);
4752 static void DetectByteExtractRegisterTests(
void)
4757 UtRegisterTest(
"DetectByteExtractTest01", DetectByteExtractTest01);
4758 UtRegisterTest(
"DetectByteExtractTest02", DetectByteExtractTest02);
4759 UtRegisterTest(
"DetectByteExtractTest03", DetectByteExtractTest03);
4760 UtRegisterTest(
"DetectByteExtractTest04", DetectByteExtractTest04);
4761 UtRegisterTest(
"DetectByteExtractTest05", DetectByteExtractTest05);
4762 UtRegisterTest(
"DetectByteExtractTest06", DetectByteExtractTest06);
4763 UtRegisterTest(
"DetectByteExtractTest07", DetectByteExtractTest07);
4764 UtRegisterTest(
"DetectByteExtractTest08", DetectByteExtractTest08);
4765 UtRegisterTest(
"DetectByteExtractTest09", DetectByteExtractTest09);
4766 UtRegisterTest(
"DetectByteExtractTest10", DetectByteExtractTest10);
4767 UtRegisterTest(
"DetectByteExtractTest11", DetectByteExtractTest11);
4768 UtRegisterTest(
"DetectByteExtractTest12", DetectByteExtractTest12);
4769 UtRegisterTest(
"DetectByteExtractTest13", DetectByteExtractTest13);
4770 UtRegisterTest(
"DetectByteExtractTest14", DetectByteExtractTest14);
4771 UtRegisterTest(
"DetectByteExtractTest15", DetectByteExtractTest15);
4772 UtRegisterTest(
"DetectByteExtractTest16", DetectByteExtractTest16);
4773 UtRegisterTest(
"DetectByteExtractTest17", DetectByteExtractTest17);
4774 UtRegisterTest(
"DetectByteExtractTest18", DetectByteExtractTest18);
4775 UtRegisterTest(
"DetectByteExtractTest19", DetectByteExtractTest19);
4776 UtRegisterTest(
"DetectByteExtractTest20", DetectByteExtractTest20);
4777 UtRegisterTest(
"DetectByteExtractTest21", DetectByteExtractTest21);
4778 UtRegisterTest(
"DetectByteExtractTest22", DetectByteExtractTest22);
4779 UtRegisterTest(
"DetectByteExtractTest23", DetectByteExtractTest23);
4780 UtRegisterTest(
"DetectByteExtractTest24", DetectByteExtractTest24);
4781 UtRegisterTest(
"DetectByteExtractTest25", DetectByteExtractTest25);
4782 UtRegisterTest(
"DetectByteExtractTest26", DetectByteExtractTest26);
4783 UtRegisterTest(
"DetectByteExtractTest27", DetectByteExtractTest27);
4784 UtRegisterTest(
"DetectByteExtractTest28", DetectByteExtractTest28);
4785 UtRegisterTest(
"DetectByteExtractTest29", DetectByteExtractTest29);
4786 UtRegisterTest(
"DetectByteExtractTest30", DetectByteExtractTest30);
4787 UtRegisterTest(
"DetectByteExtractTest31", DetectByteExtractTest31);
4788 UtRegisterTest(
"DetectByteExtractTest32", DetectByteExtractTest32);
4789 UtRegisterTest(
"DetectByteExtractTest33", DetectByteExtractTest33);
4790 UtRegisterTest(
"DetectByteExtractTest34", DetectByteExtractTest34);
4791 UtRegisterTest(
"DetectByteExtractTest35", DetectByteExtractTest35);
4792 UtRegisterTest(
"DetectByteExtractTest36", DetectByteExtractTest36);
4793 UtRegisterTest(
"DetectByteExtractTest37", DetectByteExtractTest37);
4794 UtRegisterTest(
"DetectByteExtractTest38", DetectByteExtractTest38);
4795 UtRegisterTest(
"DetectByteExtractTest39", DetectByteExtractTest39);
4796 UtRegisterTest(
"DetectByteExtractTest40", DetectByteExtractTest40);
4797 UtRegisterTest(
"DetectByteExtractTest41", DetectByteExtractTest41);
4798 UtRegisterTest(
"DetectByteExtractTest42", DetectByteExtractTest42);
4800 UtRegisterTest(
"DetectByteExtractTest43", DetectByteExtractTest43);
4801 UtRegisterTest(
"DetectByteExtractTest44", DetectByteExtractTest44);
4803 UtRegisterTest(
"DetectByteExtractTest45", DetectByteExtractTest45);
4804 UtRegisterTest(
"DetectByteExtractTest46", DetectByteExtractTest46);
4806 UtRegisterTest(
"DetectByteExtractTest47", DetectByteExtractTest47);
4807 UtRegisterTest(
"DetectByteExtractTest48", DetectByteExtractTest48);
4809 UtRegisterTest(
"DetectByteExtractTest49", DetectByteExtractTest49);
4810 UtRegisterTest(
"DetectByteExtractTest50", DetectByteExtractTest50);
4812 UtRegisterTest(
"DetectByteExtractTest51", DetectByteExtractTest51);
4813 UtRegisterTest(
"DetectByteExtractTest52", DetectByteExtractTest52);
4815 UtRegisterTest(
"DetectByteExtractTest53", DetectByteExtractTest53);
4816 UtRegisterTest(
"DetectByteExtractTest54", DetectByteExtractTest54);
4818 UtRegisterTest(
"DetectByteExtractTest55", DetectByteExtractTest55);
4819 UtRegisterTest(
"DetectByteExtractTest56", DetectByteExtractTest56);
4820 UtRegisterTest(
"DetectByteExtractTest57", DetectByteExtractTest57);
4822 UtRegisterTest(
"DetectByteExtractTest58", DetectByteExtractTest58);
4823 UtRegisterTest(
"DetectByteExtractTest59", DetectByteExtractTest59);
4824 UtRegisterTest(
"DetectByteExtractTest60", DetectByteExtractTest60);
4825 UtRegisterTest(
"DetectByteExtractTest61", DetectByteExtractTest61);
4826 UtRegisterTest(
"DetectByteExtractTest62", DetectByteExtractTest62);
4827 UtRegisterTest(
"DetectByteExtractTest63", DetectByteExtractTest63);
4830 DetectByteExtractTestParseNoBase);