@ -2091,7 +2091,7 @@ static int SigTest47TestNegatedContent(void)
*/
staticintSigTest48TestNegatedContent(void)
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"GET\"; content:!\"GES\"; within:26; sid:1;)",(uint8_t*)"GET /one/ HTTP/1.1\r\n Host: one.example.org\r\n\r\n\r\nGET /two/ HTTP/1.1\r\nHost: two.example.org\r\n\r\n\r\n");
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"GET\"; content:!\"GES\"; within:26; dsize:>1; sid:1;)",(uint8_t*)"GET /one/ HTTP/1.1\r\n Host: one.example.org\r\n\r\n\r\nGET /two/ HTTP/1.1\r\nHost: two.example.org\r\n\r\n\r\n");
}
/**
@ -2109,7 +2109,7 @@ static int SigTest49TestNegatedContent(void)
*/
staticintSigTest50TestNegatedContent(void)
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"GET\"; content:!\"GES\"; distance:25; sid:1;)",(uint8_t*)"GET /one/ HTTP/1.1\r\n Host: one.example.org\r\n\r\n\r\nGET /two/ HTTP/1.1\r\nHost: two.example.org\r\n\r\n\r\n");
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"GET\"; content:!\"GES\"; distance:25; dsize:>1; sid:1;)",(uint8_t*)"GET /one/ HTTP/1.1\r\n Host: one.example.org\r\n\r\n\r\nGET /two/ HTTP/1.1\r\nHost: two.example.org\r\n\r\n\r\n");
}
/**
@ -2166,7 +2166,7 @@ static int SigTest55TestNegatedContent(void)
*/
staticintSigTest56TestNegatedContent(void)
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"one\"; content:\"fourty\"; within:56; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"one\"; content:\"fourty\"; within:56; dsize:>1; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/**
@ -2252,7 +2252,7 @@ static int SigTest67TestNegatedContent(void)
staticintSigTest68TestNegatedContent(void)
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (content:\"one\"; depth:10; content:\"nine\"; offset:8; content:!\"fourty\"; within:28; content:\"fiftysix\"; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestPositiveTestContent("alert tcp any any -> any any (content:\"one\"; depth:10; content:\"nine\"; offset:8; content:!\"fourty\"; within:28; content:\"fiftysix\"; dsize:>1; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
staticintSigTest69TestNegatedContent(void)
@ -2283,12 +2283,12 @@ static int SigTest73TestNegatedContent(void)
staticintSigTest74TestNegatedContent(void)
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"USER\"; content:!\"PASS\"; sid:1;)",(uint8_t*)"USER apple");
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"USER\"; content:!\"PASS\"; dsize:>1; sid:1;)",(uint8_t*)"USER apple");
}
staticintSigTest75TestNegatedContent(void)
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"USER\"; content:\"!PASS\"; sid:1;)",(uint8_t*)"USER !PASS");
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"USER\"; content:\"!PASS\"; dsize:>1; sid:1;)",(uint8_t*)"USER !PASS");
}
staticintSigTest76TestBug134(void)
@ -2310,7 +2310,7 @@ static int SigTest76TestBug134(void)
sigs[3]="alert tcp 192.168.1.5 any -> 192.168.1.1 any (msg:\"Testing src/dst ip (sid 4)\"; sid:4;)";
sigs[4]="alert tcp 192.168.1.0/24 any -> any any (msg:\"Testing src/dst ip (sid 5)\"; sid:5;)";
sigs[5]="alert tcp any any -> 192.168.0.0/16 any (msg:\"Testing src/dst ip (sid 6)\"; sid:6;)";
sigs[6]="alert tcp 192.168.1.0/24 any -> 192.168.0.0/16 any (msg:\"Testing src/dst ip (sid 7)\"; content:\"Hi all\";sid:7;)";
sigs[6]="alert tcp 192.168.1.0/24 any -> 192.168.0.0/16 any (msg:\"Testing src/dst ip (sid 7)\"; content:\"Hi all\"; dsize:>1; sid:7;)";
/* Sid numbers (we could extract them from the sig) */
uint32_tsid[7]={1,2,3,4,5,6,7};
@ -1825,7 +1825,7 @@ int IPOnlyTestSig06(void) {
sigs[3]="alert tcp 192.168.1.5 any -> 192.168.1.1 any (msg:\"Testing src/dst ip (sid 4)\"; sid:4;)";
sigs[4]="alert tcp 192.168.1.0/24 any -> any any (msg:\"Testing src/dst ip (sid 5)\"; sid:5;)";
sigs[5]="alert tcp any any -> 192.168.0.0/16 any (msg:\"Testing src/dst ip (sid 6)\"; sid:6;)";
sigs[6]="alert tcp 192.168.1.0/24 any -> 192.168.0.0/16 any (msg:\"Testing src/dst ip (sid 7)\"; content:\"Hi all\";sid:7;)";
sigs[6]="alert tcp 192.168.1.0/24 any -> 192.168.0.0/16 any (msg:\"Testing src/dst ip (sid 7)\"; content:\"Hi all\"; dsize:>1; sid:7;)";
/* Sid numbers (we could extract them from the sig) */
uint32_tsid[7]={1,2,3,4,5,6,7};
@ -1933,7 +1933,7 @@ int IPOnlyTestSig09(void) {
sigs[3]="alert tcp 3FFE:FFFF:7654:FEDA:1245:BA98:3210:4565 any -> 3FFE:FFFF:7654:FEDA:1245:BA98:3210:0/96 any (msg:\"Testing src/dst ip (sid 4)\"; sid:4;)";
sigs[4]="alert tcp 3FFE:FFFF:7654:FEDA:0:0:0:0/64 any -> any any (msg:\"Testing src/dst ip (sid 5)\"; sid:5;)";
sigs[5]="alert tcp any any -> 3FFE:FFFF:7654:FEDA:0:0:0:0/64 any (msg:\"Testing src/dst ip (sid 6)\"; sid:6;)";
sigs[6]="alert tcp 3FFE:FFFF:7654:FEDA:0:0:0:0/64 any -> 3FFE:FFFF:7654:FEDA:0:0:0:0/64 any (msg:\"Testing src/dst ip (sid 7)\"; content:\"Hi all\";sid:7;)";
sigs[6]="alert tcp 3FFE:FFFF:7654:FEDA:0:0:0:0/64 any -> 3FFE:FFFF:7654:FEDA:0:0:0:0/64 any (msg:\"Testing src/dst ip (sid 7)\"; content:\"Hi all\"; dsize:>1; sid:7;)";
/* Sid numbers (we could extract them from the sig) */
uint32_tsid[7]={1,2,3,4,5,6,7};
@ -1969,7 +1969,7 @@ int IPOnlyTestSig10(void) {
sigs[3]="alert tcp 3FFE:FFFF:7654:FEDA:1245:BA98:3210:4565 any -> !3FFE:FFFF:7654:FEDA:1245:BA98:3210:4562/96 any (msg:\"Testing src/dst ip (sid 4)\"; sid:4;)";
sigs[4]="alert tcp !3FFE:FFFF:7654:FEDA:0:0:0:0/64 any -> any any (msg:\"Testing src/dst ip (sid 5)\"; sid:5;)";
sigs[5]="alert tcp any any -> !3FFE:FFFF:7654:FEDA:0:0:0:0/64 any (msg:\"Testing src/dst ip (sid 6)\"; sid:6;)";
sigs[6]="alert tcp 3FFE:FFFF:7654:FEDA:0:0:0:0/64 any -> 3FFE:FFFF:7654:FEDB:0:0:0:0/64 any (msg:\"Testing src/dst ip (sid 7)\"; content:\"Hi all\";sid:7;)";
sigs[6]="alert tcp 3FFE:FFFF:7654:FEDA:0:0:0:0/64 any -> 3FFE:FFFF:7654:FEDB:0:0:0:0/64 any (msg:\"Testing src/dst ip (sid 7)\"; content:\"Hi all\"; dsize:>1; sid:7;)";
/* Sid numbers (we could extract them from the sig) */
uint32_tsid[7]={1,2,3,4,5,6,7};
@ -2143,7 +2143,7 @@ int IPOnlyTestSig15(void)
sigs[5]="alert tcp any any -> 192.168.0.0/16 any (msg:\"Testing src/dst ip (sid 6)\"; "
"flowbits:set,six; sid:6;)";
sigs[6]="alert tcp 192.168.1.0/24 any -> 192.168.0.0/16 any (msg:\"Testing src/dst ip (sid 7)\"; "
@ -926,7 +926,7 @@ static int PayloadTestSig14(void)
Packet*p=UTHBuildPacket(buf,buflen,IPPROTO_TCP);
intresult=0;
charsig[]="alert tcp any any -> any any (content:\"User-Agent|3A| Mozilla/5.0 |28|Macintosh|3B| \"; content:\"Firefox/3.\"; distance:0; content:!\"Firefox/3.6.12\"; distance:-10; content:!\"Mozilla/5.0 |28|Macintosh|3B| U|3B| Intel Mac OS X 10.5|3B| en-US|3B| rv|3A|1.9.1b4|29| Gecko/20090423 Firefox/3.6 GTB5\"; sid:1; rev:1;)";
charsig[]="alert tcp any any -> any any (content:\"User-Agent|3A| Mozilla/5.0 |28|Macintosh|3B| \"; content:\"Firefox/3.\"; distance:0; content:!\"Firefox/3.6.12\"; distance:-10; content:!\"Mozilla/5.0 |28|Macintosh|3B| U|3B| Intel Mac OS X 10.5|3B| en-US|3B| rv|3A|1.9.1b4|29| Gecko/20090423 Firefox/3.6 GTB5\"; dsize:>1; sid:1; rev:1;)";
//char sig[] = "alert tcp any any -> any any (content:\"User-Agent: Mozilla/5.0 (Macintosh; \"; content:\"Firefox/3.\"; distance:0; content:!\"Firefox/3.6.12\"; distance:-10; content:!\"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b4) Gecko/20090423 Firefox/3.6 GTB5\"; sid:1; rev:1;)";
@ -949,7 +949,7 @@ static int PayloadTestSig15(void)
intresult=0;
charsig[]="alert tcp any any -> any any (msg:\"dummy\"; "
@ -1391,11 +1391,11 @@ int DetectFlowintTestPacket01Real()
de_ctx->flags|=DE_QUIET;
/* Now that we have the array of packets for the flow, prepare the signatures */
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Setting a flowint counter\"; content:\"GET\"; flowint:myvar,=,1; flowint:maxvar,=,6; sid:101;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Setting a flowint counter\"; content:\"GET\"; flowint:myvar,=,1; flowint:maxvar,=,6; dsize:>1; sid:101;)");
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Adding to flowint counter\"; content:\"Unauthorized\"; flowint: myvar,+,2; sid:102;)");
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Adding to flowint counter\"; content:\"Unauthorized\"; flowint: myvar,+,2; dsize:>1; sid:102;)");
de_ctx->sig_list->next->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"if the flowint counter is 3 create a new counter\"; content:\"Unauthorized\"; flowint: myvar,==,3; flowint: cntpackets, =, 0; sid:103;)");
de_ctx->sig_list->next->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"if the flowint counter is 3 create a new counter\"; content:\"Unauthorized\"; flowint: myvar,==,3; flowint: cntpackets, =, 0; dsize:>1; sid:103;)");
de_ctx->sig_list->next->next->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"and count the rest of the packets received without generating alerts!!!\"; flowint: myvar,==,3; flowint: cntpackets, +, 1; noalert;sid:104;)");
@ -1736,7 +1736,7 @@ int DetectFlowintTestPacket02Real()
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Adding to flowint counter\"; content:\"Unauthorized\"; flowint:myvar,isset; flowint: myvar,+,2; sid:102;)");
de_ctx->sig_list->next->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"if the flowint counter is 3 create a new counter\"; content:\"Unauthorized\"; flowint: myvar, isset; flowint: myvar,==,3; flowint:cntpackets,notset; flowint: cntpackets, =, 0; sid:103;)");
de_ctx->sig_list->next->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"if the flowint counter is 3 create a new counter\"; content:\"Unauthorized\"; flowint: myvar, isset; flowint: myvar,==,3; flowint:cntpackets,notset; flowint: cntpackets, =, 0; dsize:>1; sid:103;)");
de_ctx->sig_list->next->next->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"and count the rest of the packets received without generating alerts!!!\"; flowint: cntpackets,isset; flowint: cntpackets, +, 1; noalert;sid:104;)");
@ -2076,11 +2076,11 @@ int DetectFlowintTestPacket03Real()
de_ctx->flags|=DE_QUIET;
/* Now that we have the array of packets for the flow, prepare the signatures */
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"check notset\"; content:\"GET\"; flowint: myvar, notset; flowint: myvar,=,0; flowint: other,=,10; sid:101;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"check notset\"; content:\"GET\"; flowint: myvar, notset; flowint: myvar,=,0; flowint: other,=,10; dsize:>1; sid:101;)");
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"check isset\"; content:\"Unauthorized\"; flowint:myvar,isset; flowint: other,isset; sid:102;)");
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"check isset\"; content:\"Unauthorized\"; flowint:myvar,isset; flowint: other,isset; dsize:>1; sid:102;)");
de_ctx->sig_list->next->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"check notset\"; content:\"Unauthorized\"; flowint:lala,isset; sid:103;)");
de_ctx->sig_list->next->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"check notset\"; content:\"Unauthorized\"; flowint:lala,isset; dsize:>1; sid:103;)");
@ -411,7 +411,7 @@ static int DetectThresholdTestSig1(void) {
de_ctx->flags|=DE_QUIET;
s=de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any 80 (msg:\"Threshold limit\"; content:\"A\"; threshold: type limit, track by_dst, count 5, seconds 60; sid:1;)");
s=de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any 80 (msg:\"Threshold limit\"; content:\"A\"; threshold: type limit, track by_dst, count 5, seconds 60; dsize:>0; sid:1;)");
@ -1692,7 +1692,7 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh
/* Limit the number of times we do this recursive thing.
*XXXisthisasanelimit?Shoulditbeconfigurable?*/
if(recursion_cnt==10)
gotodone;
goto next;
}while(rmatch);
}else{
@ -1729,9 +1729,6 @@ int SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineTh
next:
RULE_PROFILING_END(s,match);
continue;
done:
RULE_PROFILING_END(s,match);
break;
}
PACKET_PROFILING_DETECT_END(p,PROF_DETECT_RULES);
@ -4416,7 +4413,7 @@ static int SigTest01Real (int mpm_type) {
Packet*p=UTHBuildPacket(buf,buflen,IPPROTO_TCP);
intresult=0;
charsig[]="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\"; recursive; sid:1;)";
charsig[]="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\"; recursive; dsize:>1; sid:1;)";
if(UTHPacketMatchSigMpm(p,sig,mpm_type)==0){
result=0;
gotoend;
@ -4461,7 +4458,7 @@ static int SigTest02Real (int mpm_type) {
"\r\n\r\n";
uint16_tbuflen=strlen((char*)buf);
Packet*p=UTHBuildPacket(buf,buflen,IPPROTO_TCP);
charsig[]="alert tcp any any -> any any (msg:\"HTTP TEST\"; content:\"Host: one.example.org\"; offset:20; depth:41; sid:1;)";
charsig[]="alert tcp any any -> any any (msg:\"HTTP TEST\"; content:\"Host: one.example.org\"; offset:20; depth:41; dsize:>1; sid:1;)";
intret=UTHPacketMatchSigMpm(p,sig,mpm_type);
UTHFreePacket(p);
returnret;
@ -4504,7 +4501,7 @@ static int SigTest03Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"HTTP TEST\"; content:\"Host: one.example.org\"; offset:20; depth:39; sid:1;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"HTTP TEST\"; content:\"Host: one.example.org\"; offset:20; depth:39; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -4566,7 +4563,7 @@ static int SigTest04Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"HTTP TEST\"; content:\"Host:\"; offset:20; depth:25; content:\"Host:\"; distance:42; within:47; sid:1;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"HTTP TEST\"; content:\"Host:\"; offset:20; depth:25; content:\"Host:\"; distance:42; within:47; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -4625,7 +4622,7 @@ static int SigTest05Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"HTTP TEST\"; content:\"Host:\"; offset:20; depth:25; content:\"Host:\"; distance:48; within:52; sid:1;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"HTTP TEST\"; content:\"Host:\"; offset:20; depth:25; content:\"Host:\"; distance:48; within:52; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
printf("sig parse failed: ");
gotoend;
@ -4704,7 +4701,7 @@ static int SigTest06Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
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\"; recursive; sid:1;)");
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\"; dsize:>1; recursive; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -4800,7 +4797,7 @@ static int SigTest07Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
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\"; recursive; sid:1;)");
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\"; recursive; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -4896,7 +4893,7 @@ static int SigTest08Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
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\\/1\\.0\\r\\n/G\"; sid:1;)");
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\\/1\\.0\\r\\n/G\"; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -4992,7 +4989,7 @@ static int SigTest09Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
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\\/1\\.0\\r\\n/G\"; sid:1;)");
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\\/1\\.0\\r\\n/G\"; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -5080,12 +5077,12 @@ static int SigTest10Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Long content test (1)\"; content:\"ABCD\"; depth:4; sid:1;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Long content test (1)\"; content:\"ABCD\"; depth:4; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
}
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Long content test (2)\"; content:\"VWXYZ\"; sid:2;)");
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Long content test (2)\"; content:\"VWXYZ\"; dsize:>1; sid:2;)");
if(de_ctx->sig_list->next==NULL){
result=0;
gotoend;
@ -5167,11 +5164,11 @@ static int SigTest11Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (content:\"ABCDEFGHIJ\"; content:\"klmnop\"; content:\"1234\"; sid:1;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (content:\"ABCDEFGHIJ\"; content:\"klmnop\"; content:\"1234\"; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
gotoend;
}
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (content:\"VWXYZabcde\"; content:\"5678\"; content:\"89\"; sid:2;)");
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (content:\"VWXYZabcde\"; content:\"5678\"; content:\"89\"; dsize:>1; sid:2;)");
if(de_ctx->sig_list->next==NULL){
gotoend;
}
@ -5232,7 +5229,7 @@ static int SigTest12Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
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;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Content order test\"; content:\"ABCDEFGHIJ\"; content:\"klmnop\"; content:\"1234\"; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -5297,7 +5294,7 @@ static int SigTest13Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
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;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Content order test\"; content:\"ABCDEFGHIJ\"; content:\"1234\"; content:\"klmnop\"; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -5353,7 +5350,7 @@ static int SigTest14Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
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;)");
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; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -5421,7 +5418,7 @@ static int SigTest15Real (int mpm_type) {
de_ctx->flags|=DE_QUIET;
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;)");
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; dsize:>1; rev:2;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -5484,7 +5481,7 @@ static int SigTest16Real (int mpm_type) {
de_ctx->flags|=DE_QUIET;
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;)");
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; dsize:>1; sid:2008284; rev:2;)");
if(de_ctx->sig_list==NULL){
gotoend;
}
@ -5548,7 +5545,7 @@ static int SigTest17Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
de_ctx->sig_list=SigInit(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;)");
de_ctx->sig_list=SigInit(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; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -5626,7 +5623,7 @@ static int SigTest18Real (int mpm_type) {
de_ctx->flags|=DE_QUIET;
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;)");
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[- ]/\"; dsize:>1; sid:2003055; rev:4;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -5842,12 +5839,12 @@ static int SigTest21Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
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;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"FLOWBIT SET\"; content:\"/one/\"; flowbits:set,TEST.one; flowbits:noalert; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
}
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"FLOWBIT TEST\"; content:\"/two/\"; flowbits:isset,TEST.one; sid:2;)");
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"FLOWBIT TEST\"; content:\"/two/\"; flowbits:isset,TEST.one; dsize:>1; sid:2;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -5932,12 +5929,12 @@ static int SigTest22Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
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;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"FLOWBIT SET\"; content:\"/one/\"; flowbits:set,TEST.one; flowbits:noalert; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
}
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"FLOWBIT TEST\"; content:\"/two/\"; flowbits:isset,TEST.abc; sid:2;)");
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"FLOWBIT TEST\"; content:\"/two/\"; flowbits:isset,TEST.abc; dsize:>1; sid:2;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -6018,12 +6015,12 @@ static int SigTest23Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
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;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"FLOWBIT SET\"; content:\"/one/\"; flowbits:toggle,TEST.one; flowbits:noalert; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
}
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"FLOWBIT TEST\"; content:\"/two/\"; flowbits:isset,TEST.one; sid:2;)");
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"FLOWBIT TEST\"; content:\"/two/\"; flowbits:isset,TEST.one; dsize:>1; sid:2;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -6123,7 +6120,7 @@ int SigTest24IPV4Keyword(void)
de_ctx->sig_list=SigInit(de_ctx,
"alert ip any any -> any any "
"(content:\"/one/\"; ipv4-csum:valid; "
"(content:\"/one/\"; ipv4-csum:valid; dsize:>1; "
"msg:\"ipv4-csum keyword check(1)\"; sid:1;)");
if(de_ctx->sig_list==NULL){
printf("sig 1 parse: ");
@ -6132,7 +6129,7 @@ int SigTest24IPV4Keyword(void)
@ -8079,7 +8076,7 @@ int SigTest36ContentAndIsdataatKeywords01Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"SigTest36ContentAndIsdataatKeywords01 \"; content:\"HTTP\"; isdataat:404, relative; sid:101;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"SigTest36ContentAndIsdataatKeywords01 \"; content:\"HTTP\"; isdataat:404, relative; dsize:>1; sid:101;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -9290,7 +9287,7 @@ static int SigTestSgh05 (void) {
de_ctx->flags|=DE_QUIET;
de_ctx->mpm_matcher=MPM_WUMANBER;
de_ctx->sig_list=SigInit(de_ctx,"alert ip any any -> 1.2.3.4-1.2.3.6 any (msg:\"1\"; content:\"one\"; content:\"1\"; sid:1;)");
de_ctx->sig_list=SigInit(de_ctx,"alert ip any any -> 1.2.3.4-1.2.3.6 any (msg:\"1\"; content:\"one\"; content:\"1\"; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -9345,7 +9342,7 @@ static int SigTestContent01Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; sid:1;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -9398,13 +9395,13 @@ static int SigTestContent02Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; sid:1;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
}
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Test 31\"; content:\"0123456789012345678901234567890\"; sid:2;)");
de_ctx->sig_list->next=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Test 31\"; content:\"0123456789012345678901234567890\"; dsize:>1; sid:2;)");
if(de_ctx->sig_list->next==NULL){
result=0;
gotoend;
@ -9461,7 +9458,7 @@ static int SigTestContent03Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; content:\"abcdefghijklmnopqrstuvwxyzABCDEF\"; distance:0; sid:1;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; content:\"abcdefghijklmnopqrstuvwxyzABCDEF\"; distance:0; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -9515,7 +9512,7 @@ static int SigTestContent04Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
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;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; content:\"abcdefghijklmnopqrstuvwxyzABCDEF\"; distance:0; within:32; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -9570,12 +9567,12 @@ static int SigTestContent05Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
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;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Test 32\"; content:\"01234567890123456789012345678901\"; content:\"abcdefghijklmnopqrstuvwxyzABCDEF\"; distance:0; within:32; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
printf("sig1 parse failed: ");
gotoend;
}
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;)");
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; dsize:>1; sid:2;)");
if(de_ctx->sig_list->next==NULL){
printf("sig2 parse failed: ");
gotoend;
@ -9639,12 +9636,12 @@ static int SigTestContent06Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
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;)");
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; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
}
de_ctx->sig_list->next=SigInit(de_ctx,"alert ip any any -> any any (msg:\"Test 32 sig2\"; content:\"01234567890123456789012345678901\"; content:\"abcdefg\"; sid:2;)");
de_ctx->sig_list->next=SigInit(de_ctx,"alert ip any any -> any any (msg:\"Test 32 sig2\"; content:\"01234567890123456789012345678901\"; content:\"abcdefg\"; dsize:>1; sid:2;)");
if(de_ctx->sig_list->next==NULL){
result=0;
gotoend;
@ -9799,7 +9796,7 @@ static int SigTestWithinReal01 (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"within test\"; content:\"Hi, this is a big test to check \"; content:\"content matches\"; distance:0; within:15; sid:556;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"within test\"; content:\"Hi, this is a big test to check \"; content:\"content matches\"; distance:0; within:15; dsize:>1; sid:556;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -9926,7 +9923,7 @@ static int SigTestDepthOffset01Real (int mpm_type) {
de_ctx->mpm_matcher=mpm_type;
de_ctx->flags|=DE_QUIET;
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"depth offset\"; content:\"456\"; offset:4; depth:3; sid:1;)");
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"depth offset\"; content:\"456\"; offset:4; depth:3; dsize:>1; sid:1;)");
if(de_ctx->sig_list==NULL){
result=0;
gotoend;
@ -9976,7 +9973,7 @@ static int SigTestDetectAlertCounter(void)
de_ctx->flags|=DE_QUIET;
de_ctx->sig_list=SigInit(de_ctx,"alert tcp any any -> any any (msg:\"Test counter\"; "