13 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
Ice3man
9e531727a7
Fixed a bug with numerical regex in unresolved var detection (#2431) 2022-08-17 03:59:51 +04:00
Mzack9999
a4cdba0691
Improving literals detection in expression engine (#2148)
* Improving literals detection in expression engine

* fixing lint errors

* re-add accidentally deleted test
2022-06-13 13:55:06 +05:30
Ice3man
409d0fce31 Skip unresolved expressions using a regex 2022-02-28 22:19:51 +05:30
forgedhallpass
ae07dce014 refactor: removed redundant escape characters from the unresolvedVariablesRegex variable 2022-01-17 13:32:47 +02:00
Mzack9999
c26a1ac21c
Improving payloads support in AWS self-contained requests (#1443)
* Improving payloads support in AWS self-contained requests

* removing internal only values from output

* handling dynamic values in url
2022-01-09 18:09:50 +05:30
mzack
e59da29371 improving error/args handling 2021-12-18 20:06:51 +01:00
forgedhallpass
bebe5cbcfd refactor: Remove redundant character escapes from regexes 2021-11-25 16:24:37 +02:00
Mzack9999
7f5f791e23
Adding dns trace support in dns templates (#1236)
* Adding dns trace support in dns templates + minor refactoring
2021-11-18 19:22:11 +05:30
mzack
12b6b2ca89 Add support for CLI payload variables 2021-10-07 12:36:27 +02:00
Ice3man543
514d6f94ec Added support for urlencoded variable variation 2021-10-07 05:35:32 +05:30
Ice3man543
92857497f3 Fixed variable check regex 2021-10-07 01:48:10 +05:30
Ice3man543
ce13bf34d0 Added check for unresolved variables 2021-10-07 01:40:49 +05:30