Commit Graph

112 Commits (7f474af1d01eaf9407afc54f38a47b4a189bc92e)

Author SHA1 Message Date
Victor Julien fd75aca1a1 detect/bytetest: remove unused Match function
All matching is done as part of content inspection.
3 years ago
Philippe Antoine c272a646c5 detect: SigMatchAppendSMToList can fail
Ticket: #6104

And failures should be handled to say that the rule failed to load

Reverts the fix by 299ee6ed55
that was simple, but not complete (memory leak),
to have this bigger API change which simplifies code.
3 years ago
Daniel Olatunji 3a40ed5641 detect/bytetest: convert unittests to FAIL/PASS
Issue: #6332
3 years ago
Jeff Lucovsky 3286c3b912 detect/pcre: Use local match variables
pcre2 is not thread-safe wrt match objects so use locally scoped
objects.

Issue: 4797
3 years ago
Jeff Lucovsky da866356c0 detect/byte_test: Allow nbytes value to be a variable
Issue: 6144

This commit allows the byte_test keyword to accept an existing
variable name for a value (the value may still be specified directly as
an integer).

All nbytes values are subject to the same value constraints as before
- 23 if included with string
- 8 otherwise
3 years ago
Victor Julien 549f7873df detect: spelling 3 years ago
Victor Julien 9090739ddb detect/byte_test: use list util in tests; cleanups 3 years ago
Victor Julien 7ac623e0c5 detect/bytemath: fix newline in debug message 3 years ago
Victor Julien b31ffde6f4 output: remove error codes from output 4 years ago
Victor Julien 39f5c7f56a error: use SC_EINVAL for invalid input 4 years ago
Victor Julien e250ef6402 debug: remove empty header 4 years ago
Philippe Antoine 02f2602dde src: rework includes as per cppclean 4 years ago
Modupe Falodun 786cf41599 detect-bytetest: remove unittests
These tests are reimplemented as Suricata-Verify

Task: 4911
5 years ago
Philippe Antoine 3de99a214c pcre2: migrate keywords parsing 5 years ago
Victor Julien 6ab323d323 detect: hide RegisterTests behind ifdef UNITTESTS
Update all callers to more aggressively use UNITTESTS guards as well.
6 years ago
Shivani Bhardwaj c169cfe0a3 bytetest: use ByteExtractString instead of StringParse 6 years ago
Jeff Lucovsky fb409664d2 detect: byte_math support 6 years ago
Victor Julien 26bcc97515 detect/keywords: dynamic version part of doc URL 6 years ago
Jeff Lucovsky d3a65fe156 detect: Provide `de_ctx` to free functions
This commit makes sure that the `DetectEngineCtx *` is available
to each detector's "free" function.
6 years ago
Shivani Bhardwaj 0e4f261224 Use StringParse* for all parsers and configurations 6 years ago
Jeff Lucovsky e0bd79670c detect: byte-test convert neg_op flag to a bool
Only 8 flags are permitted so convert one of them to a struct member. I
choose neg_op
6 years ago
Jeff Lucovsky 313c23a26b detect: Add unittests to exercise bitmask 6 years ago
Jeff Lucovsky d12950c9e4 detect: fixup incorrect comments, indentation 6 years ago
Jeff Lucovsky 31ed9786f6 detect: byte_test impl for bitmask
This commit implements byte_test's bitmask feature.
6 years ago
Jeff Lucovsky 7f6af10fed general: copyright bump 6 years ago
Jeff Lucovsky 4b0085b03c detect: Update to take advantage of PCRE refactor
This commit changes the keyword detectors to use the refactored PCRE
modifications from detect-parse.[ch]
6 years ago
Shivani Bhardwaj d801c3e588 detect: Make keyword description consistent
Closes redmine ticket #3137.
7 years ago
Shivani Bhardwaj b5b429c288 detect: Add missing keyword URLs and description
Add missing keyword URLs and their description. Fix the ones that
were incorrect.

Partially closes redmine ticket #2974.
7 years ago
Victor Julien 579cc9f02b const: constify decoder, app-layer, detect funcs 7 years ago
Shivani Bhardwaj 85b56b633e detect: Improve rule keyword alproto registration
1. Set WARN_UNUSED macro on DetectSignatureSetAppProto.
2. Replace all direct 'sets' of Signature::alproto from keyword registration.

Closes redmine ticket #3006.
7 years ago
Victor Julien 14896365ef detect: remove Threadvars argument from API calls
Remove it as it's (almost) never used. If it is really needed it can
be accessed through DetectEngineThreadCtx::tv as well.
7 years ago
Victor Julien 9a14cb252d detect/bytetest: debug cleanup 8 years ago
Victor Julien 94191ea960 detect/bytetest: don't print errors at runtime 8 years ago
Victor Julien 5283796018 bytetest: don't leak memory in error condition 8 years ago
Victor Julien 313661451d content inspection: support transforms
Make sure content is applied to the transformed version of a buffer.

Support content with its modifiers, and also isdataat, pcre, bytetest
and bytejump.
9 years ago
Victor Julien ab1200fbd7 compiler: more strict compiler warnings
Set flags by default:

    -Wmissing-prototypes
    -Wmissing-declarations
    -Wstrict-prototypes
    -Wwrite-strings
    -Wcast-align
    -Wbad-function-cast
    -Wformat-security
    -Wno-format-nonliteral
    -Wmissing-format-attribute
    -funsigned-char

Fix minor compiler warnings for these new flags on gcc and clang.
9 years ago
Victor Julien cc4010343d detect: add and use util func for alproto sets 10 years ago
Victor Julien dfac5276b8 detect: remove unused SIGMATCH_PAYLOAD flag 10 years ago
Victor Julien fe415ae518 detect: remove DMATCH list 10 years ago
Victor Julien 6bd37611ee file_data: dynamic buffer 10 years ago
Victor Julien 779d40cedf detect: remove hardcoded sm_list logic from setup
Introduce utility functions to aid this.
10 years ago
Victor Julien f370e88135 detect: move init only Signature members to init_data 10 years ago
Victor Julien 8edc954e82 detect: get rid of Signature::sm_lists
Instead use the lists in init_data during setup and the SigMatchData
arrays during runtime.
10 years ago
Victor Julien 39613778cd detect: make setup/free/match funcs static where possible 10 years ago
Victor Julien bfd4bc8233 detect: constify Signature/SigMatch use at runtime 10 years ago
Victor Julien e67ae0f174 detect keywords: use parse regex util func 10 years ago
Jason Ish 796dd5223b tests: no longer necessary to provide successful return code
1 pass, 0 is fail.
10 years ago
Giuseppe Longo 41a1a9f4af find and replace HSBDMATCH by FILEDATA
This commit do a find and replace of the following:

- DETECT_SM_LIST_HSBDMATCH by DETECT_SM_LIST_FILEDATA
  sed -i 's/DETECT_SM_LIST_HSBDMATCH/DETECT_SM_LIST_FILEDATA/g' src/*

- HSBD by FILEDATA:
  sed -i 's/HSBDMATCH/FILEDATA/g' src/*
11 years ago
Ken Steele 923a77e952 Change Match() function to take const SigMatchCtx*
The Match functions don't need a pointer to the SigMatch object, just the
context pointer contained inside, so pass the Context to the Match function
rather than the SigMatch object. This allows for further optimization.

Change SigMatch->ctx to have type SigMatchCtx* rather than void* for better
type checking. This requires adding type casts when using or assigning it.

The SigMatch contex should not be changed by the Match() funciton, so pass it
as a const SigMatchCtx*.
12 years ago
Jason Ish a18e2ef402 Bug 1230: Check all SigMatch lists for a named byte_extract variable. 12 years ago