static
int
Get_gaoliang(const char
*
data,u_int32_t end, u_int32_t
len
,char
*
res){
char tmp[
1024
]
=
"";
if
(
len
<
1024
)
{
memcpy(tmp, data
+
end
-
len
,
len
);
}
else
{
memcpy(tmp, data
+
end
-
len
,
1024
);
}
strncat(res, tmp,
4096
);
strncat(res,
"\n\0"
,
4096
);
return
1
;
}
int
DetectEngineContentInspection(DetectEngineCtx
*
de_ctx, DetectEngineThreadCtx
*
det_ctx,
const Signature
*
s, const SigMatchData
*
smd,
Packet
*
p, Flow
*
f,
const uint8_t
*
buffer
, uint32_t buffer_len,
uint32_t stream_start_offset, uint8_t flags,
uint8_t inspection_mode)
{
...
...
...
if
(found
=
=
NULL && !(cd
-
>flags & DETECT_CONTENT_NEGATED)) {
if
((cd
-
>flags & (DETECT_CONTENT_DISTANCE|DETECT_CONTENT_WITHIN))
=
=
0
) {
/
*
independent match
from
previous matches, so failure
is
fatal
*
/
det_ctx
-
>discontinue_matching
=
1
;
}
goto no_match;
}
else
if
(found
=
=
NULL && (cd
-
>flags & DETECT_CONTENT_NEGATED)) {
goto match;
}
else
if
(found !
=
NULL && (cd
-
>flags & DETECT_CONTENT_NEGATED)) {
if
(f){
Get_gaoliang((char
*
)
buffer
,match_offset,cd
-
>content_len,f
-
>gaoliang);
}
SCLogInfo(
"content %"
PRIu32
" matched at offset %"
PRIu32
", but negated so no match"
, cd
-
>
id
, match_offset);
/
*
don't bother carrying recursive matches now,
for
preceding
*
relative keywords
*
/
if
(DETECT_CONTENT_IS_SINGLE(cd))
det_ctx
-
>discontinue_matching
=
1
;
goto no_match;
}
else
{
match_offset
=
(uint32_t)((found
-
buffer
)
+
cd
-
>content_len);
if
(f){
Get_gaoliang((char
*
)
buffer
,match_offset,cd
-
>content_len,f
-
>gaoliang);
}
...