suricata
detect-filename.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2022 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Victor Julien <victor@inliniac.net>
22  * \author Pablo Rincon <pablo.rincon.crespo@gmail.com>
23  *
24  */
25 
26 #include "suricata-common.h"
27 #include "threads.h"
28 #include "decode.h"
29 
30 #include "detect.h"
31 
32 #include "detect-engine.h"
33 #include "detect-engine-mpm.h"
34 #include "detect-engine-state.h"
35 #include "detect-engine-file.h"
38 
39 #include "detect-parse.h"
40 #include "detect-content.h"
41 #include "detect-file-data.h"
42 
43 #include "flow.h"
44 #include "flow-var.h"
45 #include "flow-util.h"
46 
47 #include "util-debug.h"
48 #include "util-spm-bm.h"
49 #include "util-unittest.h"
50 #include "util-unittest-helper.h"
51 #include "util-profiling.h"
52 
53 #include "app-layer.h"
54 #include "app-layer-htp.h"
55 
56 #include "stream-tcp.h"
57 
58 #include "detect-filename.h"
59 #include "app-layer-parser.h"
60 
61 static int DetectFileextSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str);
62 static int DetectFilenameSetup (DetectEngineCtx *, Signature *, const char *);
63 static int DetectFilenameSetupSticky(DetectEngineCtx *de_ctx, Signature *s, const char *str);
64 #ifdef UNITTESTS
65 static void DetectFilenameRegisterTests(void);
66 #endif
67 static int g_file_match_list_id = 0;
68 static int g_file_name_buffer_id = 0;
69 
70 static int PrefilterMpmFilenameRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx,
71  const DetectBufferMpmRegistry *mpm_reg, int list_id);
72 static uint8_t DetectEngineInspectFilename(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
73  const DetectEngineAppInspectionEngine *engine, const Signature *s, Flow *f, uint8_t flags,
74  void *alstate, void *txv, uint64_t tx_id);
75 
76 /**
77  * \brief Registration function for keyword: filename
78  */
80 {
81  sigmatch_table[DETECT_FILENAME].name = "filename";
82  sigmatch_table[DETECT_FILENAME].desc = "match on the file name";
83  sigmatch_table[DETECT_FILENAME].url = "/rules/file-keywords.html#filename";
84  sigmatch_table[DETECT_FILENAME].Setup = DetectFilenameSetup;
85 #ifdef UNITTESTS
86  sigmatch_table[DETECT_FILENAME].RegisterTests = DetectFilenameRegisterTests;
87 #endif
90 
91  sigmatch_table[DETECT_FILEEXT].name = "fileext";
92  sigmatch_table[DETECT_FILEEXT].desc = "match on the extension of a file name";
93  sigmatch_table[DETECT_FILEEXT].url = "/rules/file-keywords.html#fileext";
94  sigmatch_table[DETECT_FILEEXT].Setup = DetectFileextSetup;
97 
98  sigmatch_table[DETECT_FILE_NAME].name = "file.name";
99  sigmatch_table[DETECT_FILE_NAME].desc = "sticky buffer to match on the file name";
100  sigmatch_table[DETECT_FILE_NAME].url = "/rules/file-keywords.html#filename";
101  sigmatch_table[DETECT_FILE_NAME].Setup = DetectFilenameSetupSticky;
103 
104  DetectBufferTypeSetDescriptionByName("file.name", "file name");
105 
106  g_file_match_list_id = DetectBufferTypeRegister("files");
107  g_file_name_buffer_id = DetectBufferTypeRegister("file.name");
108 
109  SCLogDebug("registering filename rule option");
114 
115  filehandler_table[DETECT_FILE_NAME].name = "file.name";
117  filehandler_table[DETECT_FILE_NAME].PrefilterFn = PrefilterMpmFilenameRegister;
118  filehandler_table[DETECT_FILE_NAME].Callback = DetectEngineInspectFilename;
119 
121  return;
122 }
123 
124 static int DetectFileextSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
125 {
126  if (s->init_data->transforms.cnt) {
127  SCLogError("previous transforms not consumed before 'fileext'");
128  SCReturnInt(-1);
129  }
132 
133  size_t dotstr_len = strlen(str) + 2;
134  char *dotstr = SCCalloc(1, dotstr_len);
135  if (dotstr == NULL)
136  return -1;
137  dotstr[0] = '.';
138  strlcat(dotstr, str, dotstr_len);
139 
140  if (DetectContentSetup(de_ctx, s, dotstr) < 0) {
141  SCFree(dotstr);
142  return -1;
143  }
144  SCFree(dotstr);
145 
147  if (sm == NULL)
148  return -1;
149 
152  if (DetectContentConvertToNocase(de_ctx, cd) != 0)
153  return -1;
155  de_ctx, s, NULL, DETECT_FILE_NAME, g_file_name_buffer_id, s->alproto) < 0)
156  return -1;
157 
158  return 0;
159 }
160 /**
161  * \brief this function is used to parse filename options
162  * \brief into the current signature
163  *
164  * \param de_ctx pointer to the Detection Engine Context
165  * \param s pointer to the Current Signature
166  * \param str pointer to the user provided "filename" option
167  *
168  * \retval 0 on Success
169  * \retval -1 on Failure
170  */
171 static int DetectFilenameSetup (DetectEngineCtx *de_ctx, Signature *s, const char *str)
172 {
173  if (s->init_data->transforms.cnt) {
174  SCLogError("previous transforms not consumed before 'filename'");
175  SCReturnInt(-1);
176  }
179 
180  if (DetectContentSetup(de_ctx, s, str) < 0) {
181  return -1;
182  }
183 
185  if (sm == NULL)
186  return -1;
187 
189  if (DetectContentConvertToNocase(de_ctx, cd) != 0)
190  return -1;
192  de_ctx, s, NULL, DETECT_FILE_NAME, g_file_name_buffer_id, s->alproto) < 0)
193  return -1;
194 
195  return 0;
196 }
197 
198 /* file.name implementation */
199 
200 /**
201  * \brief this function setup the file.data keyword used in the rule
202  *
203  * \param de_ctx Pointer to the Detection Engine Context
204  * \param s Pointer to the Signature to which the current keyword belongs
205  * \param str Should hold an empty string always
206  *
207  * \retval 0 On success
208  */
209 static int DetectFilenameSetupSticky(DetectEngineCtx *de_ctx, Signature *s, const char *str)
210 {
211  if (DetectBufferSetActiveList(de_ctx, s, g_file_name_buffer_id) < 0)
212  return -1;
214  return 0;
215 }
216 
217 static InspectionBuffer *FilenameGetDataCallback(DetectEngineThreadCtx *det_ctx,
218  const DetectEngineTransforms *transforms, Flow *f, uint8_t flow_flags, File *cur_file,
219  int list_id, int local_file_id)
220 {
221  SCEnter();
222 
223  InspectionBuffer *buffer = InspectionBufferMultipleForListGet(det_ctx, list_id, local_file_id);
224  if (buffer == NULL)
225  return NULL;
226  if (buffer->initialized)
227  return buffer;
228 
229  const uint8_t *data = cur_file->name;
230  uint32_t data_len = cur_file->name_len;
231 
232  InspectionBufferSetupMulti(buffer, transforms, data, data_len);
233 
234  SCReturnPtr(buffer, "InspectionBuffer");
235 }
236 
237 static uint8_t DetectEngineInspectFilename(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
238  const DetectEngineAppInspectionEngine *engine, const Signature *s, Flow *f, uint8_t flags,
239  void *alstate, void *txv, uint64_t tx_id)
240 {
241  const DetectEngineTransforms *transforms = NULL;
242  if (!engine->mpm) {
243  transforms = engine->v2.transforms;
244  }
245 
246  AppLayerGetFileState files = AppLayerParserGetTxFiles(f, alstate, txv, flags);
247  FileContainer *ffc = files.fc;
248  if (ffc == NULL) {
250  }
251 
253  int local_file_id = 0;
254  for (File *file = ffc->head; file != NULL; file = file->next) {
255  InspectionBuffer *buffer = FilenameGetDataCallback(
256  det_ctx, transforms, f, flags, file, engine->sm_list, local_file_id);
257  if (buffer == NULL)
258  continue;
259 
260  det_ctx->buffer_offset = 0;
261  det_ctx->discontinue_matching = 0;
262  det_ctx->inspection_recursion_counter = 0;
263  int match = DetectEngineContentInspection(de_ctx, det_ctx, s, engine->smd,
264  NULL, f,
265  (uint8_t *)buffer->inspect,
266  buffer->inspect_len,
269  if (match == 1) {
271  } else {
273  }
274  local_file_id++;
275  }
276  return r;
277 }
278 
279 typedef struct PrefilterMpmFilename {
280  int list_id;
281  const MpmCtx *mpm_ctx;
284 
285 /** \brief Filedata Filedata Mpm prefilter callback
286  *
287  * \param det_ctx detection engine thread ctx
288  * \param p packet to inspect
289  * \param f flow to inspect
290  * \param txv tx to inspect
291  * \param pectx inspection context
292  */
293 static void PrefilterTxFilename(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p,
294  Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *txd, const uint8_t flags)
295 {
296  SCEnter();
297 
298  if (!AppLayerParserHasFilesInDir(txd, flags))
299  return;
300 
301  const PrefilterMpmFilename *ctx = (const PrefilterMpmFilename *)pectx;
302  const MpmCtx *mpm_ctx = ctx->mpm_ctx;
303  const int list_id = ctx->list_id;
304 
305  AppLayerGetFileState files = AppLayerParserGetTxFiles(f, f->alstate, txv, flags);
306  FileContainer *ffc = files.fc;
307  if (ffc != NULL) {
308  int local_file_id = 0;
309  for (File *file = ffc->head; file != NULL; file = file->next) {
310  InspectionBuffer *buffer = FilenameGetDataCallback(
311  det_ctx, ctx->transforms, f, flags, file, list_id, local_file_id);
312  if (buffer == NULL)
313  continue;
314 
315  if (buffer->inspect_len >= mpm_ctx->minlen) {
316  (void)mpm_table[mpm_ctx->mpm_type].Search(mpm_ctx,
317  &det_ctx->mtcu, &det_ctx->pmq,
318  buffer->inspect, buffer->inspect_len);
319  PREFILTER_PROFILING_ADD_BYTES(det_ctx, buffer->inspect_len);
320  }
321  local_file_id++;
322  }
323  }
324 }
325 
326 static void PrefilterMpmFilenameFree(void *ptr)
327 {
328  SCFree(ptr);
329 }
330 
331 static int PrefilterMpmFilenameRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx,
332  const DetectBufferMpmRegistry *mpm_reg, int list_id)
333 {
334  PrefilterMpmFilename *pectx = SCCalloc(1, sizeof(*pectx));
335  if (pectx == NULL)
336  return -1;
337  pectx->list_id = list_id;
338  pectx->mpm_ctx = mpm_ctx;
339  pectx->transforms = &mpm_reg->transforms;
340 
341  return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxFilename,
342  mpm_reg->app_v2.alproto, mpm_reg->app_v2.tx_min_progress,
343  pectx, PrefilterMpmFilenameFree, mpm_reg->pname);
344 }
345 
346 #ifdef UNITTESTS /* UNITTESTS */
347 
348 /**
349  * \test Test parser accepting valid rules and rejecting invalid rules
350  */
351 static int DetectFilenameSignatureParseTest01(void)
352 {
353  FAIL_IF_NOT(UTHParseSignature("alert http any any -> any any (flow:to_client; file.name; content:\"abc\"; sid:1;)", true));
354  FAIL_IF_NOT(UTHParseSignature("alert http any any -> any any (flow:to_client; file.name; content:\"abc\"; nocase; sid:1;)", true));
355  FAIL_IF_NOT(UTHParseSignature("alert http any any -> any any (flow:to_client; file.name; content:\"abc\"; endswith; sid:1;)", true));
356  FAIL_IF_NOT(UTHParseSignature("alert http any any -> any any (flow:to_client; file.name; content:\"abc\"; startswith; sid:1;)", true));
357  FAIL_IF_NOT(UTHParseSignature("alert http any any -> any any (flow:to_client; file.name; content:\"abc\"; startswith; endswith; sid:1;)", true));
358  FAIL_IF_NOT(UTHParseSignature("alert http any any -> any any (flow:to_client; file.name; bsize:10; sid:1;)", true));
359 
360  FAIL_IF_NOT(UTHParseSignature("alert http any any -> any any (flow:to_client; file.name; content:\"abc\"; rawbytes; sid:1;)", false));
361  FAIL_IF_NOT(UTHParseSignature("alert tcp any any -> any any (flow:to_client; file.name; sid:1;)", false));
362  //FAIL_IF_NOT(UTHParseSignature("alert tls any any -> any any (flow:to_client; file.name; content:\"abc\"; sid:1;)", false));
363  PASS;
364 }
365 /**
366  * \brief this function registers unit tests for DetectFilename
367  */
368 void DetectFilenameRegisterTests(void)
369 {
370  UtRegisterTest("DetectFilenameSignatureParseTest01", DetectFilenameSignatureParseTest01);
371 }
372 #endif /* UNITTESTS */
DetectEngineAppInspectionEngine_
Definition: detect.h:417
SigTableElmt_::url
const char * url
Definition: detect.h:1287
UTHParseSignature
int UTHParseSignature(const char *str, bool expect)
parser a sig and see if the expected result is correct
Definition: util-unittest-helper.c:929
DetectEngineAppInspectionEngine_::mpm
bool mpm
Definition: detect.h:421
detect-content.h
FileContainer_
Definition: util-file.h:113
MpmCtx_::mpm_type
uint8_t mpm_type
Definition: util-mpm.h:91
DetectEngineThreadCtx_::buffer_offset
uint32_t buffer_offset
Definition: detect.h:1102
detect-engine.h
SIGMATCH_INFO_STICKY_BUFFER
#define SIGMATCH_INFO_STICKY_BUFFER
Definition: detect.h:1490
SigTableElmt_::desc
const char * desc
Definition: detect.h:1286
flow-util.h
SigTableElmt_::name
const char * name
Definition: detect.h:1284
InspectionBuffer::initialized
bool initialized
Definition: detect.h:368
stream-tcp.h
SigGroupHead_
Container for matching data for a signature group.
Definition: detect.h:1438
DetectEngineTransforms
Definition: detect.h:399
DetectFileHandlerTableElmt_::Callback
InspectEngineFuncPtr2 Callback
Definition: detect-parse.h:36
UtRegisterTest
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
Definition: util-unittest.c:103
DETECT_CONTENT
@ DETECT_CONTENT
Definition: detect-engine-register.h:62
Signature_::alproto
AppProto alproto
Definition: detect.h:586
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:269
SIGMATCH_QUOTES_OPTIONAL
#define SIGMATCH_QUOTES_OPTIONAL
Definition: detect.h:1478
DetectBufferSetActiveList
int DetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
Definition: detect-engine.c:1387
InspectionBuffer
Definition: detect.h:364
threads.h
Flow_
Flow data structure.
Definition: flow.h:347
DetectEngineThreadCtx_::pmq
PrefilterRuleStore pmq
Definition: detect.h:1181
SigTableElmt_::flags
uint16_t flags
Definition: detect.h:1278
PrefilterMpmFilename::transforms
const DetectEngineTransforms * transforms
Definition: detect-filename.c:282
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:826
DetectBufferTypeSupportsMultiInstance
void DetectBufferTypeSupportsMultiInstance(const char *name)
Definition: detect-engine.c:1074
DetectContentConvertToNocase
int DetectContentConvertToNocase(DetectEngineCtx *de_ctx, DetectContentData *cd)
Definition: detect-content.c:757
DetectBufferMpmRegistry_
one time registration of keywords at start up
Definition: detect.h:668
detect-file-data.h
FILE_SIG_NEED_FILENAME
#define FILE_SIG_NEED_FILENAME
Definition: detect.h:305
DetectContentData_
Definition: detect-content.h:93
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1269
DetectBufferMpmRegistry_::transforms
DetectEngineTransforms transforms
Definition: detect.h:681
detect-engine-prefilter.h
DetectEngineThreadCtx_::mtcu
MpmThreadCtx mtcu
Definition: detect.h:1179
util-unittest.h
detect-filename.h
util-unittest-helper.h
FAIL_IF_NOT
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
Definition: util-unittest.h:82
File_::name_len
uint16_t name_len
Definition: util-file.h:81
DetectEngineAppInspectionEngine_::sm_list
uint16_t sm_list
Definition: detect.h:423
DETECT_ENGINE_INSPECT_SIG_CANT_MATCH_FILES
#define DETECT_ENGINE_INSPECT_SIG_CANT_MATCH_FILES
Definition: detect-engine-state.h:44
PrefilterMpmFilename::list_id
int list_id
Definition: detect-filename.c:280
app-layer-htp.h
decode.h
util-debug.h
PASS
#define PASS
Pass the test.
Definition: util-unittest.h:105
DETECT_CONTENT_ENDS_WITH
#define DETECT_CONTENT_ENDS_WITH
Definition: detect-content.h:42
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:17
DetectContentSetup
int DetectContentSetup(DetectEngineCtx *de_ctx, Signature *s, const char *contentstr)
Function to setup a content pattern.
Definition: detect-content.c:328
DetectEngineThreadCtx_
Definition: detect.h:1074
strlcat
size_t strlcat(char *, const char *src, size_t siz)
Definition: util-strlcatu.c:45
detect-engine-file.h
SignatureInitData_::list
int list
Definition: detect.h:550
SCEnter
#define SCEnter(...)
Definition: util-debug.h:271
detect-engine-mpm.h
FileContainer_::head
File * head
Definition: util-file.h:114
detect.h
DETECT_ENGINE_INSPECT_SIG_MATCH
#define DETECT_ENGINE_INSPECT_SIG_MATCH
Definition: detect-engine-state.h:39
InspectionBuffer::inspect_offset
uint64_t inspect_offset
Definition: detect.h:366
DETECT_FILENAME
@ DETECT_FILENAME
Definition: detect-engine-register.h:208
SigTableElmt_::alternative
uint16_t alternative
Definition: detect.h:1282
app-layer-parser.h
MpmCtx_::minlen
uint16_t minlen
Definition: util-mpm.h:100
SigMatch_::ctx
SigMatchCtx * ctx
Definition: detect.h:343
util-profiling.h
DetectEngineContentModifierBufferSetup
int DetectEngineContentModifierBufferSetup(DetectEngineCtx *de_ctx, Signature *s, const char *arg, int sm_type, int sm_list, AppProto alproto)
Definition: detect-parse.c:207
Packet_
Definition: decode.h:430
DetectContentData_::flags
uint32_t flags
Definition: detect-content.h:104
SIGMATCH_HANDLE_NEGATION
#define SIGMATCH_HANDLE_NEGATION
Definition: detect.h:1486
Signature_::init_data
SignatureInitData * init_data
Definition: detect.h:653
SCReturnPtr
#define SCReturnPtr(x, type)
Definition: util-debug.h:287
File_::name
uint8_t * name
Definition: util-file.h:88
detect-engine-state.h
Data structures and function prototypes for keeping state for the detection engine.
DetectFileHandlerTableElmt_::priority
int priority
Definition: detect-parse.h:34
MpmTableElmt_::Search
uint32_t(* Search)(const struct MpmCtx_ *, struct MpmThreadCtx_ *, PrefilterRuleStore *, const uint8_t *, uint32_t)
Definition: util-mpm.h:163
PrefilterMpmFilename::mpm_ctx
const MpmCtx * mpm_ctx
Definition: detect-filename.c:281
detect-engine-content-inspection.h
DetectEngineThreadCtx_::discontinue_matching
uint16_t discontinue_matching
Definition: detect.h:1139
DETECT_SM_LIST_NOTSET
#define DETECT_SM_LIST_NOTSET
Definition: detect.h:135
DetectEngineAppInspectionEngine_::smd
SigMatchData * smd
Definition: detect.h:434
DetectEngineContentInspection
uint8_t 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)
Run the actual payload match functions.
Definition: detect-engine-content-inspection.c:106
File_
Definition: util-file.h:79
AppLayerTxData
struct AppLayerTxData AppLayerTxData
Definition: detect.h:1346
PREFILTER_PROFILING_ADD_BYTES
#define PREFILTER_PROFILING_ADD_BYTES(det_ctx, bytes)
Definition: util-profiling.h:287
DETECT_FILE_NAME
@ DETECT_FILE_NAME
Definition: detect-engine-register.h:209
DETECT_CI_FLAGS_SINGLE
#define DETECT_CI_FLAGS_SINGLE
Definition: detect-engine-content-inspection.h:47
DetectBufferTypeRegister
int DetectBufferTypeRegister(const char *name)
Definition: detect-engine.c:1060
flags
uint8_t flags
Definition: decode-gre.h:0
suricata-common.h
PrefilterMpmFilename
struct PrefilterMpmFilename PrefilterMpmFilename
DetectBufferMpmRegistry_::app_v2
struct DetectBufferMpmRegistry_::@86::@88 app_v2
Signature_::file_flags
uint8_t file_flags
Definition: detect.h:597
sigmatch_table
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
Definition: detect-parse.c:129
DetectEngineThreadCtx_::inspection_recursion_counter
int inspection_recursion_counter
Definition: detect.h:1158
File_::next
struct File_ * next
Definition: util-file.h:92
DetectFileHandlerTableElmt_::PrefilterFn
PrefilterRegisterFunc PrefilterFn
Definition: detect-parse.h:35
PrefilterMpmFilename
Definition: detect-filename.c:279
util-spm-bm.h
InspectionBufferSetupMulti
void InspectionBufferSetupMulti(InspectionBuffer *buffer, const DetectEngineTransforms *transforms, const uint8_t *data, const uint32_t data_len)
setup the buffer with our initial data
Definition: detect-engine.c:1606
PrefilterAppendTxEngine
int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, PrefilterTxFn PrefilterTxFunc, AppProto alproto, int tx_min_progress, void *pectx, void(*FreeFunc)(void *pectx), const char *name)
Definition: detect-engine-prefilter.c:270
DETECT_ENGINE_INSPECT_SIG_NO_MATCH
#define DETECT_ENGINE_INSPECT_SIG_NO_MATCH
Definition: detect-engine-state.h:38
InspectionBuffer::inspect_len
uint32_t inspect_len
Definition: detect.h:367
DetectEngineAppInspectionEngine_::v2
struct DetectEngineAppInspectionEngine_::@83 v2
InspectionBuffer::inspect
const uint8_t * inspect
Definition: detect.h:365
str
#define str(s)
Definition: suricata-common.h:286
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:261
SCFree
#define SCFree(p)
Definition: util-mem.h:61
Flow_::alstate
void * alstate
Definition: flow.h:472
DetectFileInspectGeneric
uint8_t DetectFileInspectGeneric(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f, uint8_t flags, void *alstate, void *tx, uint64_t tx_id)
Inspect the file inspecting keywords against the state.
Definition: detect-engine-file.c:182
detect-parse.h
Signature_
Signature container.
Definition: detect.h:581
SigMatch_
a single match condition for a signature
Definition: detect.h:340
DetectEngineAppInspectionEngine_::transforms
const DetectEngineTransforms * transforms
Definition: detect.h:431
mpm_table
MpmTableElmt mpm_table[MPM_TABLE_SIZE]
Definition: util-mpm.c:48
DetectEngineTransforms::cnt
int cnt
Definition: detect.h:401
InspectionBufferMultipleForListGet
InspectionBuffer * InspectionBufferMultipleForListGet(DetectEngineThreadCtx *det_ctx, const int list_id, const uint32_t local_id)
for a InspectionBufferMultipleForList get a InspectionBuffer
Definition: detect-engine.c:1546
FILE_SIG_NEED_FILE
#define FILE_SIG_NEED_FILE
Definition: detect.h:304
DETECT_FILEEXT
@ DETECT_FILEEXT
Definition: detect-engine-register.h:210
filehandler_table
DetectFileHandlerTableElmt filehandler_table[DETECT_TBLSIZE]
Definition: detect-parse.c:77
DETECT_ENGINE_CONTENT_INSPECTION_MODE_STATE
@ DETECT_ENGINE_CONTENT_INSPECTION_MODE_STATE
Definition: detect-engine-content-inspection.h:36
SIGMATCH_NOOPT
#define SIGMATCH_NOOPT
Definition: detect.h:1466
DetectGetLastSMFromLists
SigMatch * DetectGetLastSMFromLists(const Signature *s,...)
Returns the sm with the largest index (added latest) from the lists passed to us.
Definition: detect-parse.c:586
AppLayerParserGetTxFiles
AppLayerGetFileState AppLayerParserGetTxFiles(const Flow *f, void *state, void *tx, const uint8_t direction)
Definition: app-layer-parser.c:890
DetectFileHandlerTableElmt_::name
const char * name
Definition: detect-parse.h:33
DetectBufferTypeSetDescriptionByName
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
Definition: detect-engine.c:1221
SignatureInitData_::transforms
DetectEngineTransforms transforms
Definition: detect.h:553
MpmCtx_
Definition: util-mpm.h:89
flow.h
DetectFilenameRegister
void DetectFilenameRegister(void)
Registration function for keyword: filename.
Definition: detect-filename.c:79
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
SCReturnInt
#define SCReturnInt(x)
Definition: util-debug.h:275
flow-var.h
SigTableElmt_::RegisterTests
void(* RegisterTests)(void)
Definition: detect.h:1276
app-layer.h
DetectBufferMpmRegistry_::pname
char pname[32]
Definition: detect.h:670