19 Commits

Author SHA1 Message Date
Ice3man
8f313629b8
Memory usage optimizations (#2350)
* Replaced strings.Replaced with fasttemplate reducing allocations

Custom template parsing logic was replaced with fasttemplate package for reducing
allocations in the replacer.Replace hotpath leading to allocation reduction which
accounted for 30% of total nuclei allocations.

$ go test -bench=. -benchmem
goos: darwin
goarch: arm64
pkg: github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/replacer
BenchmarkReplacer-8               837232              1422 ns/op            2112 B/op         31 allocs/op
BenchmarkReplacerNew-8           3672765               320.3 ns/op            48 B/op          4 allocs/op

* Fixed tests failing

* Use pre-compiled map of DSL expressions

* Reworked expression parsing logic to reduce memory allocations

$ go test -bench=. -benchmem
goos: darwin
goarch: arm64
pkg: github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/expressions
BenchmarkEvaluate-8        31560             37769 ns/op           31731 B/op        265 allocs/op
BenchmarkEvaluateNew-8       109144              9621 ns/op            6253 B/op        116 allocs/op
2022-08-23 13:16:41 +05:30
Mzack9999
3838d06aeb
Adding prototype for unexpected fields validation in matchers (#2171)
* Adding unexpected fields validation

* using expected fields

* adding missing expected field

* using reflect
2022-06-30 16:50:54 +05:30
forgedhallpass
2d5784d992 Merge branch 'dev' into dsl_signatures 2021-12-07 18:22:10 +02:00
forgedhallpass
79aed22d46 feat: Improve DSL function UX #1295
Added support for letting people know if:
* the DSL expression does not return a boolean value
* an invalid custom function signature was provided and then display all available function signatures
* an invalid function was provided and then display the correct signature

Unified the DSL function names to use snake case. The old signatures are also kept for backward compatibility.
2021-12-07 17:34:36 +02:00
forgedhallpass
c61ec5f673 feat: Improve DSL function UX #1295 2021-11-26 17:14:25 +02:00
forgedhallpass
c8d009654c fix: Receiver mismatch warnings 2021-11-25 16:57:43 +02:00
LuitelSamikshya
4b8ec29d8d
struct to enums changes for Matchers (#1246)
* struct to enums changes for Matchers
2021-11-19 16:24:09 +05:30
Ice3man
eaa0d37065
feat #1092: Validate binary values + precompile them as well (#1213)
* Added validation for binary values + precompile them

* Changed name of the binary matcher field

Co-authored-by: sandeep <sandeep@projectdiscovery.io>
2021-11-17 02:04:27 +05:30
Ice3man
50a816fce9
Fixed a crash with uninitialized interactsh client (#1251)
* Fixed a crash with uninitialized interactsh client
2021-11-16 20:02:39 +05:30
Ice3man543
90a0502b60 Misc fixes to default part 2021-11-11 17:30:25 +05:30
Alexey Zhuchkov
3a47413cd4 Add case-insensitive flag to matchers and extractors 2021-10-29 19:08:23 +03:00
forgedhallpass
0ce33927c7 Typo fixes. 2021-09-07 17:31:46 +03:00
Ice3man543
8512b684c5 Lint errors fix 2021-02-26 13:13:11 +05:30
Ice3man543
8a7cabb88d Added hex encoding support in matchers 2021-02-24 11:23:22 +05:30
Ice3man543
5153647e0f Misc work on extractors + compat 2020-12-24 12:13:18 +05:30
Ice3man543
8a64578890 Work on operators package and generic protocol agnostic matching capabilities 2020-12-24 01:41:32 +05:30
Ice3man543
2317e1ba1b Data modelling, work on executor started 2020-12-23 16:16:16 +05:30
Ice3man543
ed84bb187b Added per protocol responseToDSL function + misc cleanup with operators 2020-12-21 15:51:43 +05:30
Ice3man543
d631074e35 Separating matchers, extractors and requests as protocols and operators 2020-12-21 14:31:32 +05:30