mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 20:45:25 +00:00
CLI variables are not accessible in SSL Protocol (#3069)
* added vars payload also in ssl * fix on ssl.go, moved function on payloadValues creation * added integration test * rebase + minor changes Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
This commit is contained in:
parent
aaae68ee50
commit
bbb561b097
14
integration_tests/ssl/ssl-with-vars.yaml
Normal file
14
integration_tests/ssl/ssl-with-vars.yaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
id: ssl-with-vars
|
||||||
|
|
||||||
|
info:
|
||||||
|
name: SSL with variables
|
||||||
|
author: pdteam
|
||||||
|
severity: info
|
||||||
|
tags: ssl
|
||||||
|
|
||||||
|
ssl:
|
||||||
|
- address: "{{Host}}:{{Port}}"
|
||||||
|
matchers:
|
||||||
|
- type: dsl
|
||||||
|
dsl:
|
||||||
|
- "print_debug(test)"
|
||||||
@ -12,6 +12,7 @@ var sslTestcases = map[string]testutils.TestCase{
|
|||||||
"ssl/basic-ztls.yaml": &sslBasicZtls{},
|
"ssl/basic-ztls.yaml": &sslBasicZtls{},
|
||||||
"ssl/custom-cipher.yaml": &sslCustomCipher{},
|
"ssl/custom-cipher.yaml": &sslCustomCipher{},
|
||||||
"ssl/custom-version.yaml": &sslCustomVersion{},
|
"ssl/custom-version.yaml": &sslCustomVersion{},
|
||||||
|
"ssl/ssl-with-vars.yaml": &sslWithVars{},
|
||||||
}
|
}
|
||||||
|
|
||||||
type sslBasic struct{}
|
type sslBasic struct{}
|
||||||
@ -97,3 +98,23 @@ func (h *sslCustomVersion) Execute(filePath string) error {
|
|||||||
|
|
||||||
return expectResultsCount(results, 1)
|
return expectResultsCount(results, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type sslWithVars struct{}
|
||||||
|
|
||||||
|
func (h *sslWithVars) Execute(filePath string) error {
|
||||||
|
ts := testutils.NewTCPServer(&tls.Config{}, defaultStaticPort, func(conn net.Conn) {
|
||||||
|
defer conn.Close()
|
||||||
|
data := make([]byte, 4)
|
||||||
|
if _, err := conn.Read(data); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
defer ts.Close()
|
||||||
|
|
||||||
|
results, err := testutils.RunNucleiTemplateAndGetResults(filePath, ts.URL, debug, "-V", "test=asdasdas")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return expectResultsCount(results, 1)
|
||||||
|
}
|
||||||
|
|||||||
@ -145,10 +145,11 @@ func (request *Request) ExecuteWithResults(input *contextargs.Context, dynamicVa
|
|||||||
hostname, port, _ := net.SplitHostPort(hostPort)
|
hostname, port, _ := net.SplitHostPort(hostPort)
|
||||||
|
|
||||||
requestOptions := request.options
|
requestOptions := request.options
|
||||||
payloadValues := make(map[string]interface{})
|
payloadValues := generators.BuildPayloadFromOptions(request.options.Options)
|
||||||
for k, v := range dynamicValues {
|
for k, v := range dynamicValues {
|
||||||
payloadValues[k] = v
|
payloadValues[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
payloadValues["Hostname"] = hostPort
|
payloadValues["Hostname"] = hostPort
|
||||||
payloadValues["Host"] = hostname
|
payloadValues["Host"] = hostname
|
||||||
payloadValues["Port"] = port
|
payloadValues["Port"] = port
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user