31 #include "../suricata-common.h"
32 #include "../suricata.h"
33 #include "../flow-util.h"
35 #include "../app-layer-parser.h"
36 #include "../util-unittest.h"
37 #include "../util-unittest-helper.h"
38 #include "../app-layer.h"
39 #include "../app-layer-htp.h"
40 #include "../app-layer-protos.h"
41 #include "../detect-engine-build.h"
42 #include "../detect-engine-alert.h"
44 static int DetectEngineHttpStatMsgTest01(
void)
55 "GET /index.html HTTP/1.0\r\n"
56 "Host: www.openinfosecfoundation.org\r\n"
57 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
59 uint32_t http_len1 =
sizeof(http_buf1) - 1;
61 "HTTP/1.0 200 message\r\n"
62 "Content-Type: text/html\r\n"
63 "Content-Length: 7\r\n"
66 uint32_t http_len2 =
sizeof(http_buf2) - 1;
70 memset(&th_v, 0,
sizeof(th_v));
71 memset(&f, 0,
sizeof(f));
72 memset(&ssn, 0,
sizeof(ssn));
79 f.
proto = IPPROTO_TCP;
101 "(msg:\"http stat msg test\"; "
102 "content:\"message\"; http_stat_msg; "
113 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
119 if (http_state == NULL) {
120 printf(
"no http state: \n");
129 printf(
"sid 1 matched but shouldn't have\n");
136 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
145 printf(
"sid 1 didn't match but should have");
164 static int DetectEngineHttpStatMsgTest02(
void)
173 uint8_t http_buf1[] =
174 "GET /index.html HTTP/1.0\r\n"
175 "Host: www.openinfosecfoundation.org\r\n"
176 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
178 uint32_t http_len1 =
sizeof(http_buf1) - 1;
179 uint8_t http_buf2[] =
180 "HTTP/1.0 200 xxxxABC\r\n"
181 "Content-Type: text/html\r\n"
182 "Content-Length: 7\r\n"
185 uint32_t http_len2 =
sizeof(http_buf2) - 1;
189 memset(&th_v, 0,
sizeof(th_v));
190 memset(&f, 0,
sizeof(f));
191 memset(&ssn, 0,
sizeof(ssn));
197 f.
proto = IPPROTO_TCP;
215 "(msg:\"http stat msg test\"; "
216 "content:\"ABC\"; http_stat_msg; offset:4; "
227 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
235 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
241 if (http_state == NULL) {
242 printf(
"no http state: \n");
251 printf(
"sid 1 didn't match but should have\n");
269 static int DetectEngineHttpStatMsgTest03(
void)
280 uint8_t http_buf1[] =
281 "GET /index.html HTTP/1.0\r\n"
282 "Host: www.openinfosecfoundation.org\r\n"
283 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
285 uint32_t http_len1 =
sizeof(http_buf1) - 1;
286 uint8_t http_buf2[] =
287 "HTTP/1.0 200 1234567";
288 uint32_t http_len2 =
sizeof(http_buf2) - 1;
289 uint8_t http_buf3[] =
291 "Content-Type: text/html\r\n"
292 "Content-Length: 17\r\n"
295 uint32_t http_len3 =
sizeof(http_buf3) - 1;
298 memset(&th_v, 0,
sizeof(th_v));
299 memset(&f, 0,
sizeof(f));
300 memset(&ssn, 0,
sizeof(ssn));
307 f.
proto = IPPROTO_TCP;
329 "(msg:\"http stat msg test\"; "
330 "content:\"ABC\"; http_stat_msg; offset:14; "
341 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
347 if (http_state == NULL) {
348 printf(
"no http state: \n");
357 printf(
"sid 1 matched but shouldn't have\n");
364 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
372 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
381 printf(
"sid 1 didn't match but should have");
400 static int DetectEngineHttpStatMsgTest04(
void)
410 uint8_t http_buf1[] =
411 "GET /index.html HTTP/1.0\r\n"
412 "Host: www.openinfosecfoundation.org\r\n"
413 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
415 uint32_t http_len1 =
sizeof(http_buf1) - 1;
416 uint8_t http_buf2[] =
417 "HTTP/1.0 200 abcdef\r\n"
418 "Content-Type: text/html\r\n"
419 "Content-Length: 6\r\n"
422 uint32_t http_len2 =
sizeof(http_buf2) - 1;
426 memset(&th_v, 0,
sizeof(th_v));
427 memset(&f, 0,
sizeof(f));
428 memset(&ssn, 0,
sizeof(ssn));
435 f.
proto = IPPROTO_TCP;
457 "(msg:\"http stat msg test\"; "
458 "content:!\"abc\"; http_stat_msg; offset:3; "
469 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
475 if (http_state == NULL) {
476 printf(
"no http state: \n");
485 printf(
"sid 1 matched but shouldn't have: ");
492 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
501 printf(
"sid 1 didn't match but should have: ");
520 static int DetectEngineHttpStatMsgTest05(
void)
530 uint8_t http_buf1[] =
531 "GET /index.html HTTP/1.0\r\n"
532 "Host: www.openinfosecfoundation.org\r\n"
533 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
535 uint32_t http_len1 =
sizeof(http_buf1) - 1;
536 uint8_t http_buf2[] =
537 "HTTP/1.0 200 abcdef\r\n"
538 "Content-Type: text/html\r\n"
539 "Content-Length: 6\r\n"
542 uint32_t http_len2 =
sizeof(http_buf2) - 1;
546 memset(&th_v, 0,
sizeof(th_v));
547 memset(&f, 0,
sizeof(f));
548 memset(&ssn, 0,
sizeof(ssn));
555 f.
proto = IPPROTO_TCP;
577 "(msg:\"http stat msg test\"; "
578 "content:\"abc\"; http_stat_msg; depth:3; "
589 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
595 if (http_state == NULL) {
596 printf(
"no http state: \n");
605 printf(
"sid 1 matched but shouldn't have: ");
612 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
621 printf(
"sid 1 didn't match but should have: ");
640 static int DetectEngineHttpStatMsgTest06(
void)
650 uint8_t http_buf1[] =
651 "GET /index.html HTTP/1.0\r\n"
652 "Host: www.openinfosecfoundation.org\r\n"
653 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
655 uint32_t http_len1 =
sizeof(http_buf1) - 1;
656 uint8_t http_buf2[] =
657 "HTTP/1.0 200 abcdef\r\n"
658 "Content-Type: text/html\r\n"
659 "Content-Length: 6\r\n"
662 uint32_t http_len2 =
sizeof(http_buf2) - 1;
666 memset(&th_v, 0,
sizeof(th_v));
667 memset(&f, 0,
sizeof(f));
668 memset(&ssn, 0,
sizeof(ssn));
675 f.
proto = IPPROTO_TCP;
697 "(msg:\"http stat msg test\"; "
698 "content:!\"def\"; http_stat_msg; depth:3; "
709 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
715 if (http_state == NULL) {
716 printf(
"no http state: \n");
725 printf(
"sid 1 matched but shouldn't have: ");
732 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
741 printf(
"sid 1 didn't match but should have: ");
760 static int DetectEngineHttpStatMsgTest07(
void)
770 uint8_t http_buf1[] =
771 "GET /index.html HTTP/1.0\r\n"
772 "Host: www.openinfosecfoundation.org\r\n"
773 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
775 uint32_t http_len1 =
sizeof(http_buf1) - 1;
776 uint8_t http_buf2[] =
777 "HTTP/1.0 200 abcdef\r\n"
778 "Content-Type: text/html\r\n"
779 "Content-Length: 6\r\n"
782 uint32_t http_len2 =
sizeof(http_buf2) - 1;
786 memset(&th_v, 0,
sizeof(th_v));
787 memset(&f, 0,
sizeof(f));
788 memset(&ssn, 0,
sizeof(ssn));
795 f.
proto = IPPROTO_TCP;
817 "(msg:\"http stat msg test\"; "
818 "content:!\"def\"; http_stat_msg; offset:3; "
829 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
835 if (http_state == NULL) {
836 printf(
"no http state: \n");
845 printf(
"sid 1 matched but shouldn't have: ");
852 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
861 printf(
"sid 1 matched but shouldn't have: ");
880 static int DetectEngineHttpStatMsgTest08(
void)
890 uint8_t http_buf1[] =
891 "GET /index.html HTTP/1.0\r\n"
892 "Host: www.openinfosecfoundation.org\r\n"
893 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
895 uint32_t http_len1 =
sizeof(http_buf1) - 1;
896 uint8_t http_buf2[] =
897 "HTTP/1.0 200 abcdef\r\n"
898 "Content-Type: text/html\r\n"
899 "Content-Length: 6\r\n"
902 uint32_t http_len2 =
sizeof(http_buf2) - 1;
906 memset(&th_v, 0,
sizeof(th_v));
907 memset(&f, 0,
sizeof(f));
908 memset(&ssn, 0,
sizeof(ssn));
915 f.
proto = IPPROTO_TCP;
937 "(msg:\"http stat msg test\"; "
938 "content:!\"abc\"; http_stat_msg; depth:3; "
949 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
955 if (http_state == NULL) {
956 printf(
"no http state: \n");
965 printf(
"sid 1 matched but shouldn't have: ");
972 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
981 printf(
"sid 1 matched but shouldn't have: ");
1000 static int DetectEngineHttpStatMsgTest09(
void)
1010 uint8_t http_buf1[] =
1011 "GET /index.html HTTP/1.0\r\n"
1012 "Host: www.openinfosecfoundation.org\r\n"
1013 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
1015 uint32_t http_len1 =
sizeof(http_buf1) - 1;
1016 uint8_t http_buf2[] =
1017 "HTTP/1.0 200 abcdef\r\n"
1018 "Content-Type: text/html\r\n"
1019 "Content-Length: 6\r\n"
1022 uint32_t http_len2 =
sizeof(http_buf2) - 1;
1026 memset(&th_v, 0,
sizeof(th_v));
1027 memset(&f, 0,
sizeof(f));
1028 memset(&ssn, 0,
sizeof(ssn));
1035 f.
proto = IPPROTO_TCP;
1057 "(msg:\"http stat msg test\"; "
1058 "content:\"abc\"; http_stat_msg; depth:3; "
1059 "content:\"def\"; http_stat_msg; within:3; "
1070 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1076 if (http_state == NULL) {
1077 printf(
"no http state: \n");
1086 printf(
"sid 1 matched but shouldn't have: ");
1093 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
1102 printf(
"sid 1 didn't match but should have: ");
1121 static int DetectEngineHttpStatMsgTest10(
void)
1131 uint8_t http_buf1[] =
1132 "GET /index.html HTTP/1.0\r\n"
1133 "Host: www.openinfosecfoundation.org\r\n"
1134 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
1136 uint32_t http_len1 =
sizeof(http_buf1) - 1;
1137 uint8_t http_buf2[] =
1138 "HTTP/1.0 200 abcdef\r\n"
1139 "Content-Type: text/html\r\n"
1140 "Content-Length: 6\r\n"
1143 uint32_t http_len2 =
sizeof(http_buf2) - 1;
1147 memset(&th_v, 0,
sizeof(th_v));
1148 memset(&f, 0,
sizeof(f));
1149 memset(&ssn, 0,
sizeof(ssn));
1156 f.
proto = IPPROTO_TCP;
1178 "(msg:\"http stat msg test\"; "
1179 "content:\"abc\"; http_stat_msg; depth:3; "
1180 "content:!\"xyz\"; http_stat_msg; within:3; "
1191 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1197 if (http_state == NULL) {
1198 printf(
"no http state: \n");
1207 printf(
"sid 1 matched but shouldn't have: ");
1214 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
1223 printf(
"sid 1 didn't match but should have: ");
1242 static int DetectEngineHttpStatMsgTest11(
void)
1252 uint8_t http_buf1[] =
1253 "GET /index.html HTTP/1.0\r\n"
1254 "Host: www.openinfosecfoundation.org\r\n"
1255 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
1257 uint32_t http_len1 =
sizeof(http_buf1) - 1;
1258 uint8_t http_buf2[] =
1259 "HTTP/1.0 200 abcdef\r\n"
1260 "Content-Type: text/html\r\n"
1261 "Content-Length: 6\r\n"
1264 uint32_t http_len2 =
sizeof(http_buf2) - 1;
1268 memset(&th_v, 0,
sizeof(th_v));
1269 memset(&f, 0,
sizeof(f));
1270 memset(&ssn, 0,
sizeof(ssn));
1277 f.
proto = IPPROTO_TCP;
1299 "(msg:\"http stat msg test\"; "
1300 "content:\"abc\"; http_stat_msg; depth:3; "
1301 "content:\"xyz\"; http_stat_msg; within:3; "
1312 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1318 if (http_state == NULL) {
1319 printf(
"no http state: \n");
1328 printf(
"sid 1 matched but shouldn't have: ");
1335 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
1344 printf(
"sid 1 did match but should not have: ");
1363 static int DetectEngineHttpStatMsgTest12(
void)
1373 uint8_t http_buf1[] =
1374 "GET /index.html HTTP/1.0\r\n"
1375 "Host: www.openinfosecfoundation.org\r\n"
1376 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
1378 uint32_t http_len1 =
sizeof(http_buf1) - 1;
1379 uint8_t http_buf2[] =
1380 "HTTP/1.0 200 abcdef\r\n"
1381 "Content-Type: text/html\r\n"
1382 "Content-Length: 6\r\n"
1385 uint32_t http_len2 =
sizeof(http_buf2) - 1;
1389 memset(&th_v, 0,
sizeof(th_v));
1390 memset(&f, 0,
sizeof(f));
1391 memset(&ssn, 0,
sizeof(ssn));
1398 f.
proto = IPPROTO_TCP;
1420 "(msg:\"http stat msg test\"; "
1421 "content:\"ab\"; http_stat_msg; depth:2; "
1422 "content:\"ef\"; http_stat_msg; distance:2; "
1433 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1439 if (http_state == NULL) {
1440 printf(
"no http state: \n");
1449 printf(
"sid 1 matched but shouldn't have: ");
1456 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
1465 printf(
"sid 1 did not match but should have: ");
1484 static int DetectEngineHttpStatMsgTest13(
void)
1494 uint8_t http_buf1[] =
1495 "GET /index.html HTTP/1.0\r\n"
1496 "Host: www.openinfosecfoundation.org\r\n"
1497 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
1499 uint32_t http_len1 =
sizeof(http_buf1) - 1;
1500 uint8_t http_buf2[] =
1501 "HTTP/1.0 200 abcdef\r\n"
1502 "Content-Type: text/html\r\n"
1503 "Content-Length: 6\r\n"
1506 uint32_t http_len2 =
sizeof(http_buf2) - 1;
1510 memset(&th_v, 0,
sizeof(th_v));
1511 memset(&f, 0,
sizeof(f));
1512 memset(&ssn, 0,
sizeof(ssn));
1519 f.
proto = IPPROTO_TCP;
1541 "(msg:\"http stat msg test\"; "
1542 "content:\"ab\"; http_stat_msg; depth:3; "
1543 "content:!\"yz\"; http_stat_msg; distance:2; "
1554 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1560 if (http_state == NULL) {
1561 printf(
"no http state: \n");
1570 printf(
"sid 1 matched but shouldn't have: ");
1577 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
1586 printf(
"sid 1 did not match but should have: ");
1605 static int DetectEngineHttpStatMsgTest14(
void)
1615 uint8_t http_buf1[] =
1616 "GET /index.html HTTP/1.0\r\n"
1617 "Host: www.openinfosecfoundation.org\r\n"
1618 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
1620 uint32_t http_len1 =
sizeof(http_buf1) - 1;
1621 uint8_t http_buf2[] =
1622 "HTTP/1.0 200 abcdef\r\n"
1623 "Content-Type: text/html\r\n"
1624 "Content-Length: 6\r\n"
1627 uint32_t http_len2 =
sizeof(http_buf2) - 1;
1631 memset(&th_v, 0,
sizeof(th_v));
1632 memset(&f, 0,
sizeof(f));
1633 memset(&ssn, 0,
sizeof(ssn));
1640 f.
proto = IPPROTO_TCP;
1662 "(msg:\"http stat msg test\"; "
1664 "content:\"ef\"; http_stat_msg; distance:2; "
1675 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1681 if (http_state == NULL) {
1682 printf(
"no http state: \n");
1691 printf(
"sid 1 matched but shouldn't have: ");
1698 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
1707 printf(
"sid 1 did not match but should have: ");
1726 static int DetectEngineHttpStatMsgTest15(
void)
1736 uint8_t http_buf1[] =
1737 "GET /index.html HTTP/1.0\r\n"
1738 "Host: www.openinfosecfoundation.org\r\n"
1739 "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7\r\n"
1741 uint32_t http_len1 =
sizeof(http_buf1) - 1;
1742 uint8_t http_buf2[] =
1743 "HTTP/1.0 200 abcdef\r\n"
1744 "Content-Type: text/html\r\n"
1745 "Content-Length: 6\r\n"
1748 uint32_t http_len2 =
sizeof(http_buf2) - 1;
1752 memset(&th_v, 0,
sizeof(th_v));
1753 memset(&f, 0,
sizeof(f));
1754 memset(&ssn, 0,
sizeof(ssn));
1761 f.
proto = IPPROTO_TCP;
1783 "(msg:\"http stat msg test\"; "
1785 "content:!\"xyz\"; http_stat_msg; distance:0; within:3; "
1796 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1802 if (http_state == NULL) {
1803 printf(
"no http state: \n");
1812 printf(
"sid 1 matched but shouldn't have: ");
1819 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: \n", r);
1828 printf(
"sid 1 did not match but should have: ");
1848 static int DetectHttpStatMsgSigTest01(
void)
1852 uint8_t httpbuf1[] =
"POST / HTTP/1.0\r\nUser-Agent: Mozilla/1.0\r\n\r\n";
1853 uint32_t httplen1 =
sizeof(httpbuf1) - 1;
1854 uint8_t httpbuf2[] =
"HTTP/1.0 200 OK\r\n\r\n";
1855 uint32_t httplen2 =
sizeof(httpbuf2) - 1;
1864 memset(&th_v, 0,
sizeof(th_v));
1865 memset(&f, 0,
sizeof(f));
1866 memset(&ssn, 0,
sizeof(ssn));
1872 f.
proto = IPPROTO_TCP;
1891 "\"HTTP status message\"; content:\"OK\"; "
1892 "http_stat_msg; sid:1;)");
1898 "Status message nocase\"; content:\"ok\"; nocase; "
1899 "http_stat_msg; sid:2;)");
1900 if (s->
next == NULL) {
1910 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1917 printf(
"toclient chunk 1 returned %" PRId32
", expected 0: ", r);
1923 if (http_state == NULL) {
1924 printf(
"no http state: ");
1933 printf(
"sid 1 didn't match but should have: ");
1937 printf(
"sid 2 didn't match but should have: ");
1945 if (det_ctx != NULL) {
1959 static int DetectHttpStatMsgSigTest02(
void)
1963 uint8_t httpbuf1[] =
"POST / HTTP/1.0\r\nUser-Agent: Mozilla/1.0\r\n\r\n";
1964 uint32_t httplen1 =
sizeof(httpbuf1) - 1;
1965 uint8_t httpbuf2[] =
"HTTP/1.0 200 OK\r\n\r\n";
1966 uint32_t httplen2 =
sizeof(httpbuf2) - 1;
1975 memset(&th_v, 0,
sizeof(th_v));
1976 memset(&f, 0,
sizeof(f));
1977 memset(&ssn, 0,
sizeof(ssn));
1983 f.
proto = IPPROTO_TCP;
2002 "\"HTTP status message\"; content:\"no\"; "
2003 "http_stat_msg; sid:1;)");
2014 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
2021 printf(
"toclient chunk 1 returned %" PRId32
", expected 0: ", r);
2027 if (http_state == NULL) {
2028 printf(
"no http state: ");
2037 printf(
"sid 1 matched but shouldn't: ");
2045 if (det_ctx != NULL) {
2060 static int DetectHttpStatMsgSigTest03(
void)
2064 uint8_t httpbuf1[] =
"POST / HTTP/1.0\r\nUser-Agent: Mozilla/1.0\r\n\r\n";
2065 uint32_t httplen1 =
sizeof(httpbuf1) - 1;
2066 uint8_t httpbuf2[] =
"HTTP/1.0 200 OK\r\n\r\n";
2067 uint32_t httplen2 =
sizeof(httpbuf2) - 1;
2076 memset(&th_v, 0,
sizeof(th_v));
2077 memset(&f, 0,
sizeof(f));
2078 memset(&ssn, 0,
sizeof(ssn));
2084 f.
proto = IPPROTO_TCP;
2103 "\"HTTP status message\"; content:\"ok\"; "
2104 "nocase; http_stat_msg; sid:1;)");
2110 "Status message nocase\"; content:!\"Not\"; "
2111 "http_stat_msg; sid:2;)");
2112 if (s->
next == NULL) {
2122 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
2129 printf(
"toclient chunk 1 returned %" PRId32
", expected 0: ", r);
2135 if (http_state == NULL) {
2136 printf(
"no http state: ");
2145 printf(
"sid 1 didn't matched but should have: ");
2149 printf(
"sid 2 didn't matched but should have: ");
2157 if (det_ctx != NULL) {
2175 UtRegisterTest(
"DetectHttpStatMsgSigTest01", DetectHttpStatMsgSigTest01);
2176 UtRegisterTest(
"DetectHttpStatMsgSigTest02", DetectHttpStatMsgSigTest02);
2177 UtRegisterTest(
"DetectHttpStatMsgSigTest03", DetectHttpStatMsgSigTest03);
2180 DetectEngineHttpStatMsgTest01);
2182 DetectEngineHttpStatMsgTest02);
2184 DetectEngineHttpStatMsgTest03);
2186 DetectEngineHttpStatMsgTest04);
2188 DetectEngineHttpStatMsgTest05);
2190 DetectEngineHttpStatMsgTest06);
2192 DetectEngineHttpStatMsgTest07);
2194 DetectEngineHttpStatMsgTest08);
2196 DetectEngineHttpStatMsgTest09);
2198 DetectEngineHttpStatMsgTest10);
2200 DetectEngineHttpStatMsgTest11);
2202 DetectEngineHttpStatMsgTest12);
2204 DetectEngineHttpStatMsgTest13);
2206 DetectEngineHttpStatMsgTest14);
2208 DetectEngineHttpStatMsgTest15);