34#include "../suricata-common.h"
35#include "../suricata.h"
36#include "../flow-util.h"
38#include "../app-layer-parser.h"
39#include "../util-unittest.h"
40#include "../util-unittest-helper.h"
41#include "../app-layer.h"
42#include "../app-layer-htp.h"
43#include "../app-layer-protos.h"
44#include "../detect-isdataat.h"
45#include "../detect-engine-build.h"
46#include "../detect-engine-alert.h"
54static int DetectEngineHttpCookieTest01(
void)
64 "GET /index.html HTTP/1.0\r\n"
66 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
67 uint32_t http_len =
sizeof(http_buf) - 1;
71 memset(&th_v, 0,
sizeof(th_v));
72 memset(&f, 0,
sizeof(f));
73 memset(&ssn, 0,
sizeof(ssn));
79 f.
proto = IPPROTO_TCP;
96 "(msg:\"http header test\"; "
97 "content:\"CONNECT\"; http_cookie; "
108 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
114 if (http_state == NULL) {
115 printf(
"no http state: ");
124 printf(
"sid 1 didn't match but should have: ");
146static int DetectEngineHttpCookieTest02(
void)
156 "CONNECT /index.html HTTP/1.0\r\n"
157 "Cookie: CONNECT\r\n"
158 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
159 uint32_t http_len =
sizeof(http_buf) - 1;
163 memset(&th_v, 0,
sizeof(th_v));
164 memset(&f, 0,
sizeof(f));
165 memset(&ssn, 0,
sizeof(ssn));
171 f.
proto = IPPROTO_TCP;
188 "(msg:\"http header test\"; "
189 "content:\"CO\"; depth:4; http_cookie; "
200 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
206 if (http_state == NULL) {
207 printf(
"no http state: ");
216 printf(
"sid 1 didn't match but should have: ");
238static int DetectEngineHttpCookieTest03(
void)
248 "CONNECT /index.html HTTP/1.0\r\n"
249 "Cookie: CONNECT\r\n"
250 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
251 uint32_t http_len =
sizeof(http_buf) - 1;
255 memset(&th_v, 0,
sizeof(th_v));
256 memset(&f, 0,
sizeof(f));
257 memset(&ssn, 0,
sizeof(ssn));
263 f.
proto = IPPROTO_TCP;
280 "(msg:\"http header test\"; "
281 "content:!\"ECT\"; depth:4; http_cookie; "
292 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
298 if (http_state == NULL) {
299 printf(
"no http state: ");
308 printf(
"sid 1 didn't match but should have: ");
330static int DetectEngineHttpCookieTest04(
void)
340 "CONNECT /index.html HTTP/1.0\r\n"
341 "Cookie: CONNECT\r\n"
342 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
343 uint32_t http_len =
sizeof(http_buf) - 1;
347 memset(&th_v, 0,
sizeof(th_v));
348 memset(&f, 0,
sizeof(f));
349 memset(&ssn, 0,
sizeof(ssn));
355 f.
proto = IPPROTO_TCP;
372 "(msg:\"http header test\"; "
373 "content:\"ECT\"; depth:4; http_cookie; "
384 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
390 if (http_state == NULL) {
391 printf(
"no http state: ");
400 printf(
"sid 1 matched but shouldn't have: ");
422static int DetectEngineHttpCookieTest05(
void)
432 "CONNECT /index.html HTTP/1.0\r\n"
433 "Cookie: CONNECT\r\n"
434 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
435 uint32_t http_len =
sizeof(http_buf) - 1;
439 memset(&th_v, 0,
sizeof(th_v));
440 memset(&f, 0,
sizeof(f));
441 memset(&ssn, 0,
sizeof(ssn));
447 f.
proto = IPPROTO_TCP;
464 "(msg:\"http header test\"; "
465 "content:!\"CON\"; depth:4; http_cookie; "
476 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
482 if (http_state == NULL) {
483 printf(
"no http state: ");
492 printf(
"sid 1 matched but shouldn't have: ");
514static int DetectEngineHttpCookieTest06(
void)
524 "CONNECT /index.html HTTP/1.0\r\n"
525 "Cookie: CONNECT\r\n"
526 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
527 uint32_t http_len =
sizeof(http_buf) - 1;
531 memset(&th_v, 0,
sizeof(th_v));
532 memset(&f, 0,
sizeof(f));
533 memset(&ssn, 0,
sizeof(ssn));
539 f.
proto = IPPROTO_TCP;
556 "(msg:\"http header test\"; "
557 "content:\"ECT\"; offset:3; http_cookie; "
568 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
574 if (http_state == NULL) {
575 printf(
"no http state: ");
584 printf(
"sid 1 didn't match but should have: ");
606static int DetectEngineHttpCookieTest07(
void)
616 "CONNECT /index.html HTTP/1.0\r\n"
617 "Cookie: CONNECT\r\n"
618 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
619 uint32_t http_len =
sizeof(http_buf) - 1;
623 memset(&th_v, 0,
sizeof(th_v));
624 memset(&f, 0,
sizeof(f));
625 memset(&ssn, 0,
sizeof(ssn));
631 f.
proto = IPPROTO_TCP;
648 "(msg:\"http header test\"; "
649 "content:!\"CO\"; offset:3; http_cookie; "
660 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
666 if (http_state == NULL) {
667 printf(
"no http state: ");
676 printf(
"sid 1 didn't match but should have: ");
698static int DetectEngineHttpCookieTest08(
void)
708 "CONNECT /index.html HTTP/1.0\r\n"
709 "Cookie: CONNECT\r\n"
710 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
711 uint32_t http_len =
sizeof(http_buf) - 1;
715 memset(&th_v, 0,
sizeof(th_v));
716 memset(&f, 0,
sizeof(f));
717 memset(&ssn, 0,
sizeof(ssn));
723 f.
proto = IPPROTO_TCP;
740 "(msg:\"http header test\"; "
741 "content:!\"ECT\"; offset:3; http_cookie; "
752 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
758 if (http_state == NULL) {
759 printf(
"no http state: ");
768 printf(
"sid 1 matched but shouldn't have: ");
790static int DetectEngineHttpCookieTest09(
void)
800 "CONNECT /index.html HTTP/1.0\r\n"
801 "Cookie: CONNECT\r\n"
802 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
803 uint32_t http_len =
sizeof(http_buf) - 1;
807 memset(&th_v, 0,
sizeof(th_v));
808 memset(&f, 0,
sizeof(f));
809 memset(&ssn, 0,
sizeof(ssn));
815 f.
proto = IPPROTO_TCP;
832 "(msg:\"http header test\"; "
833 "content:\"CON\"; offset:3; http_cookie; "
844 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
850 if (http_state == NULL) {
851 printf(
"no http state: ");
860 printf(
"sid 1 matched but shouldn't have: ");
882static int DetectEngineHttpCookieTest10(
void)
892 "CONNECT /index.html HTTP/1.0\r\n"
893 "Cookie: CONNECT\r\n"
894 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
895 uint32_t http_len =
sizeof(http_buf) - 1;
899 memset(&th_v, 0,
sizeof(th_v));
900 memset(&f, 0,
sizeof(f));
901 memset(&ssn, 0,
sizeof(ssn));
907 f.
proto = IPPROTO_TCP;
924 "(msg:\"http header test\"; "
925 "content:\"CO\"; http_cookie; "
926 "content:\"EC\"; within:4; http_cookie; "
937 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
943 if (http_state == NULL) {
944 printf(
"no http state: ");
953 printf(
"sid 1 didn't match but should have: ");
975static int DetectEngineHttpCookieTest11(
void)
985 "CONNECT /index.html HTTP/1.0\r\n"
986 "Cookie: CONNECT\r\n"
987 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
988 uint32_t http_len =
sizeof(http_buf) - 1;
992 memset(&th_v, 0,
sizeof(th_v));
993 memset(&f, 0,
sizeof(f));
994 memset(&ssn, 0,
sizeof(ssn));
1000 f.
proto = IPPROTO_TCP;
1017 "(msg:\"http header test\"; "
1018 "content:\"CO\"; http_cookie; "
1019 "content:!\"EC\"; within:3; http_cookie; "
1030 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1036 if (http_state == NULL) {
1037 printf(
"no http state: ");
1046 printf(
"sid 1 didn't match but should have: ");
1068static int DetectEngineHttpCookieTest12(
void)
1077 uint8_t http_buf[] =
1078 "CONNECT /index.html HTTP/1.0\r\n"
1079 "Cookie: CONNECT\r\n"
1080 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
1081 uint32_t http_len =
sizeof(http_buf) - 1;
1085 memset(&th_v, 0,
sizeof(th_v));
1086 memset(&f, 0,
sizeof(f));
1087 memset(&ssn, 0,
sizeof(ssn));
1093 f.
proto = IPPROTO_TCP;
1110 "(msg:\"http header test\"; "
1111 "content:\"CO\"; http_cookie; "
1112 "content:\"EC\"; within:3; http_cookie; "
1123 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1129 if (http_state == NULL) {
1130 printf(
"no http state: ");
1139 printf(
"sid 1 matched but shouldn't have: ");
1161static int DetectEngineHttpCookieTest13(
void)
1170 uint8_t http_buf[] =
1171 "CONNECT /index.html HTTP/1.0\r\n"
1172 "Cookie: CONNECT\r\n"
1173 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
1174 uint32_t http_len =
sizeof(http_buf) - 1;
1178 memset(&th_v, 0,
sizeof(th_v));
1179 memset(&f, 0,
sizeof(f));
1180 memset(&ssn, 0,
sizeof(ssn));
1186 f.
proto = IPPROTO_TCP;
1203 "(msg:\"http header test\"; "
1204 "content:\"CO\"; http_cookie; "
1205 "content:!\"EC\"; within:4; http_cookie; "
1216 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1222 if (http_state == NULL) {
1223 printf(
"no http state: ");
1232 printf(
"sid 1 matched but shouldn't have: ");
1254static int DetectEngineHttpCookieTest14(
void)
1263 uint8_t http_buf[] =
1264 "CONNECT /index.html HTTP/1.0\r\n"
1265 "Cookie: CONNECT\r\n"
1266 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
1267 uint32_t http_len =
sizeof(http_buf) - 1;
1271 memset(&th_v, 0,
sizeof(th_v));
1272 memset(&f, 0,
sizeof(f));
1273 memset(&ssn, 0,
sizeof(ssn));
1279 f.
proto = IPPROTO_TCP;
1296 "(msg:\"http header test\"; "
1297 "content:\"CO\"; http_cookie; "
1298 "content:\"EC\"; distance:2; http_cookie; "
1309 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1315 if (http_state == NULL) {
1316 printf(
"no http state: ");
1325 printf(
"sid 1 didn't match but should have: ");
1347static int DetectEngineHttpCookieTest15(
void)
1356 uint8_t http_buf[] =
1357 "CONNECT /index.html HTTP/1.0\r\n"
1358 "Cookie: CONNECT\r\n"
1359 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
1360 uint32_t http_len =
sizeof(http_buf) - 1;
1364 memset(&th_v, 0,
sizeof(th_v));
1365 memset(&f, 0,
sizeof(f));
1366 memset(&ssn, 0,
sizeof(ssn));
1372 f.
proto = IPPROTO_TCP;
1389 "(msg:\"http header test\"; "
1390 "content:\"CO\"; http_cookie; "
1391 "content:!\"EC\"; distance:3; http_cookie; "
1402 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1408 if (http_state == NULL) {
1409 printf(
"no http state: ");
1418 printf(
"sid 1 didn't match but should have: ");
1440static int DetectEngineHttpCookieTest16(
void)
1449 uint8_t http_buf[] =
1450 "CONNECT /index.html HTTP/1.0\r\n"
1451 "Cookie: CONNECT\r\n"
1452 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
1453 uint32_t http_len =
sizeof(http_buf) - 1;
1457 memset(&th_v, 0,
sizeof(th_v));
1458 memset(&f, 0,
sizeof(f));
1459 memset(&ssn, 0,
sizeof(ssn));
1465 f.
proto = IPPROTO_TCP;
1482 "(msg:\"http header test\"; "
1483 "content:\"CO\"; http_cookie; "
1484 "content:\"EC\"; distance:3; http_cookie; "
1495 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1501 if (http_state == NULL) {
1502 printf(
"no http state: ");
1511 printf(
"sid 1 matched but shouldn't have: ");
1533static int DetectEngineHttpCookieTest17(
void)
1542 uint8_t http_buf[] =
1543 "CONNECT /index.html HTTP/1.0\r\n"
1544 "Cookie: CONNECT\r\n"
1545 "Host: www.onetwothreefourfivesixseven.org\r\n\r\n";
1546 uint32_t http_len =
sizeof(http_buf) - 1;
1550 memset(&th_v, 0,
sizeof(th_v));
1551 memset(&f, 0,
sizeof(f));
1552 memset(&ssn, 0,
sizeof(ssn));
1558 f.
proto = IPPROTO_TCP;
1575 "(msg:\"http header test\"; "
1576 "content:\"CO\"; http_cookie; "
1577 "content:!\"EC\"; distance:2; http_cookie; "
1588 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1594 if (http_state == NULL) {
1595 printf(
"no http state: ");
1604 printf(
"sid 1 matched but shouldn't have: ");
1626static int DetectHttpCookieTest01(
void)
1636 "(msg:\"Testing http_cookie\"; http_cookie;sid:1;)");
1650static int DetectHttpCookieTest02(
void)
1660 "(msg:\"Testing http_cookie\"; content:\"me\"; "
1661 "http_cookie:woo; sid:1;)");
1672static int DetectHttpCookieSigTest01(
void)
1676 uint8_t httpbuf1[] =
"POST / HTTP/1.0\r\nUser-Agent: Mozilla/1.0\r\nCookie:"
1677 " hellocatchme\r\n\r\n";
1678 uint32_t httplen1 =
sizeof(httpbuf1) - 1;
1687 memset(&th_v, 0,
sizeof(th_v));
1688 memset(&f, 0,
sizeof(f));
1689 memset(&ssn, 0,
sizeof(ssn));
1695 f.
proto = IPPROTO_TCP;
1714 "\"HTTP cookie\"; content:\"me\"; "
1715 "http_cookie; sid:1;)");
1721 "cookie\"; content:\"go\"; http_cookie; sid:2;)");
1722 if (s->
next == NULL) {
1733 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1739 if (http_state == NULL) {
1740 printf(
"no http state: ");
1749 printf(
"sid 1 didn't match but should have: ");
1753 printf(
"sid 2 matched but shouldn't: ");
1761 if (det_ctx != NULL) {
1775static int DetectHttpCookieSigTest02(
void)
1779 uint8_t httpbuf1[] =
"POST / HTTP/1.0\r\nUser-Agent: Mozilla/1.0\r\n\r\n";
1780 uint32_t httplen1 =
sizeof(httpbuf1) - 1;
1789 memset(&th_v, 0,
sizeof(th_v));
1790 memset(&p, 0,
sizeof(p));
1791 memset(&f, 0,
sizeof(f));
1792 memset(&ssn, 0,
sizeof(ssn));
1798 f.
proto = IPPROTO_TCP;
1817 "\"HTTP cookie\"; content:\"me\"; "
1818 "http_cookie; sid:1;)");
1829 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1835 if (http_state == NULL) {
1836 printf(
"no http state: ");
1853 if (det_ctx != NULL) {
1865static int DetectHttpCookieSigTest03(
void)
1869 uint8_t httpbuf1[] =
"POST / HTTP/1.0\r\nUser-Agent: Mozilla/1.0\r\n"
1870 "Cookie: dummy\r\n\r\n";
1871 uint32_t httplen1 =
sizeof(httpbuf1) - 1;
1880 memset(&th_v, 0,
sizeof(th_v));
1881 memset(&f, 0,
sizeof(f));
1882 memset(&ssn, 0,
sizeof(ssn));
1888 f.
proto = IPPROTO_TCP;
1907 "\"HTTP cookie\"; content:\"boo\"; "
1908 "http_cookie; sid:1;)");
1919 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
1925 if (http_state == NULL) {
1926 printf(
"no http state: ");
1942 if (det_ctx != NULL) {
1955static int DetectHttpCookieSigTest04(
void)
1959 uint8_t httpbuf1[] =
"POST / HTTP/1.0\r\nUser-Agent: Mozilla/1.0\r\n"
1960 "Cookie: dummy\r\n\r\n";
1961 uint32_t httplen1 =
sizeof(httpbuf1) - 1;
1970 memset(&th_v, 0,
sizeof(th_v));
1971 memset(&p, 0,
sizeof(p));
1972 memset(&f, 0,
sizeof(f));
1973 memset(&ssn, 0,
sizeof(ssn));
1979 f.
proto = IPPROTO_TCP;
1998 "\"HTTP cookie\"; content:!\"boo\"; "
1999 "http_cookie; sid:1;)");
2010 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
2016 if (http_state == NULL) {
2017 printf(
"no http state: ");
2033 if (det_ctx != NULL) {
2046static int DetectHttpCookieSigTest05(
void)
2050 uint8_t httpbuf1[] =
"POST / HTTP/1.0\r\nUser-Agent: Mozilla/1.0\r\n"
2051 "Cookie: DuMmY\r\n\r\n";
2052 uint32_t httplen1 =
sizeof(httpbuf1) - 1;
2061 memset(&th_v, 0,
sizeof(th_v));
2062 memset(&p, 0,
sizeof(p));
2063 memset(&f, 0,
sizeof(f));
2064 memset(&ssn, 0,
sizeof(ssn));
2070 f.
proto = IPPROTO_TCP;
2089 "\"HTTP cookie\"; content:\"dummy\"; nocase; "
2090 "http_cookie; sid:1;)");
2101 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
2107 if (http_state == NULL) {
2108 printf(
"no http state: ");
2124 if (det_ctx != NULL) {
2137static int DetectHttpCookieSigTest06(
void)
2141 uint8_t httpbuf1[] =
"POST / HTTP/1.0\r\nUser-Agent: Mozilla/1.0\r\n"
2142 "Cookie: DuMmY\r\n\r\n";
2143 uint32_t httplen1 =
sizeof(httpbuf1) - 1;
2152 memset(&th_v, 0,
sizeof(th_v));
2153 memset(&p, 0,
sizeof(p));
2154 memset(&f, 0,
sizeof(f));
2155 memset(&ssn, 0,
sizeof(ssn));
2161 f.
proto = IPPROTO_TCP;
2180 "\"HTTP cookie\"; content:\"dummy\"; "
2181 "http_cookie; nocase; sid:1;)");
2183 printf(
"sig parse failed: ");
2193 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
2198 if (http_state == NULL) {
2199 printf(
"no http state: ");
2207 printf(
"sig 1 failed to match: ");
2215 if (det_ctx != NULL) {
2228static int DetectHttpCookieSigTest07(
void)
2232 uint8_t httpbuf1[] =
"POST / HTTP/1.0\r\nUser-Agent: Mozilla/1.0\r\n"
2233 "Cookie: dummy\r\n\r\n";
2234 uint32_t httplen1 =
sizeof(httpbuf1) - 1;
2243 memset(&th_v, 0,
sizeof(th_v));
2244 memset(&f, 0,
sizeof(f));
2245 memset(&ssn, 0,
sizeof(ssn));
2251 f.
proto = IPPROTO_TCP;
2270 "\"HTTP cookie\"; content:!\"dummy\"; "
2271 "http_cookie; sid:1;)");
2282 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
2288 if (http_state == NULL) {
2289 printf(
"no http state: ");
2305 if (det_ctx != NULL) {
2320static int DetectHttpCookieSigTest08(
void)
2325 uint8_t httpbuf_request[] =
2326 "GET / HTTP/1.1\r\n"
2327 "User-Agent: Mozilla/1.0\r\n"
2329 uint32_t httpbuf_request_len =
sizeof(httpbuf_request) - 1;
2331 uint8_t httpbuf_response[] =
2332 "HTTP/1.1 200 OK\r\n"
2333 "Set-Cookie: response_user_agent\r\n"
2335 uint32_t httpbuf_response_len =
sizeof(httpbuf_response) - 1;
2338 Packet *p1 = NULL, *p2 = NULL;
2345 memset(&th_v, 0,
sizeof(th_v));
2346 memset(&f, 0,
sizeof(f));
2347 memset(&ssn, 0,
sizeof(ssn));
2351 f.
proto = IPPROTO_TCP;
2377 "(flow:to_client; content:\"response_user_agent\"; "
2378 "http_cookie; sid:1;)");
2388 httpbuf_request_len);
2390 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
2396 if (http_state == NULL) {
2397 printf(
"no http state: ");
2409 httpbuf_response_len);
2411 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
2427 if (det_ctx != NULL) {
2443static int DetectHttpCookieSigTest09(
void)
2448 uint8_t httpbuf_request[] =
2449 "GET / HTTP/1.1\r\n"
2450 "Cookie: request_user_agent\r\n"
2451 "User-Agent: Mozilla/1.0\r\n"
2453 uint32_t httpbuf_request_len =
sizeof(httpbuf_request) - 1;
2455 uint8_t httpbuf_response[] =
2456 "HTTP/1.1 200 OK\r\n"
2457 "Set-Cookie: response_user_agent\r\n"
2459 uint32_t httpbuf_response_len =
sizeof(httpbuf_response) - 1;
2462 Packet *p1 = NULL, *p2 = NULL;
2469 memset(&th_v, 0,
sizeof(th_v));
2470 memset(&f, 0,
sizeof(f));
2471 memset(&ssn, 0,
sizeof(ssn));
2475 f.
proto = IPPROTO_TCP;
2501 "(flow:to_server; content:\"request_user_agent\"; "
2502 "http_cookie; sid:1;)");
2507 "(flow:to_client; content:\"response_user_agent\"; "
2508 "http_cookie; sid:2;)");
2518 httpbuf_request_len);
2520 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
2526 if (http_state == NULL) {
2527 printf(
"no http state: ");
2539 httpbuf_response_len);
2541 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
2557 if (det_ctx != NULL) {
2573void DetectHttpCookieRegisterTests (
void)
2575 UtRegisterTest(
"DetectHttpCookieTest01", DetectHttpCookieTest01);
2576 UtRegisterTest(
"DetectHttpCookieTest02", DetectHttpCookieTest02);
2577 UtRegisterTest(
"DetectHttpCookieSigTest01", DetectHttpCookieSigTest01);
2578 UtRegisterTest(
"DetectHttpCookieSigTest02", DetectHttpCookieSigTest02);
2579 UtRegisterTest(
"DetectHttpCookieSigTest03", DetectHttpCookieSigTest03);
2580 UtRegisterTest(
"DetectHttpCookieSigTest04", DetectHttpCookieSigTest04);
2581 UtRegisterTest(
"DetectHttpCookieSigTest05", DetectHttpCookieSigTest05);
2582 UtRegisterTest(
"DetectHttpCookieSigTest06", DetectHttpCookieSigTest06);
2583 UtRegisterTest(
"DetectHttpCookieSigTest07", DetectHttpCookieSigTest07);
2584 UtRegisterTest(
"DetectHttpCookieSigTest08", DetectHttpCookieSigTest08);
2585 UtRegisterTest(
"DetectHttpCookieSigTest09", DetectHttpCookieSigTest09);
2587 DetectEngineHttpCookieTest01);
2589 DetectEngineHttpCookieTest02);
2591 DetectEngineHttpCookieTest03);
2593 DetectEngineHttpCookieTest04);
2595 DetectEngineHttpCookieTest05);
2597 DetectEngineHttpCookieTest06);
2599 DetectEngineHttpCookieTest07);
2601 DetectEngineHttpCookieTest08);
2603 DetectEngineHttpCookieTest09);
2605 DetectEngineHttpCookieTest10);
2607 DetectEngineHttpCookieTest11);
2609 DetectEngineHttpCookieTest12);
2611 DetectEngineHttpCookieTest13);
2613 DetectEngineHttpCookieTest14);
2615 DetectEngineHttpCookieTest15);
2617 DetectEngineHttpCookieTest16);
2619 DetectEngineHttpCookieTest17);
AppLayerParserThreadCtx * AppLayerParserThreadCtxAlloc(void)
Gets a new app layer protocol's parser thread context.
void AppLayerParserThreadCtxFree(AppLayerParserThreadCtx *tctx)
Destroys the app layer parser thread context obtained using AppLayerParserThreadCtxAlloc().
int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow *f, AppProto alproto, uint8_t flags, const uint8_t *input, uint32_t input_len)
int PacketAlertCheck(Packet *p, uint32_t sid)
Check if a certain sid alerted, this is used in the test functions.
int SigGroupBuild(DetectEngineCtx *de_ctx)
Convert the signature list into the runtime match structure.
DetectEngineCtx * DetectEngineCtxInit(void)
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
TmEcode DetectEngineThreadCtxInit(ThreadVars *tv, void *initdata, void **data)
initialize thread specific detection engine context
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *tv, void *data)
Signature * SigInit(DetectEngineCtx *de_ctx, const char *sigstr)
Parses a signature and adds it to the Detection Engine Context.
void SigMatchSignatures(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
#define FLOW_INITIALIZE(f)
#define FLOW_PKT_TOSERVER
#define FLOW_PKT_ESTABLISHED
#define FLOW_PKT_TOCLIENT
AppLayerParserThreadCtx * alp_tctx
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
void StreamTcpFreeConfig(bool quiet)
void StreamTcpInitConfig(bool)
To initialize the stream global configuration data.
main detection engine ctx
AppProto alproto
application level protocol
Per thread variable structure.
void UTHFreePackets(Packet **p, int numpkts)
UTHFreePackets: function to release the allocated data from UTHBuildPacket and the packet itself.
Packet * UTHBuildPacket(uint8_t *payload, uint16_t payload_len, uint8_t ipproto)
UTHBuildPacket is a wrapper that build packets with default ip and port fields.