mirror of https://github.com/daffainfo/nuclei.git
Fixed nested expression replacement using fasttemplate (#2790)
parent
0c5f75770c
commit
e1b0564c0a
|
@ -74,6 +74,7 @@ require (
|
||||||
github.com/mholt/archiver v3.1.1+incompatible
|
github.com/mholt/archiver v3.1.1+incompatible
|
||||||
github.com/mitchellh/go-homedir v1.1.0
|
github.com/mitchellh/go-homedir v1.1.0
|
||||||
github.com/openrdap/rdap v0.9.1-0.20191017185644-af93e7ef17b7
|
github.com/openrdap/rdap v0.9.1-0.20191017185644-af93e7ef17b7
|
||||||
|
github.com/projectdiscovery/fasttemplate v0.0.2
|
||||||
github.com/projectdiscovery/fileutil v0.0.3
|
github.com/projectdiscovery/fileutil v0.0.3
|
||||||
github.com/projectdiscovery/goflags v0.1.3
|
github.com/projectdiscovery/goflags v0.1.3
|
||||||
github.com/projectdiscovery/iputil v0.0.2
|
github.com/projectdiscovery/iputil v0.0.2
|
||||||
|
|
|
@ -563,6 +563,8 @@ github.com/projectdiscovery/fastdialer v0.0.12/go.mod h1:RkRbxqDCcCFhfNUbkzBIz/i
|
||||||
github.com/projectdiscovery/fastdialer v0.0.15/go.mod h1:Q28lw9oTpiZHq09uFG6YYYLUsUjsOypZ7PXWwQGBB80=
|
github.com/projectdiscovery/fastdialer v0.0.15/go.mod h1:Q28lw9oTpiZHq09uFG6YYYLUsUjsOypZ7PXWwQGBB80=
|
||||||
github.com/projectdiscovery/fastdialer v0.0.17 h1:wT7LinZAcyEzkfhJLhWNQrA9m79+hTd6CJ7aWTJfXjk=
|
github.com/projectdiscovery/fastdialer v0.0.17 h1:wT7LinZAcyEzkfhJLhWNQrA9m79+hTd6CJ7aWTJfXjk=
|
||||||
github.com/projectdiscovery/fastdialer v0.0.17/go.mod h1:poZbCGYGRfRcKxU8/1rWH8EVOJ4AZn1a8+CyINHzffQ=
|
github.com/projectdiscovery/fastdialer v0.0.17/go.mod h1:poZbCGYGRfRcKxU8/1rWH8EVOJ4AZn1a8+CyINHzffQ=
|
||||||
|
github.com/projectdiscovery/fasttemplate v0.0.2 h1:h2cISk5xDhlJEinlBQS6RRx0vOlOirB2y3Yu4PJzpiA=
|
||||||
|
github.com/projectdiscovery/fasttemplate v0.0.2/go.mod h1:XYWWVMxnItd+r0GbjA1GCsUopMw1/XusuQxdyAIHMCw=
|
||||||
github.com/projectdiscovery/filekv v0.0.0-20210915124239-3467ef45dd08 h1:NwD1R/du1dqrRKN3SJl9kT6tN3K9puuWFXEvYF2ihew=
|
github.com/projectdiscovery/filekv v0.0.0-20210915124239-3467ef45dd08 h1:NwD1R/du1dqrRKN3SJl9kT6tN3K9puuWFXEvYF2ihew=
|
||||||
github.com/projectdiscovery/filekv v0.0.0-20210915124239-3467ef45dd08/go.mod h1:paLCnwV8sL7ppqIwVQodQrk3F6mnWafwTDwRd7ywZwQ=
|
github.com/projectdiscovery/filekv v0.0.0-20210915124239-3467ef45dd08/go.mod h1:paLCnwV8sL7ppqIwVQodQrk3F6mnWafwTDwRd7ywZwQ=
|
||||||
github.com/projectdiscovery/fileutil v0.0.0-20210914153648-31f843feaad4/go.mod h1:U+QCpQnX8o2N2w0VUGyAzjM3yBAe4BKedVElxiImsx0=
|
github.com/projectdiscovery/fileutil v0.0.0-20210914153648-31f843feaad4/go.mod h1:U+QCpQnX8o2N2w0VUGyAzjM3yBAe4BKedVElxiImsx0=
|
||||||
|
|
|
@ -3,7 +3,7 @@ package replacer
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/valyala/fasttemplate"
|
"github.com/projectdiscovery/fasttemplate"
|
||||||
|
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/marker"
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/marker"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/types"
|
"github.com/projectdiscovery/nuclei/v2/pkg/types"
|
||||||
|
|
|
@ -19,6 +19,12 @@ func TestReplacerReplace(t *testing.T) {
|
||||||
values: nil,
|
values: nil,
|
||||||
expected: "",
|
expected: "",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Nested",
|
||||||
|
template: "{{base64_encode('{{test}}')}}",
|
||||||
|
values: map[string]interface{}{"test": "random"},
|
||||||
|
expected: "{{base64_encode('random')}}",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Basic",
|
name: "Basic",
|
||||||
template: "{{test}} §hello§ {{data}}",
|
template: "{{test}} §hello§ {{data}}",
|
||||||
|
|
Loading…
Reference in New Issue