20 #include "../app-layer-htp.h"
21 #include "../conf-yaml-loader.h"
22 #include "../detect-parse.h"
23 #include "../detect-engine-content-inspection.h"
24 #include "../detect-engine-build.h"
25 #include "../pkt-var.h"
26 #include "../flow-util.h"
27 #include "../stream-tcp-reassemble.h"
28 #include "../util-unittest.h"
29 #include "../util-var-name.h"
30 #include "../util-unittest-helper.h"
32 static const char *dummy_conf_string =
36 "default-log-dir: /var/log/suricata\n"
40 " default-log-level: debug\n"
42 " default-format: \"<%t> - <%l>\"\n"
44 " default-startup-message: Your IDS has started.\n"
46 " default-output-filter:\n"
50 " - interface: console\n"
53 " - interface: file\n"
54 " filename: /var/log/suricata.log\n"
56 " - interface: syslog\n"
70 " HOME_NET: \"[192.168.0.0/16,10.8.0.0/16,127.0.0.1,2001:888:"
71 "13c5:5AFE::/64,2001:888:13c5:CAFE::/64]\"\n"
73 " EXTERNAL_NET: \"[!192.168.0.0/16,2000::/3]\"\n"
75 " HTTP_SERVERS: \"!192.168.0.0/16\"\n"
77 " SMTP_SERVERS: \"!192.168.0.0/16\"\n"
79 " SQL_SERVERS: \"!192.168.0.0/16\"\n"
83 " TELNET_SERVERS: any\n"
89 " HTTP_PORTS: \"80:81,88\"\n"
91 " SHELLCODE_PORTS: 80\n"
93 " ORACLE_PORTS: 1521\n"
98 static int SigTest01 (
void)
100 uint8_t *buf = (uint8_t *)
101 "GET /one/ HTTP/1.1\r\n"
102 "Host: one.example.org\r\n"
104 "GET /two/ HTTP/1.1\r\n"
105 "Host: two.example.org\r\n"
107 uint16_t buflen = strlen((
char *)buf);
111 char sig[] =
"alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"GET \"; depth:4; pcre:\"/GET (?P<pkt_http_uri>.*) HTTP\\/\\d\\.\\d\\r\\n/G\"; sid:1;)";
118 static int SigTest02 (
void)
120 uint8_t *buf = (uint8_t *)
121 "GET /one/ HTTP/1.1\r\n"
122 "Host: one.example.org\r\n"
124 "GET /two/ HTTP/1.1\r\n"
125 "Host: two.example.org\r\n"
127 uint16_t buflen = strlen((
char *)buf);
129 char sig[] =
"alert tcp any any -> any any (msg:\"HTTP TEST\"; content:\"Host: one.example.org\"; offset:20; depth:41; sid:1;)";
135 static int SigTest03 (
void)
137 uint8_t *buf = (uint8_t *)
138 "GET /one/ HTTP/1.1\r\n"
139 "Host: one.example.org\r\n"
141 "GET /two/ HTTP/1.1\r\n"
142 "Host: two.example.org\r\n"
144 uint16_t buflen = strlen((
char *)buf);
146 memset(&th_v, 0,
sizeof(th_v));
154 "alert tcp any any -> any any (msg:\"HTTP TEST\"; content:\"Host: "
155 "one.example.org\"; offset:20; depth:39; sid:1;)");
169 static int SigTest04 (
void)
171 uint8_t *buf = (uint8_t *)
172 "GET /one/ HTTP/1.1\r\n"
173 "Host: one.example.org\r\n"
175 "GET /two/ HTTP/1.1\r\n"
176 "Host: two.example.org\r\n"
178 uint16_t buflen = strlen((
char *)buf);
180 memset(&th_v, 0,
sizeof(th_v));
188 "alert tcp any any -> any any (msg:\"HTTP TEST\"; content:\"Host:\"; "
189 "offset:20; depth:25; content:\"Host:\"; distance:42; within:47; sid:1;)");
203 static int SigTest05 (
void)
205 uint8_t *buf = (uint8_t *)
206 "GET /one/ HTTP/1.1\r\n"
207 "Host: one.example.org\r\n"
209 "GET /two/ HTTP/1.1\r\n"
210 "Host: two.example.org\r\n"
212 uint16_t buflen = strlen((
char *)buf);
214 memset(&th_v, 0,
sizeof(th_v));
222 "alert tcp any any -> any any (msg:\"HTTP TEST\"; content:\"Host:\"; "
223 "offset:20; depth:25; content:\"Host:\"; distance:48; within:52; sid:1;)");
237 static int SigTest06 (
void)
239 uint8_t *buf = (uint8_t *)
240 "GET /one/ HTTP/1.1\r\n"
241 "Host: one.example.org\r\n"
243 "GET /two/ HTTP/1.1\r\n"
244 "Host: two.example.org\r\n"
246 uint16_t buflen = strlen((
char *)buf);
255 memset(&th_v, 0,
sizeof(th_v));
257 memset(&f, 0,
sizeof(f));
258 memset(&ssn, 0,
sizeof(ssn));
266 f.
proto = IPPROTO_TCP;
279 Signature *s =
DetectEngineAppendSig(
de_ctx,
"alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"GET \"; depth:4; pcre:\"/GET (?P<pkt_http_uri>.*) HTTP\\/\\d\\.\\d\\r\\n/G\"; sid:1;)");
306 static int SigTest07 (
void)
308 uint8_t *buf = (uint8_t *)
309 "GET /one/ HTTP/1.1\r\n"
310 "Host: one.example.org\r\n"
312 "GET /two/ HTTP/1.1\r\n"
313 "Host: two.example.org\r\n"
315 uint16_t buflen = strlen((
char *)buf);
323 memset(&th_v, 0,
sizeof(th_v));
325 memset(&f, 0,
sizeof(f));
326 memset(&ssn, 0,
sizeof(ssn));
332 f.
proto = IPPROTO_TCP;
346 "alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"GET \"; depth:4; "
347 "pcre:\"/GET (?P<pkt_http_uri>.*) HTTP\\/\\d\\.\\d\\r\\n/G\"; sid:1;)");
350 "alert tcp any any -> any any (msg:\"HTTP URI test\"; uricontent:\"three\"; sid:2;)");
374 static int SigTest08 (
void)
376 uint8_t *buf = (uint8_t *)
377 "GET /one/ HTTP/1.0\r\n"
378 "Host: one.example.org\r\n"
380 "GET /two/ HTTP/1.0\r\n"
381 "Host: two.example.org\r\n"
383 uint16_t buflen = strlen((
char *)buf);
390 memset(&f, 0,
sizeof(
Flow));
391 memset(&th_v, 0,
sizeof(th_v));
393 memset(&ssn, 0,
sizeof(ssn));
401 f.
proto = IPPROTO_TCP;
415 "alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"GET \"; "
416 "depth:4; pcre:\"/GET (?P<pkt_http_uri>.*) HTTP\\/1\\.0\\r\\n/G\"; sid:1;)");
419 "alert tcp any any -> any any (msg:\"HTTP URI test\"; uricontent:\"one\"; sid:2;)");
443 static int SigTest09 (
void)
445 uint8_t *buf = (uint8_t *)
446 "GET /one/ HTTP/1.0\r\n"
447 "Host: one.example.org\r\n"
449 "GET /two/ HTTP/1.0\r\n"
450 "Host: two.example.org\r\n"
452 uint16_t buflen = strlen((
char *)buf);
459 memset(&th_v, 0,
sizeof(th_v));
461 memset(&f, 0,
sizeof(f));
462 memset(&ssn, 0,
sizeof(ssn));
470 f.
proto = IPPROTO_TCP;
484 "alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"GET \"; "
485 "depth:4; pcre:\"/GET (?P<pkt_http_uri>.*) HTTP\\/1\\.0\\r\\n/G\"; sid:1;)");
488 "alert tcp any any -> any any (msg:\"HTTP URI test\"; uricontent:\"two\"; sid:2;)");
512 static int SigTest10 (
void)
514 uint8_t *buf = (uint8_t *)
"ABC";
515 uint16_t buflen = strlen((
char *)buf);
522 memset(&th_v, 0,
sizeof(th_v));
524 memset(&f, 0,
sizeof(f));
525 memset(&ssn, 0,
sizeof(ssn));
532 f.
proto = IPPROTO_TCP;
546 "test (1)\"; content:\"ABCD\"; depth:4; sid:1;");
549 "(2)\"; content:\"VWXYZ\"; sid:2;");
572 static int SigTest11 (
void)
574 uint8_t *buf = (uint8_t *)
575 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+";
576 uint16_t buflen = strlen((
char *)buf);
584 memset(&th_v, 0,
sizeof(th_v));
586 memset(&f, 0,
sizeof(f));
587 memset(&ssn, 0,
sizeof(ssn));
593 f.
proto = IPPROTO_TCP;
609 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (content:\"ABCDEFGHIJ\"; content:\"klmnop\"; content:\"1234\"; sid:1;)");
637 static int SigTest12 (
void)
639 uint8_t *buf = (uint8_t *)
640 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+";
641 uint16_t buflen = strlen((
char *)buf);
647 memset(&th_v, 0,
sizeof(th_v));
650 memset(&f, 0,
sizeof(
Flow));
665 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"Content order test\"; content:\"ABCDEFGHIJ\"; content:\"klmnop\"; content:\"1234\"; sid:1;)");
692 static int SigTest13 (
void)
694 uint8_t *buf = (uint8_t *)
695 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+";
696 uint16_t buflen = strlen((
char *)buf);
702 memset(&th_v, 0,
sizeof(th_v));
705 memset(&f, 0,
sizeof(
Flow));
720 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"Content order test\"; content:\"ABCDEFGHIJ\"; content:\"1234\"; content:\"klmnop\"; sid:1;)");
744 static int SigTest14 (
void)
746 uint8_t *buf = (uint8_t *)
747 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+";
748 uint16_t buflen = strlen((
char *)buf);
754 memset(&th_v, 0,
sizeof(th_v));
766 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"Content order test\"; content:\"ABCDEFGHIJ\"; content:\"1234\"; content:\"klmnop\"; distance:0; sid:1;)");
789 static int SigTest15 (
void)
791 uint8_t *buf = (uint8_t *)
792 "CONNECT 213.92.8.7:31204 HTTP/1.1";
793 uint16_t buflen = strlen((
char *)buf);
801 memset(&th_v, 0,
sizeof(th_v));
807 p->
proto = IPPROTO_TCP;
821 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any !$HTTP_PORTS (msg:\"ET POLICY Inbound HTTP CONNECT Attempt on Off-Port\"; content:\"CONNECT \"; nocase; depth:8; content:\" HTTP/1.\"; nocase; within:1000; sid:2008284; rev:2;)");
846 static int SigTest16 (
void)
848 uint8_t *buf = (uint8_t *)
849 "CONNECT 213.92.8.7:31204 HTTP/1.1";
850 uint16_t buflen = strlen((
char *)buf);
856 memset(&th_v, 0,
sizeof(th_v));
858 memset(&p, 0,
sizeof(p));
873 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any !$HTTP_PORTS (msg:\"ET POLICY Inbound HTTP CONNECT Attempt on Off-Port\"; content:\"CONNECT \"; nocase; depth:8; content:\" HTTP/1.\"; nocase; within:1000; sid:2008284; rev:2;)");
897 static int SigTest17 (
void)
899 uint8_t *buf = (uint8_t *)
900 "GET /one/ HTTP/1.1\r\n"
901 "Host: one.example.org\r\n"
903 "GET /two/ HTTP/1.1\r\n"
904 "Host: two.example.org\r\n"
906 uint16_t buflen = strlen((
char *)buf);
910 memset(&th_v, 0,
sizeof(th_v));
924 Signature *s =
DetectEngineAppendSig(
de_ctx,
"alert tcp any any -> any $HTTP_PORTS (msg:\"HTTP host cap\"; content:\"Host:\"; pcre:\"/^Host: (?P<pkt_http_host>.*)\\r\\n/m\"; noalert; sid:1;)");
947 static int SigTest18 (
void)
949 uint8_t *buf = (uint8_t *)
950 "220 (vsFTPd 2.0.5)\r\n";
951 uint16_t buflen = strlen((
char *)buf);
959 memset(&th_v, 0,
sizeof(th_v));
965 p->
proto = IPPROTO_TCP;
976 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any !21:902 -> any any (msg:\"ET MALWARE Suspicious 220 Banner on Local Port\"; content:\"220\"; offset:0; depth:4; pcre:\"/220[- ]/\"; sid:2003055; rev:4;)");
989 printf(
"signature shouldn't match, but did: ");
999 static int SigTest19 (
void)
1001 uint8_t *buf = (uint8_t *)
1002 "220 (vsFTPd 2.0.5)\r\n";
1003 uint16_t buflen = strlen((
char *)buf);
1011 memset(&th_v, 0,
sizeof(th_v));
1019 p->
proto = IPPROTO_TCP;
1048 printf(
"signature didn't match, but should have: ");
1060 static int SigTest20 (
void)
1062 uint8_t *buf = (uint8_t *)
1063 "220 (vsFTPd 2.0.5)\r\n";
1064 uint16_t buflen = strlen((
char *)buf);
1072 memset(&th_v, 0,
sizeof(th_v));
1080 p->
proto = IPPROTO_TCP;
1096 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert ip $HOME_NET any -> [99.99.99.99,1.2.3.0/24,1.1.1.1,3.0.0.0/8] any (msg:\"IP-ONLY test (2)\"; sid:999; rev:1;)");
1109 printf(
"signature didn't match, but should have: ");
1121 static int SigTest21 (
void)
1124 memset(&th_v, 0,
sizeof(th_v));
1130 memset(&f, 0,
sizeof(f));
1134 uint8_t *buf1 = (uint8_t *)
"GET /one/ HTTP/1.0\r\n"
1136 uint16_t buf1len = strlen((
char *)buf1);
1139 uint8_t *buf2 = (uint8_t *)
"GET /two/ HTTP/1.0\r\n"
1141 uint16_t buf2len = strlen((
char *)buf2);
1158 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"FLOWBIT SET\"; content:\"/one/\"; flowbits:set,TEST.one; flowbits:noalert; sid:1;)");
1174 printf(
"sid 1 alerted, but shouldn't: ");
1179 printf(
"sid 2 didn't alert, but should have: ");
1186 if (det_ctx != NULL) {
1198 static int SigTest22 (
void)
1201 memset(&th_v, 0,
sizeof(th_v));
1207 memset(&f, 0,
sizeof(f));
1211 uint8_t *buf1 = (uint8_t *)
"GET /one/ HTTP/1.0\r\n"
1213 uint16_t buf1len = strlen((
char *)buf1);
1221 uint8_t *buf2 = (uint8_t *)
"GET /two/ HTTP/1.0\r\n"
1223 uint16_t buf2len = strlen((
char *)buf2);
1237 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"FLOWBIT SET\"; content:\"/one/\"; flowbits:set,TEST.one; flowbits:noalert; sid:1;)");
1253 printf(
"sid 1 alerted, but shouldn't: ");
1260 printf(
"sid 2 alerted, but shouldn't: ");
1272 static int SigTest23 (
void)
1275 memset(&th_v, 0,
sizeof(th_v));
1281 memset(&f, 0,
sizeof(f));
1285 uint8_t *buf1 = (uint8_t *)
"GET /one/ HTTP/1.0\r\n"
1287 uint16_t buf1len = strlen((
char *)buf1);
1295 uint8_t *buf2 = (uint8_t *)
"GET /two/ HTTP/1.0\r\n"
1297 uint16_t buf2len = strlen((
char *)buf2);
1311 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"FLOWBIT SET\"; content:\"/one/\"; flowbits:toggle,TEST.one; flowbits:noalert; sid:1;)");
1327 printf(
"sid 1 alerted, but shouldn't: ");
1334 printf(
"sid 2 didn't alert, but should have: ");
1346 static int SigTest24IPV4Keyword(
void)
1348 uint8_t valid_raw_ipv4[] = {
1349 0x45, 0x00, 0x00, 0x54, 0x00, 0x00, 0x40, 0x00,
1350 0x40, 0x01, 0xb7, 0x52, 0xc0, 0xa8, 0x01, 0x03,
1351 0xc0, 0xa8, 0x01, 0x03};
1353 uint8_t invalid_raw_ipv4[] = {
1354 0x45, 0x00, 0x00, 0x54, 0x00, 0x00, 0x40, 0x00,
1355 0x40, 0x01, 0xb7, 0x52, 0xc0, 0xa8, 0x01, 0x03,
1356 0xc0, 0xa8, 0x01, 0x06};
1370 uint8_t *buf = (uint8_t *)
"GET /one/ HTTP/1.0\r\n"
1372 uint16_t buflen = strlen((
char *)buf);
1377 PacketSetIPV4(p1, valid_raw_ipv4);
1382 p1->
proto = IPPROTO_TCP;
1384 PacketSetIPV4(p2, invalid_raw_ipv4);
1389 p2->
proto = IPPROTO_TCP;
1399 "alert ip any any -> any any "
1400 "(content:\"/one/\"; ipv4-csum:valid; "
1401 "msg:\"ipv4-csum keyword check(1)\"; sid:1;)");
1403 printf(
"sig 1 parse: ");
1408 "alert ip any any -> any any "
1409 "(content:\"/one/\"; ipv4-csum:invalid; "
1410 "msg:\"ipv4-csum keyword check(1)\"; "
1413 printf(
"sig 2 parse: ");
1422 printf(
"signature 1 didn't match, but should have: ");
1428 printf(
"signature 2 didn't match, but should have: ");
1434 if (det_ctx != NULL) {
1444 static int SigTest25NegativeIPV4Keyword(
void)
1446 uint8_t valid_raw_ipv4[] = {
1447 0x45, 0x00, 0x00, 0x54, 0x00, 0x00, 0x40, 0x00,
1448 0x40, 0x01, 0xb7, 0x52, 0xc0, 0xa8, 0x01, 0x03,
1449 0xc0, 0xa8, 0x01, 0x03};
1451 uint8_t invalid_raw_ipv4[] = {
1452 0x45, 0x00, 0x00, 0x54, 0x00, 0x00, 0x40, 0x00,
1453 0x40, 0x01, 0xb7, 0x52, 0xc0, 0xa8, 0x01, 0x03,
1454 0xc0, 0xa8, 0x01, 0x06};
1468 uint8_t *buf = (uint8_t *)
"GET /one/ HTTP/1.0\r\n"
1470 uint16_t buflen = strlen((
char *)buf);
1475 PacketSetIPV4(p1, valid_raw_ipv4);
1480 p1->
proto = IPPROTO_TCP;
1482 PacketSetIPV4(p2, invalid_raw_ipv4);
1487 p2->
proto = IPPROTO_TCP;
1497 "alert ip any any -> any any "
1498 "(content:\"/one/\"; ipv4-csum:invalid; "
1499 "msg:\"ipv4-csum keyword check(1)\"; sid:1;)");
1506 "alert ip any any -> any any "
1507 "(content:\"/one/\"; ipv4-csum:valid; "
1508 "msg:\"ipv4-csum keyword check(1)\"; "
1539 static int SigTest26TCPV4Keyword(
void)
1541 uint8_t raw_ipv4[] = {
1542 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1543 0x00, 0x00, 0x00, 0x00, 0x40, 0x8e, 0x7e, 0xb2,
1544 0xc0, 0xa8, 0x01, 0x03};
1546 uint8_t valid_raw_tcp[] = {
1547 0x00, 0x50, 0x8e, 0x16, 0x0d, 0x59, 0xcd, 0x3c,
1548 0xcf, 0x0d, 0x21, 0x80, 0x50, 0x12, 0x16, 0xa0,
1549 0x4A, 0x04, 0x00, 0x00, 0x02, 0x04, 0x05, 0xb4,
1550 0x04, 0x02, 0x08, 0x0a, 0x6e, 0x18, 0x78, 0x73,
1551 0x01, 0x71, 0x74, 0xde, 0x01, 0x03, 0x03, 0x02};
1553 uint8_t invalid_raw_tcp[] = {
1554 0x00, 0x50, 0x8e, 0x16, 0x0d, 0x59, 0xcd, 0x3c,
1555 0xcf, 0x0d, 0x21, 0x80, 0x50, 0x12, 0x16, 0xa0,
1556 0xfa, 0x03, 0x00, 0x00, 0x02, 0x04, 0x05, 0xb4,
1557 0x04, 0x02, 0x08, 0x0a, 0x6e, 0x18, 0x78, 0x73,
1558 0x01, 0x71, 0x74, 0xde, 0x01, 0x03, 0x03, 0x03};
1583 PacketSetTCP(p1, (
GET_PKT_DATA(p1) +
sizeof(raw_ipv4)));
1588 p1->
proto = IPPROTO_TCP;
1591 PacketSetTCP(p2, (
GET_PKT_DATA(p2) +
sizeof(raw_ipv4)));
1596 p2->
proto = IPPROTO_TCP;
1604 "alert ip any any -> any any "
1605 "(content:\"|DE 01 03|\"; tcpv4-csum:valid; dsize:20; "
1606 "msg:\"tcpv4-csum keyword check(1)\"; sid:1;)");
1610 "alert ip any any -> any any "
1611 "(content:\"|DE 01 03|\"; tcpv4-csum:invalid; "
1612 "msg:\"tcpv4-csum keyword check(1)\"; "
1634 static int SigTest26TCPV4AndNegativeIPV4Keyword(
void)
1636 uint8_t raw_ipv4[] = {
1637 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1638 0x00, 0x00, 0x00, 0x00, 0x40, 0x8e, 0x7e, 0xb2,
1639 0xc0, 0xa8, 0x01, 0x03};
1641 uint8_t valid_raw_tcp[] = {
1642 0x00, 0x50, 0x8e, 0x16, 0x0d, 0x59, 0xcd, 0x3c,
1643 0xcf, 0x0d, 0x21, 0x80, 0x50, 0x12, 0x16, 0xa0,
1644 0x4A, 0x04, 0x00, 0x00, 0x02, 0x04, 0x05, 0xb4,
1645 0x04, 0x02, 0x08, 0x0a, 0x6e, 0x18, 0x78, 0x73,
1646 0x01, 0x71, 0x74, 0xde, 0x01, 0x03, 0x03, 0x02};
1648 uint8_t invalid_raw_tcp[] = {
1649 0x00, 0x50, 0x8e, 0x16, 0x0d, 0x59, 0xcd, 0x3c,
1650 0xcf, 0x0d, 0x21, 0x80, 0x50, 0x12, 0x16, 0xa0,
1651 0xfa, 0x03, 0x00, 0x00, 0x02, 0x04, 0x05, 0xb4,
1652 0x04, 0x02, 0x08, 0x0a, 0x6e, 0x18, 0x78, 0x73,
1653 0x01, 0x71, 0x74, 0xde, 0x01, 0x03, 0x03, 0x03};
1679 PacketSetTCP(p1, (
GET_PKT_DATA(p1) +
sizeof(raw_ipv4)));
1684 p1->
proto = IPPROTO_TCP;
1687 PacketSetTCP(p2, (
GET_PKT_DATA(p2) +
sizeof(raw_ipv4)));
1692 p2->
proto = IPPROTO_TCP;
1702 "alert ip any any -> any any "
1703 "(content:\"|DE 01 03|\"; tcpv4-csum:valid; dsize:20; "
1704 "ipv4-csum:invalid; "
1705 "msg:\"tcpv4-csum and ipv4-csum keyword check(1)\"; sid:1;)");
1711 "alert ip any any -> any any "
1712 "(content:\"|DE 01 03|\"; tcpv4-csum:invalid; "
1713 "ipv4-csum:invalid; "
1714 "msg:\"tcpv4-csum keyword check(1)\"; "
1725 printf(
"sig 1 didn't match: ");
1731 printf(
"sig 2 didn't match: ");
1746 static int SigTest26TCPV4AndIPV4Keyword(
void)
1751 uint8_t raw_ipv4[] = {
1752 0x45, 0x00, 0x00, 0x40, 0x9b, 0xa4, 0x40, 0x00,
1753 0x40, 0x06, 0xbd, 0x0a, 0xc0, 0xa8, 0xb0, 0x43,
1754 0xc0, 0xa8, 0xb0, 0x74};
1761 uint8_t valid_raw_tcp[] = {
1762 0xc1, 0x6d, 0x01, 0xbd, 0x03, 0x10, 0xd3, 0xc9,
1763 0x00, 0x00, 0x00, 0x00, 0xb0, 0x02, 0xff, 0xff,
1764 0x20, 0x09, 0x00, 0x00, 0x02, 0x04, 0x05, 0xb4,
1765 0x01, 0x03, 0x03, 0x04, 0x01, 0x01, 0x08, 0x0a,
1766 0x19, 0x69, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00,
1767 0x04, 0x02, 0x00, 0x00};
1769 uint8_t invalid_raw_tcp[] = {
1770 0xc1, 0x6d, 0x01, 0xbd, 0x03, 0x10, 0xd3, 0xc9,
1771 0x00, 0x00, 0x00, 0x00, 0xb0, 0x02, 0xff, 0xff,
1772 0x20, 0x09, 0x00, 0x00, 0x02, 0x04, 0x05, 0xb4,
1773 0x01, 0x03, 0x03, 0x04, 0x01, 0x01, 0x08, 0x0a,
1774 0x19, 0x69, 0x81, 0x7e, 0xFF, 0xAA, 0x00, 0x00,
1775 0x04, 0x02, 0x00, 0x00};
1801 PacketSetTCP(p1, (
GET_PKT_DATA(p1) +
sizeof(raw_ipv4)));
1806 p1->
proto = IPPROTO_TCP;
1809 PacketSetTCP(p2, (
GET_PKT_DATA(p2) +
sizeof(raw_ipv4)));
1814 p2->
proto = IPPROTO_TCP;
1824 "alert ip any any -> any any "
1825 "(tcpv4-csum:valid; "
1827 "msg:\"tcpv4-csum and ipv4-csum keyword check(1)\"; sid:1;)");
1833 "alert ip any any -> any any "
1834 "(tcpv4-csum:invalid; "
1836 "msg:\"tcpv4-csum and ipv4-csum keyword check(1)\"; "
1847 printf(
"sig 1 didn't match: ");
1853 printf(
"sig 2 didn't match: ");
1867 static int SigTest27NegativeTCPV4Keyword(
void)
1869 uint8_t raw_ipv4[] = {
1870 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1871 0x00, 0x00, 0x00, 0x00, 0x40, 0x8e, 0x7e, 0xb2,
1872 0xc0, 0xa8, 0x01, 0x03};
1874 uint8_t valid_raw_tcp[] = {
1875 0x00, 0x50, 0x8e, 0x16, 0x0d, 0x59, 0xcd, 0x3c,
1876 0xcf, 0x0d, 0x21, 0x80, 0x50, 0x12, 0x16, 0xa0,
1877 0xfa, 0x03, 0x00, 0x00, 0x02, 0x04, 0x05, 0xb4,
1878 0x04, 0x02, 0x08, 0x0a, 0x6e, 0x18, 0x78, 0x73,
1879 0x01, 0x71, 0x74, 0xde, 0x01, 0x03, 0x03, 0x02};
1881 uint8_t invalid_raw_tcp[] = {
1882 0x00, 0x50, 0x8e, 0x16, 0x0d, 0x59, 0xcd, 0x3c,
1883 0xcf, 0x0d, 0x21, 0x80, 0x50, 0x12, 0x16, 0xa0,
1884 0xfa, 0x03, 0x00, 0x00, 0x02, 0x04, 0x05, 0xb4,
1885 0x04, 0x02, 0x08, 0x0a, 0x6e, 0x18, 0x78, 0x73,
1886 0x01, 0x71, 0x74, 0xde, 0x01, 0x03, 0x03, 0x03};
1910 PacketSetTCP(p1, (
GET_PKT_DATA(p1) +
sizeof(raw_ipv4)));
1915 p1->
proto = IPPROTO_TCP;
1918 PacketSetTCP(p2, (
GET_PKT_DATA(p2) +
sizeof(raw_ipv4)));
1923 p2->
proto = IPPROTO_TCP;
1933 "alert tcp any any -> any any "
1934 "(content:\"|DE 01 03|\"; tcpv4-csum:invalid; dsize:20; "
1935 "msg:\"tcpv4-csum keyword check(1)\"; sid:1;)");
1941 "alert tcp any any -> any any "
1942 "(content:\"|DE 01 03|\"; tcpv4-csum:valid; dsize:20; "
1943 "msg:\"tcpv4-csum keyword check(2)\"; "
1954 printf(
"sig 1 didn't match on p1: ");
1960 printf(
"sig 2 matched on p2: ");
1974 static int SigTest28TCPV6Keyword(
void)
1976 static uint8_t valid_raw_ipv6[] = {
1977 0x00, 0x60, 0x97, 0x07, 0x69, 0xea, 0x00, 0x00,
1978 0x86, 0x05, 0x80, 0xda, 0x86, 0xdd,
1980 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x06, 0x40,
1981 0x3f, 0xfe, 0x05, 0x07, 0x00, 0x00, 0x00, 0x01,
1982 0x02, 0x00, 0x86, 0xff, 0xfe, 0x05, 0x80, 0xda,
1983 0x3f, 0xfe, 0x05, 0x01, 0x04, 0x10, 0x00, 0x00,
1984 0x02, 0xc0, 0xdf, 0xff, 0xfe, 0x47, 0x03, 0x3e,
1986 0x03, 0xfe, 0x00, 0x16, 0xd6, 0x76, 0xf5, 0x2d,
1987 0x0c, 0x7a, 0x08, 0x77, 0x50, 0x10, 0x21, 0x5c,
1988 0xf2, 0xf1, 0x00, 0x00,
1990 0x01, 0x01, 0x08, 0x0a, 0x00, 0x08, 0xca, 0x5a,
1991 0x00, 0x01, 0x69, 0x27};
1993 static uint8_t invalid_raw_ipv6[] = {
1994 0x00, 0x60, 0x97, 0x07, 0x69, 0xea, 0x00, 0x00,
1995 0x86, 0x05, 0x80, 0xda, 0x86, 0xdd,
1997 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x06, 0x40,
1998 0x3f, 0xfe, 0x05, 0x07, 0x00, 0x00, 0x00, 0x01,
1999 0x02, 0x00, 0x86, 0xff, 0xfe, 0x05, 0x80, 0xda,
2000 0x3f, 0xfe, 0x05, 0x01, 0x04, 0x10, 0x00, 0x00,
2001 0x02, 0xc0, 0xdf, 0xff, 0xfe, 0x47, 0x03, 0x3e,
2003 0x03, 0xfe, 0x00, 0x16, 0xd6, 0x76, 0xf5, 0x2d,
2004 0x0c, 0x7a, 0x08, 0x77, 0x50, 0x10, 0x21, 0x5c,
2005 0xc2, 0xf1, 0x00, 0x00,
2007 0x01, 0x01, 0x08, 0x0a, 0x00, 0x08, 0xca, 0x5a,
2008 0x00, 0x01, 0x69, 0x28};
2025 PacketSetIPV6(p1, valid_raw_ipv6 + 14);
2026 PacketSetTCP(p1, (valid_raw_ipv6 + 54));
2029 p1->
payload = valid_raw_ipv6 + 54 + 20;
2031 p1->
proto = IPPROTO_TCP;
2037 PacketSetIPV6(p2, invalid_raw_ipv6 + 14);
2038 PacketSetTCP(p2, (invalid_raw_ipv6 + 54));
2041 p2->
payload = invalid_raw_ipv6 + 54 + 20;
2043 p2->
proto = IPPROTO_TCP;
2057 "alert tcp any any -> any any "
2058 "(content:\"|00 01 69|\"; tcpv6-csum:valid; dsize:12; "
2059 "msg:\"tcpv6-csum keyword check(1)\"; sid:1;)");
2065 "alert tcp any any -> any any "
2066 "(content:\"|00 01 69|\"; tcpv6-csum:invalid; dsize:12; "
2067 "msg:\"tcpv6-csum keyword check(1)\"; "
2078 printf(
"sid 1 didn't match on p1: ");
2084 printf(
"sid 2 didn't match on p2: ");
2098 static int SigTest29NegativeTCPV6Keyword(
void)
2100 static uint8_t valid_raw_ipv6[] = {
2101 0x00, 0x60, 0x97, 0x07, 0x69, 0xea, 0x00, 0x00,
2102 0x86, 0x05, 0x80, 0xda, 0x86, 0xdd,
2104 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x06, 0x40,
2105 0x3f, 0xfe, 0x05, 0x07, 0x00, 0x00, 0x00, 0x01,
2106 0x02, 0x00, 0x86, 0xff, 0xfe, 0x05, 0x80, 0xda,
2107 0x3f, 0xfe, 0x05, 0x01, 0x04, 0x10, 0x00, 0x00,
2108 0x02, 0xc0, 0xdf, 0xff, 0xfe, 0x47, 0x03, 0x3e,
2110 0x03, 0xfe, 0x00, 0x16, 0xd6, 0x76, 0xf5, 0x2d,
2111 0x0c, 0x7a, 0x08, 0x77, 0x50, 0x10, 0x21, 0x5c,
2112 0xf2, 0xf1, 0x00, 0x00,
2114 0x01, 0x01, 0x08, 0x0a, 0x00, 0x08, 0xca, 0x5a,
2115 0x00, 0x01, 0x69, 0x27};
2117 static uint8_t invalid_raw_ipv6[] = {
2118 0x00, 0x60, 0x97, 0x07, 0x69, 0xea, 0x00, 0x00,
2119 0x86, 0x05, 0x80, 0xda, 0x86, 0xdd,
2121 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x06, 0x40,
2122 0x3f, 0xfe, 0x05, 0x07, 0x00, 0x00, 0x00, 0x01,
2123 0x02, 0x00, 0x86, 0xff, 0xfe, 0x05, 0x80, 0xda,
2124 0x3f, 0xfe, 0x05, 0x01, 0x04, 0x10, 0x00, 0x00,
2125 0x02, 0xc0, 0xdf, 0xff, 0xfe, 0x47, 0x03, 0x3e,
2127 0x03, 0xfe, 0x00, 0x16, 0xd6, 0x76, 0xf5, 0x2d,
2128 0x0c, 0x7a, 0x08, 0x77, 0x50, 0x10, 0x21, 0x5c,
2129 0xc2, 0xf1, 0x00, 0x00,
2131 0x01, 0x01, 0x08, 0x0a, 0x00, 0x08, 0xca, 0x5a,
2132 0x00, 0x01, 0x69, 0x28};
2149 PacketSetIPV6(p1, valid_raw_ipv6 + 14);
2150 PacketSetTCP(p1, valid_raw_ipv6 + 54);
2153 p1->
payload = valid_raw_ipv6 + 54 + 20;
2155 p1->
proto = IPPROTO_TCP;
2161 PacketSetIPV6(p2, invalid_raw_ipv6 + 14);
2162 PacketSetTCP(p2, invalid_raw_ipv6 + 54);
2165 p2->
payload = invalid_raw_ipv6 + 54 + 20;
2167 p2->
proto = IPPROTO_TCP;
2179 "alert tcp any any -> any any "
2180 "(content:\"|00 01 69|\"; tcpv6-csum:invalid; dsize:12; "
2181 "msg:\"tcpv6-csum keyword check(1)\"; "
2188 "alert tcp any any -> any any "
2189 "(content:\"|00 01 69|\"; tcpv6-csum:valid; dsize:12; "
2190 "msg:\"tcpv6-csum keyword check(1)\"; "
2209 if (det_ctx != NULL)
2218 static int SigTest30UDPV4Keyword(
void)
2220 uint8_t raw_ipv4[] = {
2221 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2222 0x00, 0x11, 0x00, 0x00, 0xd0, 0x43, 0xdc, 0xdc,
2223 0xc0, 0xa8, 0x01, 0x03};
2225 uint8_t valid_raw_udp[] = {
2226 0x00, 0x35, 0xcf, 0x34, 0x00, 0x55, 0x6c, 0xe0,
2227 0x83, 0xfc, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01,
2228 0x00, 0x00, 0x00, 0x00, 0x07, 0x70, 0x61, 0x67,
2229 0x65, 0x61, 0x64, 0x32, 0x11, 0x67, 0x6f, 0x6f,
2230 0x67, 0x6c, 0x65, 0x73, 0x79, 0x6e, 0x64, 0x69,
2231 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x03, 0x63,
2232 0x6f, 0x6d, 0x00, 0x00, 0x1c, 0x00, 0x01, 0xc0,
2233 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x4b,
2234 0x50, 0x00, 0x12, 0x06, 0x70, 0x61, 0x67, 0x65,
2235 0x61, 0x64, 0x01, 0x6c, 0x06, 0x67, 0x6f, 0x6f,
2236 0x67, 0x6c, 0x65, 0xc0, 0x26};
2238 uint8_t invalid_raw_udp[] = {
2239 0x00, 0x35, 0xcf, 0x34, 0x00, 0x55, 0x6c, 0xe0,
2240 0x83, 0xfc, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01,
2241 0x00, 0x00, 0x00, 0x00, 0x07, 0x70, 0x61, 0x67,
2242 0x65, 0x61, 0x64, 0x32, 0x11, 0x67, 0x6f, 0x6f,
2243 0x67, 0x6c, 0x65, 0x73, 0x79, 0x6e, 0x64, 0x69,
2244 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x03, 0x63,
2245 0x6f, 0x6d, 0x00, 0x00, 0x1c, 0x00, 0x01, 0xc0,
2246 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x4b,
2247 0x50, 0x00, 0x12, 0x06, 0x70, 0x61, 0x67, 0x65,
2248 0x61, 0x64, 0x01, 0x6c, 0x06, 0x67, 0x6f, 0x6f,
2249 0x67, 0x6c, 0x65, 0xc0, 0x27};
2259 uint8_t *buf = (uint8_t *)
"GET /one/ HTTP/1.0yyyyyyyyyyyyyyyy\r\n"
2260 "\r\n\r\nyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";
2265 PacketSetIPV4(p1, raw_ipv4);
2266 PacketSetUDP(p1, valid_raw_udp);
2271 p1->
proto = IPPROTO_UDP;
2273 PacketSetIPV4(p2, raw_ipv4);
2274 PacketSetUDP(p2, invalid_raw_udp);
2279 p2->
proto = IPPROTO_UDP;
2287 "alert udp any any -> any any "
2288 "(content:\"/one/\"; udpv4-csum:valid; "
2289 "msg:\"udpv4-csum keyword check(1)\"; "
2294 "alert udp any any -> any any "
2295 "(content:\"/one/\"; udpv4-csum:invalid; "
2296 "msg:\"udpv4-csum keyword check(1)\"; "
2309 if (det_ctx != NULL)
2318 static int SigTest31NegativeUDPV4Keyword(
void)
2320 uint8_t raw_ipv4[] = {
2321 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2322 0x00, 0x00, 0x00, 0x00, 0xd0, 0x43, 0xdc, 0xdc,
2323 0xc0, 0xa8, 0x01, 0x03};
2325 uint8_t valid_raw_udp[] = {
2326 0x00, 0x35, 0xcf, 0x34, 0x00, 0x55, 0x6c, 0xe0,
2327 0x83, 0xfc, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01,
2328 0x00, 0x00, 0x00, 0x00, 0x07, 0x70, 0x61, 0x67,
2329 0x65, 0x61, 0x64, 0x32, 0x11, 0x67, 0x6f, 0x6f,
2330 0x67, 0x6c, 0x65, 0x73, 0x79, 0x6e, 0x64, 0x69,
2331 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x03, 0x63,
2332 0x6f, 0x6d, 0x00, 0x00, 0x1c, 0x00, 0x01, 0xc0,
2333 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x4b,
2334 0x50, 0x00, 0x12, 0x06, 0x70, 0x61, 0x67, 0x65,
2335 0x61, 0x64, 0x01, 0x6c, 0x06, 0x67, 0x6f, 0x6f,
2336 0x67, 0x6c, 0x65, 0xc0, 0x26};
2338 uint8_t invalid_raw_udp[] = {
2339 0x00, 0x35, 0xcf, 0x34, 0x00, 0x55, 0x6c, 0xe0,
2340 0x83, 0xfc, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01,
2341 0x00, 0x00, 0x00, 0x00, 0x07, 0x70, 0x61, 0x67,
2342 0x65, 0x61, 0x64, 0x32, 0x11, 0x67, 0x6f, 0x6f,
2343 0x67, 0x6c, 0x65, 0x73, 0x79, 0x6e, 0x64, 0x69,
2344 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x03, 0x63,
2345 0x6f, 0x6d, 0x00, 0x00, 0x1c, 0x00, 0x01, 0xc0,
2346 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x4b,
2347 0x50, 0x00, 0x12, 0x06, 0x70, 0x61, 0x67, 0x65,
2348 0x61, 0x64, 0x01, 0x6c, 0x06, 0x67, 0x6f, 0x6f,
2349 0x67, 0x6c, 0x65, 0xc0, 0x27};
2363 uint8_t *buf = (uint8_t *)
"GET /one/ HTTP/1.0yyyyyyyyyyyyyyyy\r\n"
2364 "\r\n\r\nyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";
2369 PacketSetIPV4(p1, raw_ipv4);
2370 PacketSetUDP(p1, valid_raw_udp);
2375 p1->
proto = IPPROTO_UDP;
2377 PacketSetIPV4(p2, raw_ipv4);
2378 PacketSetUDP(p2, invalid_raw_udp);
2383 p2->
proto = IPPROTO_UDP;
2393 "alert udp any any -> any any "
2394 "(content:\"/one/\"; udpv4-csum:invalid; "
2395 "msg:\"udpv4-csum keyword check(1)\"; sid:1;)");
2402 "alert udp any any -> any any "
2403 "(content:\"/one/\"; udpv4-csum:valid; "
2404 "msg:\"udpv4-csum keyword check(1)\"; "
2427 if (det_ctx != NULL)
2438 static int SigTest32UDPV6Keyword(
void)
2440 static uint8_t valid_raw_ipv6[] = {
2441 0x00, 0x60, 0x97, 0x07, 0x69, 0xea, 0x00, 0x00,
2442 0x86, 0x05, 0x80, 0xda, 0x86, 0xdd, 0x60, 0x00,
2443 0x00, 0x00, 0x00, 0x14, 0x11, 0x02, 0x3f, 0xfe,
2444 0x05, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00,
2445 0x86, 0xff, 0xfe, 0x05, 0x80, 0xda, 0x3f, 0xfe,
2446 0x05, 0x01, 0x04, 0x10, 0x00, 0x00, 0x02, 0xc0,
2447 0xdf, 0xff, 0xfe, 0x47, 0x03, 0x3e, 0xa0, 0x75,
2448 0x82, 0xa0, 0x00, 0x14, 0x1a, 0xc3, 0x06, 0x02,
2449 0x00, 0x00, 0xf9, 0xc8, 0xe7, 0x36, 0x57, 0xb0,
2452 static uint8_t invalid_raw_ipv6[] = {
2453 0x00, 0x60, 0x97, 0x07, 0x69, 0xea, 0x00, 0x00,
2454 0x86, 0x05, 0x80, 0xda, 0x86, 0xdd, 0x60, 0x00,
2455 0x00, 0x00, 0x00, 0x14, 0x11, 0x02, 0x3f, 0xfe,
2456 0x05, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00,
2457 0x86, 0xff, 0xfe, 0x05, 0x80, 0xda, 0x3f, 0xfe,
2458 0x05, 0x01, 0x04, 0x10, 0x00, 0x00, 0x02, 0xc0,
2459 0xdf, 0xff, 0xfe, 0x47, 0x03, 0x3e, 0xa0, 0x75,
2460 0x82, 0xa0, 0x00, 0x14, 0x1a, 0xc3, 0x06, 0x02,
2461 0x00, 0x00, 0xf9, 0xc8, 0xe7, 0x36, 0x57, 0xb0,
2472 uint8_t *buf = (uint8_t *)
"GET /one/ HTTP\r\n"
2478 PacketSetIPV6(p1, valid_raw_ipv6 + 14);
2479 PacketSetUDP(p1, valid_raw_ipv6 + 54);
2484 p1->
proto = IPPROTO_UDP;
2486 PacketSetIPV6(p2, invalid_raw_ipv6 + 14);
2487 PacketSetUDP(p2, invalid_raw_ipv6 + 54);
2492 p2->
proto = IPPROTO_UDP;
2500 "alert udp any any -> any any "
2501 "(content:\"/one/\"; udpv6-csum:valid; "
2502 "msg:\"udpv6-csum keyword check(1)\"; sid:1;)");
2506 "alert udp any any -> any any "
2507 "(content:\"/one/\"; udpv6-csum:invalid; "
2508 "msg:\"udpv6-csum keyword check(1)\"; "
2521 if (det_ctx != NULL)
2531 static int SigTest33NegativeUDPV6Keyword(
void)
2533 static uint8_t valid_raw_ipv6[] = {
2534 0x00, 0x60, 0x97, 0x07, 0x69, 0xea, 0x00, 0x00,
2535 0x86, 0x05, 0x80, 0xda, 0x86, 0xdd, 0x60, 0x00,
2536 0x00, 0x00, 0x00, 0x14, 0x11, 0x02, 0x3f, 0xfe,
2537 0x05, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00,
2538 0x86, 0xff, 0xfe, 0x05, 0x80, 0xda, 0x3f, 0xfe,
2539 0x05, 0x01, 0x04, 0x10, 0x00, 0x00, 0x02, 0xc0,
2540 0xdf, 0xff, 0xfe, 0x47, 0x03, 0x3e, 0xa0, 0x75,
2541 0x82, 0xa0, 0x00, 0x14, 0x1a, 0xc3, 0x06, 0x02,
2542 0x00, 0x00, 0xf9, 0xc8, 0xe7, 0x36, 0x57, 0xb0,
2545 static uint8_t invalid_raw_ipv6[] = {
2546 0x00, 0x60, 0x97, 0x07, 0x69, 0xea, 0x00, 0x00,
2547 0x86, 0x05, 0x80, 0xda, 0x86, 0xdd, 0x60, 0x00,
2548 0x00, 0x00, 0x00, 0x14, 0x11, 0x02, 0x3f, 0xfe,
2549 0x05, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00,
2550 0x86, 0xff, 0xfe, 0x05, 0x80, 0xda, 0x3f, 0xfe,
2551 0x05, 0x01, 0x04, 0x10, 0x00, 0x00, 0x02, 0xc0,
2552 0xdf, 0xff, 0xfe, 0x47, 0x03, 0x3e, 0xa0, 0x75,
2553 0x82, 0xa0, 0x00, 0x14, 0x1a, 0xc3, 0x06, 0x02,
2554 0x00, 0x00, 0xf9, 0xc8, 0xe7, 0x36, 0x57, 0xb0,
2569 uint8_t *buf = (uint8_t *)
"GET /one/ HTTP\r\n"
2575 PacketSetIPV6(p1, valid_raw_ipv6 + 14);
2576 PacketSetUDP(p1, valid_raw_ipv6 + 54);
2581 p1->
proto = IPPROTO_UDP;
2583 PacketSetIPV6(p2, invalid_raw_ipv6 + 14);
2584 PacketSetUDP(p2, invalid_raw_ipv6 + 54);
2589 p2->
proto = IPPROTO_UDP;
2599 "alert udp any any -> any any "
2600 "(content:\"/one/\"; udpv6-csum:invalid; "
2601 "msg:\"udpv6-csum keyword check(1)\"; sid:1;)");
2608 "alert udp any any -> any any "
2609 "(content:\"/one/\"; udpv6-csum:valid; "
2610 "msg:\"udpv6-csum keyword check(1)\"; "
2632 if (det_ctx != NULL)
2642 static int SigTest34ICMPV4Keyword(
void)
2644 uint8_t valid_raw_ipv4[] = {
2645 0x45, 0x00, 0x00, 0x54, 0x00, 0x00, 0x40, 0x00,
2646 0x40, 0x01, 0x3c, 0xa7, 0x7f, 0x00, 0x00, 0x01,
2647 0x7f, 0x00, 0x00, 0x01, 0x08, 0x00, 0xc3, 0x01,
2648 0x2b, 0x36, 0x00, 0x01, 0x3f, 0x16, 0x9a, 0x4a,
2649 0x41, 0x63, 0x04, 0x00, 0x08, 0x09, 0x0a, 0x0b,
2650 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
2651 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
2652 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
2653 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
2654 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
2655 0x34, 0x35, 0x36, 0x37};
2657 uint8_t invalid_raw_ipv4[] = {
2658 0x45, 0x00, 0x00, 0x54, 0x00, 0x00, 0x40, 0x00,
2659 0x40, 0x01, 0x3c, 0xa7, 0x7f, 0x00, 0x00, 0x01,
2660 0x7f, 0x00, 0x00, 0x01, 0x08, 0x00, 0xc3, 0x01,
2661 0x2b, 0x36, 0x00, 0x01, 0x3f, 0x16, 0x9a, 0x4a,
2662 0x41, 0x63, 0x04, 0x00, 0x08, 0x09, 0x0a, 0x0b,
2663 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
2664 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
2665 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
2666 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
2667 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
2668 0x34, 0x35, 0x36, 0x38};
2682 uint8_t *buf = (uint8_t *)
"GET /one/ HTTP/1.0\r\n"
2684 uint16_t buflen = strlen((
char *)buf);
2689 IPV4Hdr *ip4h = PacketSetIPV4(p1, valid_raw_ipv4);
2696 p1->
proto = IPPROTO_ICMP;
2698 ip4h = PacketSetIPV4(p2, invalid_raw_ipv4);
2705 p2->
proto = IPPROTO_ICMP;
2715 "alert icmp any any -> any any "
2716 "(content:\"/one/\"; icmpv4-csum:valid; "
2717 "msg:\"icmpv4-csum keyword check(1)\"; sid:1;)");
2724 "alert icmp any any -> any any "
2725 "(content:\"/one/\"; icmpv4-csum:invalid; "
2726 "msg:\"icmpv4-csum keyword check(1)\"; "
2748 if (det_ctx != NULL)
2758 static int SigTest35NegativeICMPV4Keyword(
void)
2760 uint8_t valid_raw_ipv4[] = {
2761 0x45, 0x00, 0x00, 0x54, 0x00, 0x00, 0x40, 0x00,
2762 0x40, 0x01, 0x3c, 0xa7, 0x7f, 0x00, 0x00, 0x01,
2763 0x7f, 0x00, 0x00, 0x01, 0x08, 0x00, 0xc3, 0x01,
2764 0x2b, 0x36, 0x00, 0x01, 0x3f, 0x16, 0x9a, 0x4a,
2765 0x41, 0x63, 0x04, 0x00, 0x08, 0x09, 0x0a, 0x0b,
2766 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
2767 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
2768 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
2769 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
2770 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
2771 0x34, 0x35, 0x36, 0x37};
2773 uint8_t invalid_raw_ipv4[] = {
2774 0x45, 0x00, 0x00, 0x54, 0x00, 0x00, 0x40, 0x00,
2775 0x40, 0x01, 0x3c, 0xa7, 0x7f, 0x00, 0x00, 0x01,
2776 0x7f, 0x00, 0x00, 0x01, 0x08, 0x00, 0xc3, 0x01,
2777 0x2b, 0x36, 0x00, 0x01, 0x3f, 0x16, 0x9a, 0x4a,
2778 0x41, 0x63, 0x04, 0x00, 0x08, 0x09, 0x0a, 0x0b,
2779 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
2780 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
2781 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
2782 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
2783 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
2784 0x34, 0x35, 0x36, 0x38};
2798 uint8_t *buf = (uint8_t *)
"GET /one/ HTTP/1.0\r\n"
2800 uint16_t buflen = strlen((
char *)buf);
2805 IPV4Hdr *ip4h = PacketSetIPV4(p1, valid_raw_ipv4);
2812 p1->
proto = IPPROTO_ICMP;
2814 ip4h = PacketSetIPV4(p2, invalid_raw_ipv4);
2821 p2->
proto = IPPROTO_ICMP;
2831 "alert icmp any any -> any any "
2832 "(content:\"/one/\"; icmpv4-csum:invalid; "
2833 "msg:\"icmpv4-csum keyword check(1)\"; sid:1;)");
2840 "alert icmp any any -> any any "
2841 "(content:\"/one/\"; icmpv4-csum:valid; "
2842 "msg:\"icmpv4-csum keyword check(1)\"; "
2865 if (det_ctx != NULL)
2875 static int SigTest38(
void)
2883 uint8_t raw_eth[] = {
2884 0x00, 0x00, 0x03, 0x04, 0x00, 0x06, 0x00,
2885 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2888 uint8_t raw_ipv4[] = {
2889 0x45, 0x00, 0x00, 0x7d, 0xd8, 0xf3, 0x40, 0x00,
2890 0x40, 0x06, 0x63, 0x85, 0x7f, 0x00, 0x00, 0x01,
2891 0x7f, 0x00, 0x00, 0x01
2893 uint8_t raw_tcp[] = {
2894 0xad, 0x22, 0x04, 0x00, 0x16, 0x39, 0x72,
2895 0xe2, 0x16, 0x1f, 0x79, 0x84, 0x80, 0x18,
2896 0x01, 0x01, 0xfe, 0x71, 0x00, 0x00, 0x01,
2897 0x01, 0x08, 0x0a, 0x00, 0x22, 0xaa, 0x10,
2898 0x00, 0x22, 0xaa, 0x10
2901 0x00, 0x00, 0x00, 0x08, 0x62, 0x6f, 0x6f, 0x65,
2902 0x65, 0x6b, 0x0d, 0x0a, 0x4c, 0x45, 0x4e, 0x31,
2903 0x20, 0x38, 0x0d, 0x0a, 0x66, 0x6f, 0x30, 0x30,
2904 0x30, 0x38, 0x0d, 0x0a, 0x4c, 0x45, 0x4e, 0x32,
2905 0x20, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39,
2906 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39,
2907 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39,
2908 0x39, 0x39, 0x39, 0x0d, 0x0a, 0x41, 0x41, 0x41,
2909 0x41, 0x41, 0x41, 0x0d, 0x0a, 0x0d, 0x0a, 0x0d,
2912 uint16_t ethlen =
sizeof(raw_eth);
2913 uint16_t ipv4len =
sizeof(raw_ipv4);
2914 uint16_t tcplen =
sizeof(raw_tcp);
2915 uint16_t buflen =
sizeof(buf);
2937 SET_PKT_LEN(p1, ethlen + ipv4len + tcplen + buflen);
2939 PacketSetEthernet(p1, raw_eth);
2940 PacketSetIPV4(p1, raw_ipv4);
2941 PacketSetTCP(p1, raw_tcp);
2946 p1->
proto = IPPROTO_TCP;
2955 "alert tcp any any -> any any "
2956 "(content:\"LEN1|20|\"; "
2957 "byte_test:4,=,8,0; "
2958 "msg:\"byte_test keyword check(1)\"; sid:1;)");
2964 "alert tcp any any -> any any "
2965 "(content:\"LEN1|20|\"; "
2966 "byte_test:4,=,8,5,relative,string,dec; "
2967 "msg:\"byte_test keyword check(2)\"; sid:2;)");
2981 printf(
"sid 1 didn't alert, but should have: ");
2988 printf(
"sid 2 didn't alert, but should have: ");
2993 if (det_ctx != NULL)
3003 static int SigTest39(
void)
3007 uint8_t raw_eth[] = {
3008 0x00, 0x00, 0x03, 0x04, 0x00, 0x06, 0x00,
3009 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3012 uint8_t raw_ipv4[] = {
3013 0x45, 0x00, 0x00, 0x7d, 0xd8, 0xf3, 0x40, 0x00,
3014 0x40, 0x06, 0x63, 0x85, 0x7f, 0x00, 0x00, 0x01,
3015 0x7f, 0x00, 0x00, 0x01
3017 uint8_t raw_tcp[] = {
3018 0xad, 0x22, 0x04, 0x00, 0x16, 0x39, 0x72,
3019 0xe2, 0x16, 0x1f, 0x79, 0x84, 0x80, 0x18,
3020 0x01, 0x01, 0xfe, 0x71, 0x00, 0x00, 0x01,
3021 0x01, 0x08, 0x0a, 0x00, 0x22, 0xaa, 0x10,
3022 0x00, 0x22, 0xaa, 0x10
3025 0x00, 0x00, 0x00, 0x08, 0x62, 0x6f, 0x6f, 0x65,
3026 0x65, 0x6b, 0x0d, 0x0a, 0x4c, 0x45, 0x4e, 0x31,
3027 0x20, 0x38, 0x0d, 0x0a, 0x66, 0x30, 0x30, 0x30,
3028 0x38, 0x72, 0x0d, 0x0a, 0x4c, 0x45, 0x4e, 0x32,
3029 0x20, 0x39, 0x39, 0x4c, 0x45, 0x4e, 0x32, 0x39,
3030 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39,
3031 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39,
3032 0x39, 0x39, 0x39, 0x0d, 0x0a, 0x41, 0x41, 0x41,
3033 0x41, 0x41, 0x41, 0x0d, 0x0a, 0x0d, 0x0a, 0x0d,
3036 uint16_t ethlen =
sizeof(raw_eth);
3037 uint16_t ipv4len =
sizeof(raw_ipv4);
3038 uint16_t tcplen =
sizeof(raw_tcp);
3039 uint16_t buflen =
sizeof(buf);
3051 SET_PKT_LEN(p1, ethlen + ipv4len + tcplen + buflen);
3053 PacketSetEthernet(p1, raw_eth);
3054 PacketSetIPV4(p1, raw_ipv4);
3055 PacketSetTCP(p1, raw_tcp);
3060 p1->
proto = IPPROTO_TCP;
3067 "(content:\"LEN1|20|\"; "
3068 "byte_test:4,=,8,0; "
3070 "byte_test:6,=,0x4c454e312038,0,relative; "
3071 "msg:\"byte_jump keyword check(1)\"; sid:1;)");
3074 "(content:\"LEN1|20|\"; "
3075 "byte_test:4,=,8,4,relative,string,dec; "
3076 "byte_jump:4,4,relative,string,dec,post_offset 2; "
3077 "byte_test:4,=,0x4c454e32,0,relative; "
3078 "msg:\"byte_jump keyword check(2)\"; sid:2;)");
3101 static int SigTest36ContentAndIsdataatKeywords01 (
void)
3104 uint8_t raw_eth [] = {
3105 0x00,0x25,0x00,0x9e,0xfa,0xfe,0x00,0x02,0xcf,0x74,0xfe,0xe1,0x08,0x00,0x45,0x00
3106 ,0x01,0xcc,0xcb,0x91,0x00,0x00,0x34,0x06,0xdf,0xa8,0xd1,0x55,0xe3,0x67,0xc0,0xa8
3107 ,0x64,0x8c,0x00,0x50,0xc0,0xb7,0xd1,0x11,0xed,0x63,0x81,0xa9,0x9a,0x05,0x80,0x18
3108 ,0x00,0x75,0x0a,0xdd,0x00,0x00,0x01,0x01,0x08,0x0a,0x09,0x8a,0x06,0xd0,0x12,0x21
3109 ,0x2a,0x3b,0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x31,0x20,0x33,0x30,0x32,0x20,0x46
3110 ,0x6f,0x75,0x6e,0x64,0x0d,0x0a,0x4c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x3a,0x20
3111 ,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x67,0x6f,0x6f,0x67,0x6c
3112 ,0x65,0x2e,0x65,0x73,0x2f,0x0d,0x0a,0x43,0x61,0x63,0x68,0x65,0x2d,0x43,0x6f,0x6e
3113 ,0x74,0x72,0x6f,0x6c,0x3a,0x20,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x0d,0x0a,0x43
3114 ,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x54,0x79,0x70,0x65,0x3a,0x20,0x74,0x65,0x78
3115 ,0x74,0x2f,0x68,0x74,0x6d,0x6c,0x3b,0x20,0x63,0x68,0x61,0x72,0x73,0x65,0x74,0x3d
3116 ,0x55,0x54,0x46,0x2d,0x38,0x0d,0x0a,0x44,0x61,0x74,0x65,0x3a,0x20,0x4d,0x6f,0x6e
3117 ,0x2c,0x20,0x31,0x34,0x20,0x53,0x65,0x70,0x20,0x32,0x30,0x30,0x39,0x20,0x30,0x38
3118 ,0x3a,0x34,0x38,0x3a,0x33,0x31,0x20,0x47,0x4d,0x54,0x0d,0x0a,0x53,0x65,0x72,0x76
3119 ,0x65,0x72,0x3a,0x20,0x67,0x77,0x73,0x0d,0x0a,0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74
3120 ,0x2d,0x4c,0x65,0x6e,0x67,0x74,0x68,0x3a,0x20,0x32,0x31,0x38,0x0d,0x0a,0x0d,0x0a
3121 ,0x3c,0x48,0x54,0x4d,0x4c,0x3e,0x3c,0x48,0x45,0x41,0x44,0x3e,0x3c,0x6d,0x65,0x74
3122 ,0x61,0x20,0x68,0x74,0x74,0x70,0x2d,0x65,0x71,0x75,0x69,0x76,0x3d,0x22,0x63,0x6f
3123 ,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x74,0x79,0x70,0x65,0x22,0x20,0x63,0x6f,0x6e,0x74
3124 ,0x65,0x6e,0x74,0x3d,0x22,0x74,0x65,0x78,0x74,0x2f,0x68,0x74,0x6d,0x6c,0x3b,0x63
3125 ,0x68,0x61,0x72,0x73,0x65,0x74,0x3d,0x75,0x74,0x66,0x2d,0x38,0x22,0x3e,0x0a,0x3c
3126 ,0x54,0x49,0x54,0x4c,0x45,0x3e,0x33,0x30,0x32,0x20,0x4d,0x6f,0x76,0x65,0x64,0x3c
3127 ,0x2f,0x54,0x49,0x54,0x4c,0x45,0x3e,0x3c,0x2f,0x48,0x45,0x41,0x44,0x3e,0x3c,0x42
3128 ,0x4f,0x44,0x59,0x3e,0x0a,0x3c,0x48,0x31,0x3e,0x33,0x30,0x32,0x20,0x4d,0x6f,0x76
3129 ,0x65,0x64,0x3c,0x2f,0x48,0x31,0x3e,0x0a,0x54,0x68,0x65,0x20,0x64,0x6f,0x63,0x75
3130 ,0x6d,0x65,0x6e,0x74,0x20,0x68,0x61,0x73,0x20,0x6d,0x6f,0x76,0x65,0x64,0x0a,0x3c
3131 ,0x41,0x20,0x48,0x52,0x45,0x46,0x3d,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77
3132 ,0x77,0x77,0x2e,0x67,0x6f,0x6f,0x67,0x6c,0x65,0x2e,0x65,0x73,0x2f,0x22,0x3e,0x68
3133 ,0x65,0x72,0x65,0x3c,0x2f,0x41,0x3e,0x2e,0x0d,0x0a,0x3c,0x2f,0x42,0x4f,0x44,0x59
3134 ,0x3e,0x3c,0x2f,0x48,0x54,0x4d,0x4c,0x3e,0x0d,0x0a };
3144 memset(&th_v, 0,
sizeof(th_v));
3155 "alert tcp any any -> any any (content:\"HTTP\"; isdataat:404, relative; sid:101;)");
3178 static int SigTest37ContentAndIsdataatKeywords02 (
void)
3184 uint8_t raw_eth [] = {
3185 0x00,0x25,0x00,0x9e,0xfa,0xfe,0x00,0x02,0xcf,0x74,0xfe,0xe1,0x08,0x00,0x45,0x00
3186 ,0x01,0xcc,0xcb,0x91,0x00,0x00,0x34,0x06,0xdf,0xa8,0xd1,0x55,0xe3,0x67,0xc0,0xa8
3187 ,0x64,0x8c,0x00,0x50,0xc0,0xb7,0xd1,0x11,0xed,0x63,0x81,0xa9,0x9a,0x05,0x80,0x18
3188 ,0x00,0x75,0x0a,0xdd,0x00,0x00,0x01,0x01,0x08,0x0a,0x09,0x8a,0x06,0xd0,0x12,0x21
3189 ,0x2a,0x3b,0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x31,0x20,0x33,0x30,0x32,0x20,0x46
3190 ,0x6f,0x75,0x6e,0x64,0x0d,0x0a,0x4c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x3a,0x20
3191 ,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x67,0x6f,0x6f,0x67,0x6c
3192 ,0x65,0x2e,0x65,0x73,0x2f,0x0d,0x0a,0x43,0x61,0x63,0x68,0x65,0x2d,0x43,0x6f,0x6e
3193 ,0x74,0x72,0x6f,0x6c,0x3a,0x20,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x0d,0x0a,0x43
3194 ,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x54,0x79,0x70,0x65,0x3a,0x20,0x74,0x65,0x78
3195 ,0x74,0x2f,0x68,0x74,0x6d,0x6c,0x3b,0x20,0x63,0x68,0x61,0x72,0x73,0x65,0x74,0x3d
3196 ,0x55,0x54,0x46,0x2d,0x38,0x0d,0x0a,0x44,0x61,0x74,0x65,0x3a,0x20,0x4d,0x6f,0x6e
3197 ,0x2c,0x20,0x31,0x34,0x20,0x53,0x65,0x70,0x20,0x32,0x30,0x30,0x39,0x20,0x30,0x38
3198 ,0x3a,0x34,0x38,0x3a,0x33,0x31,0x20,0x47,0x4d,0x54,0x0d,0x0a,0x53,0x65,0x72,0x76
3199 ,0x65,0x72,0x3a,0x20,0x67,0x77,0x73,0x0d,0x0a,0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74
3200 ,0x2d,0x4c,0x65,0x6e,0x67,0x74,0x68,0x3a,0x20,0x32,0x31,0x38,0x0d,0x0a,0x0d,0x0a
3201 ,0x3c,0x48,0x54,0x4d,0x4c,0x3e,0x3c,0x48,0x45,0x41,0x44,0x3e,0x3c,0x6d,0x65,0x74
3202 ,0x61,0x20,0x68,0x74,0x74,0x70,0x2d,0x65,0x71,0x75,0x69,0x76,0x3d,0x22,0x63,0x6f
3203 ,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x74,0x79,0x70,0x65,0x22,0x20,0x63,0x6f,0x6e,0x74
3204 ,0x65,0x6e,0x74,0x3d,0x22,0x74,0x65,0x78,0x74,0x2f,0x68,0x74,0x6d,0x6c,0x3b,0x63
3205 ,0x68,0x61,0x72,0x73,0x65,0x74,0x3d,0x75,0x74,0x66,0x2d,0x38,0x22,0x3e,0x0a,0x3c
3206 ,0x54,0x49,0x54,0x4c,0x45,0x3e,0x33,0x30,0x32,0x20,0x4d,0x6f,0x76,0x65,0x64,0x3c
3207 ,0x2f,0x54,0x49,0x54,0x4c,0x45,0x3e,0x3c,0x2f,0x48,0x45,0x41,0x44,0x3e,0x3c,0x42
3208 ,0x4f,0x44,0x59,0x3e,0x0a,0x3c,0x48,0x31,0x3e,0x33,0x30,0x32,0x20,0x4d,0x6f,0x76
3209 ,0x65,0x64,0x3c,0x2f,0x48,0x31,0x3e,0x0a,0x54,0x68,0x65,0x20,0x64,0x6f,0x63,0x75
3210 ,0x6d,0x65,0x6e,0x74,0x20,0x68,0x61,0x73,0x20,0x6d,0x6f,0x76,0x65,0x64,0x0a,0x3c
3211 ,0x41,0x20,0x48,0x52,0x45,0x46,0x3d,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77
3212 ,0x77,0x77,0x2e,0x67,0x6f,0x6f,0x67,0x6c,0x65,0x2e,0x65,0x73,0x2f,0x22,0x3e,0x68
3213 ,0x65,0x72,0x65,0x3c,0x2f,0x41,0x3e,0x2e,0x0d,0x0a,0x3c,0x2f,0x42,0x4f,0x44,0x59
3214 ,0x3e,0x3c,0x2f,0x48,0x54,0x4d,0x4c,0x3e,0x0d,0x0a };
3225 memset(&th_v, 0,
sizeof(th_v));
3239 Signature *s =
de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"SigTest37ContentAndIsdataatKeywords01 \"; content:\"HTTP\"; isdataat:500, relative; sid:101;)");
3241 printf(
"sig parse failed: ");
3247 printf(
"type not content: ");
3258 printf(
"sig matched, but should not have: ");
3293 static int SigTest40NoPacketInspection01(
void)
3296 uint8_t *buf = (uint8_t *)
3297 "220 (vsFTPd 2.0.5)\r\n";
3298 uint16_t buflen = strlen((
char *)buf);
3309 memset(&th_v, 0,
sizeof(th_v));
3311 memset(&pq, 0,
sizeof(pq));
3312 memset(&f, 0,
sizeof(f));
3313 memset(&tcphdr, 0,
sizeof(tcphdr));
3321 p->
proto = IPPROTO_TCP;
3326 PacketSetTCP(p, (uint8_t *)&tcphdr);
3338 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> 1.2.3.4 any (msg:\"No Packet Inspection Test\"; flow:to_server; sid:2; rev:1;)");
3348 Detect(&th_v, p, det_ctx);
3367 static int SigTest40NoPayloadInspection02(
void)
3370 uint8_t *buf = (uint8_t *)
3371 "220 (vsFTPd 2.0.5)\r\n";
3372 uint16_t buflen = strlen((
char *)buf);
3374 memset(&th_v, 0,
sizeof(th_v));
3384 p->
proto = IPPROTO_TCP;
3393 "alert tcp any any -> any any (msg:\"No Payload TEST\"; content:\"220 (vsFTPd 2.0.5)\"; sid:1;)");
3410 static int SigTestMemory01 (
void)
3412 uint8_t *buf = (uint8_t *)
3413 "GET /one/ HTTP/1.1\r\n"
3414 "Host: one.example.org\r\n"
3416 "GET /two/ HTTP/1.1\r\n"
3417 "Host: two.example.org\r\n"
3419 uint16_t buflen = strlen((
char *)buf);
3427 memset(&th_v, 0,
sizeof(th_v));
3433 p->
proto = IPPROTO_TCP;
3442 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"GET \"; depth:4; pcre:\"/GET (?P<pkt_http_uri>.*) HTTP\\/\\d\\.\\d\\r\\n/G\"; sid:1;)");
3461 static int SigTestMemory02 (
void)
3466 memset(&th_v, 0,
sizeof(th_v));
3475 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any 456 (msg:\"HTTP URI cap\"; content:\"GET \"; depth:4; pcre:\"/GET (?P<pkt_http_uri>.*) HTTP\\/\\d\\.\\d\\r\\n/G\"; sid:1;)");
3480 de_ctx->
sig_list->
next =
SigInit(
de_ctx,
"alert tcp any any -> any 1:1000 (msg:\"HTTP URI cap\"; content:\"GET \"; depth:4; pcre:\"/GET (?P<pkt_http_uri>.*) HTTP\\/\\d\\.\\d\\r\\n/G\"; sid:2;)");
3496 static int SigTestMemory03 (
void)
3501 memset(&th_v, 0,
sizeof(th_v));
3510 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> 1.2.3.4 456 (msg:\"HTTP URI cap\"; content:\"GET \"; depth:4; pcre:\"/GET (?P<pkt_http_uri>.*) HTTP\\/\\d\\.\\d\\r\\n/G\"; sid:1;)");
3515 de_ctx->
sig_list->
next =
SigInit(
de_ctx,
"alert tcp any any -> 1.2.3.3-1.2.3.6 1:1000 (msg:\"HTTP URI cap\"; content:\"GET \"; depth:4; pcre:\"/GET (?P<pkt_http_uri>.*) HTTP\\/\\d\\.\\d\\r\\n/G\"; sid:2;)");
3520 de_ctx->
sig_list->
next->
next =
SigInit(
de_ctx,
"alert tcp any any -> !1.2.3.5 1:990 (msg:\"HTTP URI cap\"; content:\"GET \"; depth:4; pcre:\"/GET (?P<pkt_http_uri>.*) HTTP\\/\\d\\.\\d\\r\\n/G\"; sid:3;)");
3536 static int SigTestContent01 (
void)
3538 uint8_t *buf = (uint8_t *)
"01234567890123456789012345678901";
3539 uint16_t buflen = strlen((
char *)buf);
3544 memset(&th_v, 0,
sizeof(th_v));
3556 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; sid:1;)");
3569 printf(
"sig 1 didn't match: ");
3579 static int SigTestContent02 (
void)
3581 uint8_t *buf = (uint8_t *)
"01234567890123456789012345678901";
3582 uint16_t buflen = strlen((
char *)buf);
3587 memset(&th_v, 0,
sizeof(th_v));
3598 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; sid:1;)");
3618 printf(
"sig 2 didn't match: ");
3621 printf(
"sig 1 didn't match: ");
3631 static int SigTestContent03 (
void)
3633 uint8_t *buf = (uint8_t *)
"01234567890123456789012345678901abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
3634 uint16_t buflen = strlen((
char *)buf);
3639 memset(&th_v, 0,
sizeof(th_v));
3651 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; content:\"abcdefghijklmnopqrstuvwxyzABCDEF\"; distance:0; sid:1;)");
3664 printf(
"sig 1 didn't match: ");
3674 static int SigTestContent04 (
void)
3676 uint8_t *buf = (uint8_t *)
"01234567890123456789012345678901abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
3677 uint16_t buflen = strlen((
char *)buf);
3682 memset(&th_v, 0,
sizeof(th_v));
3695 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; content:\"abcdefghijklmnopqrstuvwxyzABCDEF\"; distance:0; within:32; sid:1;)");
3708 printf(
"sig 1 didn't match: ");
3719 static int SigTestContent05 (
void)
3721 uint8_t *buf = (uint8_t *)
"01234567890123456789012345678901PADabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
3722 uint16_t buflen = strlen((
char *)buf);
3727 memset(&th_v, 0,
sizeof(th_v));
3734 printf(
"de_ctx == NULL: ");
3740 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; content:\"abcdefghijklmnopqrstuvwxyzABCDEF\"; distance:0; within:32; sid:1;)");
3742 printf(
"sig1 parse failed: ");
3745 de_ctx->
sig_list->
next =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; content:\"abcdefghijklmnopqrstuvwxyzABCDEF\"; distance:1; within:32; sid:2;)");
3747 printf(
"sig2 parse failed: ");
3757 printf(
"sig 1 matched but shouldn't: ");
3762 printf(
"sig 2 matched but shouldn't: ");
3769 if (det_ctx != NULL) {
3779 static int SigTestContent06 (
void)
3781 uint8_t *buf = (uint8_t *)
"01234567890123456789012345678901abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
3782 uint16_t buflen = strlen((
char *)buf);
3787 memset(&th_v, 0,
sizeof(th_v));
3799 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert ip any any -> any any (msg:\"Test 32 sig1\"; content:\"01234567890123456789012345678901\"; content:\"abcdefghijklmnopqrstuvwxyzABCDEF\"; distance:0; within:32; sid:1;)");
3804 de_ctx->
sig_list->
next =
SigInit(
de_ctx,
"alert ip any any -> any any (msg:\"Test 32 sig2\"; content:\"01234567890123456789012345678901\"; content:\"abcdefg\"; sid:2;)");
3817 printf(
"sig 1 didn't match: ");
3824 printf(
"sig 2 didn't match: ");
3836 static int SigTestWithin01 (
void)
3840 uint8_t rawpkt1[] = {
3841 0x00,0x04,0x76,0xd3,0xd8,0x6a,0x00,0x24,
3842 0xe8,0x29,0xfa,0x4f,0x08,0x00,0x45,0x00,
3843 0x00,0x8c,0x95,0x50,0x00,0x00,0x40,0x06,
3844 0x2d,0x45,0xc0,0xa8,0x02,0x03,0xd0,0x45,
3845 0x24,0xe6,0x06,0xcc,0x03,0x09,0x18,0x72,
3846 0xd0,0xe3,0x1a,0xab,0x7c,0x98,0x50,0x00,
3847 0x02,0x00,0x46,0xa0,0x00,0x00,0x48,0x69,
3848 0x2c,0x20,0x74,0x68,0x69,0x73,0x20,0x69,
3849 0x73,0x20,0x61,0x20,0x62,0x69,0x67,0x20,
3850 0x74,0x65,0x73,0x74,0x20,0x74,0x6f,0x20,
3851 0x63,0x68,0x65,0x63,0x6b,0x20,0x63,0x6f,
3852 0x6e,0x74,0x65,0x6e,0x74,0x20,0x6d,0x61,
3853 0x74,0x63,0x68,0x65,0x73,0x0a,0x00,0x00,
3854 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3855 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3856 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3857 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3858 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3859 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3862 uint8_t rawpkt2[] = {
3863 0x00,0x04,0x76,0xd3,0xd8,0x6a,0x00,0x24,
3864 0xe8,0x29,0xfa,0x4f,0x08,0x00,0x45,0x00,
3865 0x00,0x8c,0x30,0x87,0x00,0x00,0x40,0x06,
3866 0x92,0x0e,0xc0,0xa8,0x02,0x03,0xd0,0x45,
3867 0x24,0xe6,0x06,0xcd,0x03,0x09,0x73,0xec,
3868 0xd5,0x35,0x14,0x7d,0x7c,0x12,0x50,0x00,
3869 0x02,0x00,0xed,0x86,0x00,0x00,0x48,0x69,
3870 0x2c,0x20,0x74,0x68,0x69,0x73,0x20,0x69,
3871 0x73,0x20,0x61,0x20,0x62,0x69,0x67,0x20,
3872 0x74,0x65,0x73,0x74,0x20,0x74,0x6f,0x20,
3873 0x63,0x68,0x65,0x63,0x6b,0x20,0x63,0x6f,
3874 0x6e,0x74,0x65,0x6e,0x74,0x20,0x6d,0x61,
3875 0x74,0x63,0x68,0x65,0x73,0x0a,0x00,0x00,
3876 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3877 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3878 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3879 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3880 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3881 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3884 uint8_t rawpkt3[] = {
3885 0x00,0x04,0x76,0xd3,0xd8,0x6a,0x00,0x24,
3886 0xe8,0x29,0xfa,0x4f,0x08,0x00,0x45,0x00,
3887 0x00,0x8c,0x57,0xd8,0x00,0x00,0x40,0x06,
3888 0x6a,0xbd,0xc0,0xa8,0x02,0x03,0xd0,0x45,
3889 0x24,0xe6,0x06,0xce,0x03,0x09,0x06,0x3d,
3890 0x02,0x22,0x2f,0x9b,0x6f,0x8f,0x50,0x00,
3891 0x02,0x00,0x1f,0xae,0x00,0x00,0x48,0x69,
3892 0x2c,0x20,0x74,0x68,0x69,0x73,0x20,0x69,
3893 0x73,0x20,0x61,0x20,0x62,0x69,0x67,0x20,
3894 0x74,0x65,0x73,0x74,0x20,0x74,0x6f,0x20,
3895 0x63,0x68,0x65,0x63,0x6b,0x20,0x63,0x6f,
3896 0x6e,0x74,0x65,0x6e,0x74,0x20,0x6d,0x61,
3897 0x74,0x63,0x68,0x65,0x73,0x0a,0x00,0x00,
3898 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3899 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3900 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3901 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3902 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3903 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3906 uint8_t rawpkt4[] = {
3907 0x00,0x04,0x76,0xd3,0xd8,0x6a,0x00,0x24,
3908 0xe8,0x29,0xfa,0x4f,0x08,0x00,0x45,0x00,
3909 0x00,0x8c,0xa7,0x2e,0x00,0x00,0x40,0x06,
3910 0x1b,0x67,0xc0,0xa8,0x02,0x03,0xd0,0x45,
3911 0x24,0xe6,0x06,0xcf,0x03,0x09,0x00,0x0e,
3912 0xdf,0x72,0x3d,0xc2,0x21,0xce,0x50,0x00,
3913 0x02,0x00,0x88,0x25,0x00,0x00,0x48,0x69,
3914 0x2c,0x20,0x74,0x68,0x69,0x73,0x20,0x69,
3915 0x73,0x20,0x61,0x20,0x62,0x69,0x67,0x20,
3916 0x74,0x65,0x73,0x74,0x20,0x74,0x6f,0x20,
3917 0x63,0x68,0x65,0x63,0x6b,0x20,0x63,0x6f,
3918 0x6e,0x74,0x65,0x6e,0x74,0x20,0x6d,0x61,
3919 0x74,0x63,0x68,0x65,0x73,0x0a,0x00,0x00,
3920 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3921 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3922 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3923 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3924 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3925 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3929 memset(&th_v, 0,
sizeof(th_v));
3941 "alert tcp any any -> any any (msg:\"within test\"; content:\"Hi, this is a big test "
3942 "to check \"; content:\"content matches\"; distance:0; within:15; sid:556;)");
3977 uint8_t *p5buf = (uint8_t *)
"Hi, this is a big test to check content matches";
3978 uint16_t p5buflen = strlen((
char *)p5buf);
3997 static int SigTestDepthOffset01 (
void)
3999 uint8_t *buf = (uint8_t *)
"01234567890123456789012345678901abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
4000 uint16_t buflen = strlen((
char *)buf);
4006 memset(&th_v, 0,
sizeof(th_v));
4018 de_ctx->
sig_list =
SigInit(
de_ctx,
"alert tcp any any -> any any (msg:\"depth offset\"; content:\"456\"; offset:4; depth:3; sid:1;)");
4039 static int SigTestDetectAlertCounter(
void)
4044 memset(&
tv, 0,
sizeof(
tv));
4052 "content:\"boo\"; sid:1;)");
4061 p =
UTHBuildPacket((uint8_t *)
"boo", strlen(
"boo"), IPPROTO_TCP);
4069 p =
UTHBuildPacket((uint8_t *)
"roo", strlen(
"roo"), IPPROTO_TCP);
4074 p =
UTHBuildPacket((uint8_t *)
"laboosa", strlen(
"laboosa"), IPPROTO_TCP);
4087 static int SigTestDropFlow01(
void)
4091 uint8_t http_buf1[] =
"POST /one HTTP/1.0\r\n"
4092 "User-Agent: Mozilla/1.0\r\n"
4093 "Cookie: hellocatch\r\n\r\n";
4094 uint32_t http_buf1_len =
sizeof(http_buf1) - 1;
4104 memset(&f, 0,
sizeof(
Flow));
4111 f.
proto = IPPROTO_TCP;
4127 "(msg:\"Test proto match\"; "
4162 static int SigTestDropFlow02(
void)
4167 uint8_t http_buf1[] =
"POST /one HTTP/1.0\r\n"
4168 "User-Agent: Mozilla/1.0\r\n"
4169 "Cookie: hellocatch\r\n\r\n";
4170 uint32_t http_buf1_len =
sizeof(http_buf1) - 1;
4180 memset(&f, 0,
sizeof(
Flow));
4187 f.
proto = IPPROTO_TCP;
4205 "(msg:\"Test proto match\"; uricontent:\"one\";"
4217 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
4222 if (http_state == NULL) {
4223 printf(
"no http state: ");
4231 printf(
"sig 1 didn't alert, but it should: ");
4236 printf(
"sig 1 alerted but flow was not flagged correctly: ");
4248 if (det_ctx != NULL)
4264 static int SigTestDropFlow03(
void)
4269 uint8_t http_buf1[] =
"POST /one HTTP/1.0\r\n"
4270 "User-Agent: Mozilla/1.0\r\n"
4271 "Cookie: hellocatch\r\n\r\n";
4272 uint32_t http_buf1_len =
sizeof(http_buf1) - 1;
4274 uint8_t http_buf2[] =
"POST /two HTTP/1.0\r\n"
4275 "User-Agent: Mozilla/1.0\r\n"
4276 "Cookie: hellocatch\r\n\r\n";
4277 uint32_t http_buf2_len =
sizeof(http_buf1) - 1;
4292 memset(&f, 0,
sizeof(
Flow));
4300 f.
proto = IPPROTO_TCP;
4324 "(msg:\"Test proto match\"; uricontent:\"one\";"
4333 "(msg:\"Test proto match\"; uricontent:\"two\";"
4345 printf(
"toserver chunk 1 returned %" PRId32
", expected 0: ", r);
4350 if (http_state == NULL) {
4351 printf(
"no http state: ");
4359 printf(
"sig 1 didn't alert on p1, but it should: ");
4364 printf(
"sig 1 alerted but flow was not flagged correctly: ");
4369 if (StreamTcpCheckFlowDrops(p2) == 1) {
4370 SCLogDebug(
"This flow/stream triggered a drop rule");
4371 DecodeSetNoPacketInspectionFlag(p2);
4380 printf(
"The packet was not flagged with no-inspection: ");
4387 printf(
"toserver chunk 2 returned %" PRId32
", expected 0: ", r);
4395 printf(
"sig 1 alerted, but it should not since the no pkt inspection should be set: ");
4400 printf(
"sig 2 alerted, but it should not since the no pkt inspection should be set: ");
4405 printf(
"A \"drop\" action should be set from the flow to the packet: ");
4414 if (det_ctx != NULL)
4433 static int SigTestPorts01(
void)
4440 uint8_t payload[] =
"AAAAAAAAAAAAAAAAAA";
4454 "(content:\"AAA\"; sid:1;)");
4466 printf(
"sig 1 alerted on p1, but it should not: ");
4472 if (det_ctx != NULL)
4483 static int SigTestBug01(
void)
4487 uint8_t payload[] =
"!mymy";
4497 "(content:\"Omymy\"; nocase; sid:1;)");
4500 "(content:\"!mymy\"; nocase; sid:2;)");
4514 static const char *dummy_conf_string2 =
4519 " address-groups:\n"
4521 " HOME_NET: \"[10.10.10.0/24, !10.10.10.247]\"\n"
4523 " EXTERNAL_NET: \"any\"\n"
4527 " HTTP_PORTS: \"80:81,88\"\n"
4530 static int DetectAddressYamlParsing01 (
void)
4561 static const char *dummy_conf_string3 =
4566 " address-groups:\n"
4568 " HOME_NET: \"[10.10.10.0/24, !10.10.10.247/32]\"\n"
4570 " EXTERNAL_NET: \"any\"\n"
4574 " HTTP_PORTS: \"80:81,88\"\n"
4577 static int DetectAddressYamlParsing02 (
void)
4608 static const char *dummy_conf_string4 =
4613 " address-groups:\n"
4615 " HOME_NET: \"[10.10.10.0/24, !10.10.10.247/32]\"\n"
4617 " EXTERNAL_NET: \"any\"\n"
4621 " HTTP_PORTS: \"80:81,88\"\n"
4624 static int DetectAddressYamlParsing03 (
void)
4642 static const char *dummy_conf_string5 =
4647 " address-groups:\n"
4649 " HOME_NET: \"[10.196.0.0/24, !10.196.0.15]\"\n"
4651 " EXTERNAL_NET: \"any\"\n"
4655 " HTTP_PORTS: \"80:81,88\"\n"
4659 static int DetectAddressYamlParsing04 (
void)
4686 UtRegisterTest(
"SigTest05 -- distance/within mismatch", SigTest05);
4687 UtRegisterTest(
"SigTest06 -- uricontent HTTP/1.1 match test", SigTest06);
4690 UtRegisterTest(
"SigTest08 -- uricontent HTTP/1.0 match test", SigTest08);
4693 UtRegisterTest(
"SigTest10 -- long content match, longer than pkt",
4696 UtRegisterTest(
"SigTest12 -- content order matching, normal", SigTest12);
4697 UtRegisterTest(
"SigTest13 -- content order matching, diff order",
4699 UtRegisterTest(
"SigTest14 -- content order matching, distance 0",
4701 UtRegisterTest(
"SigTest15 -- port negation sig (no match)", SigTest15);
4702 UtRegisterTest(
"SigTest16 -- port negation sig (match)", SigTest16);
4703 UtRegisterTest(
"SigTest17 -- HTTP Host Pkt var capture", SigTest17);
4713 SigTest25NegativeIPV4Keyword);
4717 SigTest26TCPV4AndNegativeIPV4Keyword);
4719 SigTest26TCPV4AndIPV4Keyword);
4721 SigTest27NegativeTCPV4Keyword);
4725 SigTest29NegativeTCPV6Keyword);
4729 SigTest31NegativeUDPV4Keyword);
4733 SigTest33NegativeUDPV6Keyword);
4735 UtRegisterTest(
"SigTest34ICMPV4Keyword", SigTest34ICMPV4Keyword);
4737 SigTest35NegativeICMPV4Keyword);
4739 SigTest36ContentAndIsdataatKeywords01);
4741 SigTest37ContentAndIsdataatKeywords02);
4748 SigTest40NoPacketInspection01);
4750 SigTest40NoPayloadInspection02);
4756 UtRegisterTest(
"SigTestContent01 -- 32 byte pattern", SigTestContent01);
4757 UtRegisterTest(
"SigTestContent02 -- 32+31 byte pattern", SigTestContent02);
4758 UtRegisterTest(
"SigTestContent03 -- 32 byte pattern, x2 + distance",
4760 UtRegisterTest(
"SigTestContent04 -- 32 byte pattern, x2 + distance/within",
4762 UtRegisterTest(
"SigTestContent05 -- distance/within", SigTestContent05);
4769 UtRegisterTest(
"SigTestDetectAlertCounter", SigTestDetectAlertCounter);
4775 UtRegisterTest(
"DetectAddressYamlParsing01", DetectAddressYamlParsing01);
4776 UtRegisterTest(
"DetectAddressYamlParsing02", DetectAddressYamlParsing02);
4777 UtRegisterTest(
"DetectAddressYamlParsing03", DetectAddressYamlParsing03);
4778 UtRegisterTest(
"DetectAddressYamlParsing04", DetectAddressYamlParsing04);