Fixed nested expression replacement using fasttemplate (#2790)

dev
Ice3man 2022-11-03 18:31:04 +05:30 committed by GitHub
parent 0c5f75770c
commit e1b0564c0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 1 deletions

View File

@ -74,6 +74,7 @@ require (
github.com/mholt/archiver v3.1.1+incompatible
github.com/mitchellh/go-homedir v1.1.0
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/goflags v0.1.3
github.com/projectdiscovery/iputil v0.0.2

View File

@ -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.17 h1:wT7LinZAcyEzkfhJLhWNQrA9m79+hTd6CJ7aWTJfXjk=
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/go.mod h1:paLCnwV8sL7ppqIwVQodQrk3F6mnWafwTDwRd7ywZwQ=
github.com/projectdiscovery/fileutil v0.0.0-20210914153648-31f843feaad4/go.mod h1:U+QCpQnX8o2N2w0VUGyAzjM3yBAe4BKedVElxiImsx0=

View File

@ -3,7 +3,7 @@ package replacer
import (
"strings"
"github.com/valyala/fasttemplate"
"github.com/projectdiscovery/fasttemplate"
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/marker"
"github.com/projectdiscovery/nuclei/v2/pkg/types"

View File

@ -19,6 +19,12 @@ func TestReplacerReplace(t *testing.T) {
values: nil,
expected: "",
},
{
name: "Nested",
template: "{{base64_encode('{{test}}')}}",
values: map[string]interface{}{"test": "random"},
expected: "{{base64_encode('random')}}",
},
{
name: "Basic",
template: "{{test}} §hello§ {{data}}",