-
Notifications
You must be signed in to change notification settings - Fork 3k
Labels
Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.Inconsistencies or issues which will cause an issue or problem for users or implementors.
Description
Is there an existing issue for this?
- I have searched the existing issues.
Current Behavior
When I run the nuclei engine with nuclei.WithOptions(), I get panic: dialers with executionId d46q9iu1tobo9d3pdnpg not found.
Expected Behavior
Specific option need to be override with WithOptions.
Steps To Reproduce
package main
import (
"context"
nuclei "github.com/projectdiscovery/nuclei/v3/lib"
"github.com/projectdiscovery/nuclei/v3/pkg/types"
)
func main() {
ne, _ := nuclei.NewNucleiEngineCtx(context.Background(),
nuclei.WithOptions(types.DefaultOptions()),
)
ne.LoadTargets([]string{"http://honey.scanme.sh"}, false)
_ = ne.ExecuteWithCallback(nil)
}
Relevant log output
panic: dialers with executionId d46q9iu1tobo9d3pdnpg not found
goroutine 1 [running]:
github.com/projectdiscovery/nuclei/v3/pkg/catalog/loader.(*Store).LoadTemplatesWithTags(0xc0004afc30, {0xc00122a630?, 0x0?, 0x7ff61d32ca65?}, {0x0, 0x0, 0x0})
C:/Users/smj00/source/nuclei/pkg/catalog/loader/loader.go:572 +0x6d9
github.com/projectdiscovery/nuclei/v3/pkg/catalog/loader.(*Store).LoadTemplates(...)
C:/Users/smj00/source/nuclei/pkg/catalog/loader/loader.go:499
github.com/projectdiscovery/nuclei/v3/pkg/catalog/loader.(*Store).Load(0xc0004afc30)
C:/Users/smj00/source/nuclei/pkg/catalog/loader/loader.go:295 +0x30
github.com/projectdiscovery/nuclei/v3/lib.(*NucleiEngine).LoadAllTemplates(0xc000ccd680)
C:/Users/smj00/source/nuclei/lib/sdk.go:110 +0x653
github.com/projectdiscovery/nuclei/v3/lib.(*NucleiEngine).ExecuteCallbackWithCtx(0xc000ccd680, {0x7ff6212d6d50, 0x7ff6238f7b80}, {0xc00258fdf0, 0x1, 0xc000bf30e0?})
C:/Users/smj00/source/nuclei/lib/sdk.go:247 +0x50
github.com/projectdiscovery/nuclei/v3/lib.(*NucleiEngine).ExecuteWithCallback(...)
C:/Users/smj00/source/nuclei/lib/sdk.go:294
main.main()
C:/Users/smj00/source/nuclei/examples/simple/simple.go:21 +0x2b2
exit status 2Environment
- OS: Windows
- Nuclei: v3.4.10
- Go: go1.25.3Anything else?
nuclei.WithOptions() seems override ExecutionID
It seems that nuclei.WithOptions() overwrites the ExecutionID value generated by NewNucleiEngineCtx and has an empty string value when loading the template. It works fine when I apply the patch below.
Subject: [PATCH] ExecutionId has been overridden
---
Index: lib/sdk.go
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/sdk.go b/lib/sdk.go
--- a/lib/sdk.go (revision 53af79a39290c86857f433bb2f40e4567982fed0)
+++ b/lib/sdk.go (date 1762501966934)
@@ -312,7 +312,6 @@
func NewNucleiEngineCtx(ctx context.Context, options ...NucleiSDKOptions) (*NucleiEngine, error) {
// default options
defaultOptions := types.DefaultOptions()
- defaultOptions.ExecutionId = xid.New().String()
e := &NucleiEngine{
opts: defaultOptions,
mode: singleInstance,
@@ -323,6 +322,7 @@
return nil, err
}
}
+ e.opts.ExecutionId = xid.New().String()
if err := e.init(ctx); err != nil {
return nil, err
}
Metadata
Metadata
Assignees
Labels
Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.Inconsistencies or issues which will cause an issue or problem for users or implementors.