10 Commits

Author SHA1 Message Date
DoI
f520d7e843
XPath matcher support (#4087)
* Added xpath response matching support

* Add validation for user-supplied XPath

* xpath matcher comment fix

* Added XPath matched documentation

* minor changes: remove warnings

---------

Co-authored-by: Tarun Koyalwar <tarun@projectdiscovery.io>
2023-08-25 22:41:51 +05:30
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
Sajad Parra
5b99921d75 add unit and integration tests for dsl variable #555 2021-11-30 20:20:43 +05:30
LuitelSamikshya
4b8ec29d8d
struct to enums changes for Matchers (#1246)
* struct to enums changes for Matchers
2021-11-19 16:24:09 +05:30
forgedhallpass
dccd47ed19 [feature] Add coloring to debug information #999 [WIP]
Return the matched content in case of multiple regex/binary matchers (+test)
2021-09-30 20:36:39 +03:00
forgedhallpass
4be6b3cc96 [feature] Add coloring to debug information #999 [WIP]
TODO:
* if there are multiple matchers, make sure the response is only displayed once, with all the matching values colored
* remove code duplication from the request.go files
2021-09-29 19:43:46 +03:00
Sajad Parra
f1ad6f6bc5 add payload, variable, helper support to matchers 2021-09-15 18:02:22 +05:30
Ice3man543
8a7cabb88d Added hex encoding support in matchers 2021-02-24 11:23:22 +05:30
Ice3man543
60789f4ba2 More refactoring of nuclei packages 2020-12-24 20:47:41 +05:30
Ice3man543
d631074e35 Separating matchers, extractors and requests as protocols and operators 2020-12-21 14:31:32 +05:30