fix parsing content keywords. We are more strict now. All content keywords need to be enclosed in double quotes. Better validation for sid, priority and rev keywords
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:!GES; 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:!\"GES\"; 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");
}
/**
@ -2015,7 +2032,7 @@ static int SigTest41TestNegatedContent(void)
*/
staticintSigTest42TestNegatedContent(void)
{// 01 5 10 15 20 24
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:!twentythree; depth:22; offset:35; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:!\"twentythree\"; depth:22; offset:35; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/**
@ -2027,7 +2044,7 @@ static int SigTest42TestNegatedContent(void)
*/
staticintSigTest43TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:!twentythree; depth:34; offset:23; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:!\"twentythree\"; depth:34; offset:23; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/**
@ -2037,7 +2054,7 @@ static int SigTest43TestNegatedContent(void)
*/
staticintSigTest44TestNegatedContent(void)
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:!twentythree; offset:40; depth:35; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:!\"twentythree\"; offset:40; depth:35; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/**
@ -2046,7 +2063,7 @@ static int SigTest44TestNegatedContent(void)
*/
staticintSigTest45TestNegatedContent(void)
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:one; depth:5; content:!twentythree; depth:23; 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\"; depth:5; content:!\"twentythree\"; depth:23; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/**
@ -2055,7 +2072,7 @@ static int SigTest45TestNegatedContent(void)
*/
staticintSigTest46TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:onee; content:!twentythree; depth:23; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"onee\"; content:!\"twentythree\"; depth:23; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/**
@ -2065,7 +2082,7 @@ static int SigTest46TestNegatedContent(void)
*/
staticintSigTest47TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:one; offset:5; content:!twentythree; depth:23; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"one\"; offset:5; content:!\"twentythree\"; depth:23; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/**
@ -2074,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; 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");
}
/**
@ -2083,7 +2100,7 @@ static int SigTest48TestNegatedContent(void)
*/
staticintSigTest49TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:GET; content:!Host; 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");
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"GET\"; content:!\"Host\"; 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");
}
/**
@ -2092,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; 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");
}
/**
@ -2113,7 +2130,7 @@ static int SigTest51TestNegatedContent(void)
*/
staticintSigTest52TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:GES; content:!BOO; 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");
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"GES\"; content:!\"BOO\"; 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");
}
/**
@ -2122,7 +2139,7 @@ static int SigTest52TestNegatedContent(void)
*/
staticintSigTest53TestNegatedContent(void)
{
returnSigTestNegativeTestContent("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");
returnSigTestNegativeTestContent("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");
}
/**
@ -2131,7 +2148,7 @@ static int SigTest53TestNegatedContent(void)
*/
staticintSigTest54TestNegatedContent(void)
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:one; content:!fourty; within:20; 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:20; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/**
@ -2140,7 +2157,7 @@ static int SigTest54TestNegatedContent(void)
*/
staticintSigTest55TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:!one; depth:5; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:!\"one\"; depth:5; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/**
@ -2149,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; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/**
@ -2158,7 +2175,7 @@ static int SigTest56TestNegatedContent(void)
*/
staticintSigTest57TestNegatedContent(void)
{
returnSigTestNegativeTestContent("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");
returnSigTestNegativeTestContent("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");
}
/**
@ -2167,7 +2184,7 @@ static int SigTest57TestNegatedContent(void)
*/
staticintSigTest58TestNegatedContent(void)
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:one; content:!fourty; distance:57; 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\"; distance:57; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/**
@ -2176,17 +2193,17 @@ static int SigTest58TestNegatedContent(void)
*/
staticintSigTest59TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:one; content:!fourty; distance:30; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"one\"; content:!\"fourty\"; distance:30; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
staticintSigTest60TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:!one; content:fourty; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:!\"one\"; content:\"fourty\"; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
staticintSigTest61TestNegatedContent(void)
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (content:one; depth:10; content:!fourty; within:30; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestPositiveTestContent("alert tcp any any -> any any (content:\"one\"; depth:10; content:!\"fourty\"; within:30; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/** \test Test negation in combination with within and depth
@ -2198,17 +2215,17 @@ static int SigTest61TestNegatedContent(void)
*/
staticintSigTest62TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:one; depth:10; content:!fourty; within:49; depth:52; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:\"one\"; depth:10; content:!\"fourty\"; within:49; depth:52; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
staticintSigTest63TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:one; depth:10; content:!fourty; within:56; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"one\"; depth:10; content:!\"fourty\"; within:56; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
staticintSigTest64TestNegatedContent(void)
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (content:one; depth:10; content:!fourty; within:30; depth:30; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestPositiveTestContent("alert tcp any any -> any any (content:\"one\"; depth:10; content:!\"fourty\"; within:30; depth:30; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/** \test Test negation in combination with within and depth
@ -2220,48 +2237,48 @@ static int SigTest64TestNegatedContent(void)
*/
staticintSigTest65TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:one; depth:10; content:!fourty; distance:0; within:49; offset:46; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:\"one\"; depth:10; content:!\"fourty\"; distance:0; within:49; offset:46; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
staticintSigTest66TestNegatedContent(void)
{
returnSigTestPositiveTestContent("alert tcp any any -> any any (content:one; depth:10; content:!fourty; within:30; offset:56; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestPositiveTestContent("alert tcp any any -> any any (content:\"one\"; depth:10; content:!\"fourty\"; within:30; offset:56; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
staticintSigTest67TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:one; depth:10; content:!four; within:56; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:\"one\"; depth:10; content:!\"four\"; within:56; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
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\"; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
staticintSigTest69TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:one; depth:10; content:nine; offset:8; content:!fourty; within:48; content:fiftysix; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:\"one\"; depth:10; content:\"nine\"; offset:8; content:!\"fourty\"; within:48; content:\"fiftysix\"; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
staticintSigTest70TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:one; content:!fourty; within:52; distance:45 sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:\"one\"; content:!\"fourty\"; within:52; distance:45 sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
/** \test within and distance */
staticintSigTest71TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:one; content:!fourty; within:40; distance:43; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:\"one\"; content:!\"fourty\"; within:40; distance:43; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
staticintSigTest72TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:one; content:!fourty; within:49; distance:43; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (content:\"one\"; content:!\"fourty\"; within:49; distance:43; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
}
staticintSigTest73TestNegatedContent(void)
{
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:one; depth:5; content:!twentythree; depth:35; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");
returnSigTestNegativeTestContent("alert tcp any any -> any any (msg:\"HTTP URI cap\"; content:\"one\"; depth:5; content:!\"twentythree\"; depth:35; sid:1;)",(uint8_t*)"one four nine fourteen twentythree thirtyfive fourtysix fiftysix");