mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 21:45:26 +00:00
Merge branch 'dev' into use_containsall
This commit is contained in:
commit
8f22eb596e
@ -42,7 +42,11 @@ Description: getNetworkPort registers defaultPort and returns defaultPort if it
|
|||||||
|
|
||||||
Name: isPortOpen
|
Name: isPortOpen
|
||||||
Signatures: "isPortOpen(host string, port string, [timeout int]) bool"
|
Signatures: "isPortOpen(host string, port string, [timeout int]) bool"
|
||||||
Description: isPortOpen checks if given port is open on host. timeout is optional and defaults to 5 seconds
|
Description: isPortOpen checks if given TCP port is open on host. timeout is optional and defaults to 5 seconds
|
||||||
|
|
||||||
|
Name: isUDPPortOpen
|
||||||
|
Signatures: "isUDPPortOpen(host string, port string, [timeout int]) bool"
|
||||||
|
Description: isUDPPortOpen checks if the given UDP port is open on the host. Timeout is optional and defaults to 5 seconds.
|
||||||
|
|
||||||
Name: ToBytes
|
Name: ToBytes
|
||||||
Signatures: "ToBytes(...interface{}) []byte"
|
Signatures: "ToBytes(...interface{}) []byte"
|
||||||
|
|||||||
@ -109,7 +109,7 @@ func initBuiltInFunc(runtime *goja.Runtime) {
|
|||||||
Signatures: []string{
|
Signatures: []string{
|
||||||
"isPortOpen(host string, port string, [timeout int]) bool",
|
"isPortOpen(host string, port string, [timeout int]) bool",
|
||||||
},
|
},
|
||||||
Description: "isPortOpen checks if given port is open on host. timeout is optional and defaults to 5 seconds",
|
Description: "isPortOpen checks if given TCP port is open on host. timeout is optional and defaults to 5 seconds",
|
||||||
FuncDecl: func(host string, port string, timeout ...int) (bool, error) {
|
FuncDecl: func(host string, port string, timeout ...int) (bool, error) {
|
||||||
timeoutInSec := 5
|
timeoutInSec := 5
|
||||||
if len(timeout) > 0 {
|
if len(timeout) > 0 {
|
||||||
@ -124,6 +124,27 @@ func initBuiltInFunc(runtime *goja.Runtime) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
_ = gojs.RegisterFuncWithSignature(runtime, gojs.FuncOpts{
|
||||||
|
Name: "isUDPPortOpen",
|
||||||
|
Signatures: []string{
|
||||||
|
"isUDPPortOpen(host string, port string, [timeout int]) bool",
|
||||||
|
},
|
||||||
|
Description: "isUDPPortOpen checks if the given UDP port is open on the host. Timeout is optional and defaults to 5 seconds.",
|
||||||
|
FuncDecl: func(host string, port string, timeout ...int) (bool, error) {
|
||||||
|
timeoutInSec := 5
|
||||||
|
if len(timeout) > 0 {
|
||||||
|
timeoutInSec = timeout[0]
|
||||||
|
}
|
||||||
|
conn, err := net.DialTimeout("udp", net.JoinHostPort(host, port), time.Duration(timeoutInSec)*time.Second)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
_ = conn.Close()
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
_ = gojs.RegisterFuncWithSignature(runtime, gojs.FuncOpts{
|
_ = gojs.RegisterFuncWithSignature(runtime, gojs.FuncOpts{
|
||||||
Name: "ToBytes",
|
Name: "ToBytes",
|
||||||
Signatures: []string{
|
Signatures: []string{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user