Hi! Has anyone encountered the problem that when scanning via SDK, some of the results are missing? How could this be solved?
Thank you very much in advance!
CLI run:
nuclei -u bountytarget.com --headless
These templates produce results only when run through cli
https://github.com/projectdiscovery/nuclei-templates/blob/main/headless/extract-urls.yaml
https://github.com/projectdiscovery/nuclei-templates/blob/main/headless/webpack-sourcemap.yaml
Go Code
func nucl(ctx context.Context) {
ne, err := nuclei.NewNucleiEngineCtx(
ctx,
nuclei.WithNetworkConfig(nuclei.NetworkConfig{
DisableMaxHostErr: true,
MaxHostError: 10000,
}),
nuclei.EnableHeadlessWithOpts(&nuclei.HeadlessOpts{
PageTimeout: 20,
UseChrome: true,
ShowBrowser: false,
}),
nuclei.WithConcurrency(nuclei.Concurrency{
TemplateConcurrency: 1,
HostConcurrency: 1,
HeadlessHostConcurrency: 1,
HeadlessTemplateConcurrency: 1,
JavascriptTemplateConcurrency: 1,
TemplatePayloadConcurrency: 1,
ProbeConcurrency: 1,
}),
nuclei.EnableStatsWithOpts(nuclei.StatsOptions{JSON: true}),
nuclei.WithScanStrategy("auto"),
)
if err != nil {
slog.Error("Failed to create nuclei engine", slog.Any("error", err))
panic(err)
}
defer ne.Close()
err = ne.LoadAllTemplates()
if err != nil {
slog.Error("Failed to load templates", slog.Any("error", err))
panic(err)
}
ne.LoadTargets([]string{"BOUNTY_TARGET.ZONE"}, false)
opts := ne.Options()
ne.ExecuteWithCallback(callback)
slog.Info("Nuclei scan finished")
}