mirror of https://github.com/daffainfo/nuclei.git
commit
1b2c1b8732
|
@ -87,10 +87,10 @@ var functions = map[string]govaluate.ExpressionFunction{
|
|||
return base64.StdEncoding.DecodeString(types.ToString(args[0]))
|
||||
},
|
||||
"url_encode": func(args ...interface{}) (interface{}, error) {
|
||||
return url.PathEscape(types.ToString(args[0])), nil
|
||||
return url.QueryEscape(types.ToString(args[0])), nil
|
||||
},
|
||||
"url_decode": func(args ...interface{}) (interface{}, error) {
|
||||
return url.PathUnescape(types.ToString(args[0]))
|
||||
return url.QueryUnescape(types.ToString(args[0]))
|
||||
},
|
||||
"hex_encode": func(args ...interface{}) (interface{}, error) {
|
||||
return hex.EncodeToString([]byte(types.ToString(args[0]))), nil
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package dsl
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestDSLURLEncodeDecode(t *testing.T) {
|
||||
functions := HelperFunctions()
|
||||
|
||||
encoded, err := functions["url_encode"]("&test\"")
|
||||
require.Nil(t, err, "could not url encode")
|
||||
require.Equal(t, "%26test%22", encoded, "could not get url encoded data")
|
||||
|
||||
decoded, err := functions["url_decode"]("%26test%22")
|
||||
require.Nil(t, err, "could not url encode")
|
||||
require.Equal(t, "&test\"", decoded, "could not get url decoded data")
|
||||
}
|
|
@ -46,13 +46,13 @@ type Request struct {
|
|||
//
|
||||
// Usually it's enough to just leave it as INET.
|
||||
// values:
|
||||
// - "INET"
|
||||
// - "CSNET"
|
||||
// - "CHAOS"
|
||||
// - "HESIOD"
|
||||
// - "NONE"
|
||||
// - "ANY"
|
||||
Class string `yaml:"class,omitempty" jsonschema:"title=class of DNS request,description=Class is the class of the DNS request,enum=INET,enum=CSNET,enum=CHAOS,enum=HESIOD,enum=NONE,enum=ANY"`
|
||||
// - "inet"
|
||||
// - "csnet"
|
||||
// - "chaos"
|
||||
// - "hesiod"
|
||||
// - "none"
|
||||
// - "any"
|
||||
Class string `yaml:"class,omitempty" jsonschema:"title=class of DNS request,description=Class is the class of the DNS request,enum=inet,enum=csnet,enum=chaos,enum=hesiod,enum=none,enum=any"`
|
||||
// description: |
|
||||
// Retries is the number of retries for the DNS request
|
||||
// examples:
|
||||
|
|
Loading…
Reference in New Issue