mirror of https://github.com/daffainfo/nuclei.git
using helpers
parent
bbee2ee8db
commit
aed709bd06
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
"github.com/projectdiscovery/hmap/store/hybrid"
|
"github.com/projectdiscovery/hmap/store/hybrid"
|
||||||
templateTypes "github.com/projectdiscovery/nuclei/v2/pkg/templates/types"
|
templateTypes "github.com/projectdiscovery/nuclei/v2/pkg/templates/types"
|
||||||
|
stringsutil "github.com/projectdiscovery/utils/strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Helper is a structure for helping with input transformation
|
// Helper is a structure for helping with input transformation
|
||||||
|
@ -103,7 +104,7 @@ func (h *Helper) convertInputToType(input string, inputType inputType, defaultPo
|
||||||
}
|
}
|
||||||
return input
|
return input
|
||||||
case typeURL:
|
case typeURL:
|
||||||
if uri != nil && (uri.Scheme == "http" || uri.Scheme == "https") {
|
if uri != nil && stringsutil.EqualFoldAny(uri.Scheme, "http", "https") {
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
if h.InputsHTTP != nil {
|
if h.InputsHTTP != nil {
|
||||||
|
@ -121,14 +122,11 @@ func (h *Helper) convertInputToType(input string, inputType inputType, defaultPo
|
||||||
if hasDefaultPort {
|
if hasDefaultPort {
|
||||||
return net.JoinHostPort(input, defaultPort)
|
return net.JoinHostPort(input, defaultPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
if inputType == typeHostWithOptionalPort {
|
if inputType == typeHostWithOptionalPort {
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
|
||||||
return ""
|
|
||||||
case typeWebsocket:
|
case typeWebsocket:
|
||||||
if uri != nil && (uri.Scheme == "ws" || uri.Scheme == "wss") {
|
if uri != nil && stringsutil.EqualFoldAny(uri.Scheme, "ws", "wss") {
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue