2024-01-18 04:39:15 +05:30
|
|
|
package compiler
|
|
|
|
|
|
|
|
|
|
import "github.com/projectdiscovery/nuclei/v3/pkg/types"
|
|
|
|
|
|
|
|
|
|
// jsprotocolInit
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
// Per Execution Javascript timeout in seconds
|
2024-02-02 02:22:04 +05:30
|
|
|
JsProtocolTimeout = 10
|
|
|
|
|
PoolingJsVmConcurrency = 100
|
|
|
|
|
NonPoolingVMConcurrency = 20
|
2024-01-18 04:39:15 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Init initializes the javascript protocol
|
|
|
|
|
func Init(opts *types.Options) error {
|
|
|
|
|
if opts.Timeout < 10 {
|
|
|
|
|
// keep existing 10s timeout
|
|
|
|
|
return nil
|
|
|
|
|
}
|
2024-01-31 01:59:49 +05:30
|
|
|
if opts.JsConcurrency < 100 {
|
|
|
|
|
// 100 is reasonable default
|
|
|
|
|
opts.JsConcurrency = 100
|
|
|
|
|
}
|
2024-01-18 04:39:15 +05:30
|
|
|
JsProtocolTimeout = opts.Timeout
|
2024-02-02 02:22:04 +05:30
|
|
|
PoolingJsVmConcurrency = opts.JsConcurrency
|
|
|
|
|
PoolingJsVmConcurrency -= NonPoolingVMConcurrency
|
2024-01-18 04:39:15 +05:30
|
|
|
return nil
|
|
|
|
|
}
|