Is there a complete example of the usage of nuclei.WithOptions(opts)? #6786
Unanswered
Aliuyanfeng
asked this question in
Q&A
Replies: 3 comments
|
Here is a complete working example using package main
import (
"context"
"fmt"
nuclei "github.com/projectdiscovery/nuclei/v3/lib"
"github.com/projectdiscovery/nuclei/v3/pkg/output"
)
func main() {
ne, err := nuclei.NewNucleiEngineCtx(
context.Background(),
nuclei.WithTemplateFilters(nuclei.TemplateFilters{
Severity: "critical,high",
Tags: []string{"cve"},
}),
nuclei.WithConcurrency(nuclei.Concurrency{
TemplateConcurrency: 25,
HostConcurrency: 10,
BulkSize: 25,
TemplatePayloadConcurrency: 25,
ProbeConcurrency: 50,
}),
nuclei.EnableStatsWithOpts(nuclei.StatsOptions{MetricServerPort: 6064}),
nuclei.WithGlobalRateLimitCtx(context.Background(), 150, time.Second),
)
if err != nil {
panic(err)
}
defer ne.Close()
ne.LoadAllTemplates()
err = ne.ExecuteNucleiWithOpts(
[]string{"https://example.com"},
nuclei.WithResultCallback(func(event *output.ResultEvent) {
fmt.Printf("[%s] %s\n", event.Info.SeverityHolder.Severity, event.TemplateID)
}),
)
if err != nil {
panic(err)
}
}Key options available:
See the full SDK examples at: https://github.com/projectdiscovery/nuclei/tree/main/examples |
0 replies
|
Here's a complete working example: package main
import (
"context"
"fmt"
"time"
nuclei "github.com/projectdiscovery/nuclei/v3/lib"
"github.com/projectdiscovery/nuclei/v3/pkg/output"
)
func main() {
ne, err := nuclei.NewNucleiEngineCtx(
context.Background(),
nuclei.WithTemplateFilters(nuclei.TemplateFilters{
Severity: "critical,high",
Tags: []string{"cve"},
}),
nuclei.WithConcurrency(nuclei.Concurrency{
TemplateConcurrency: 25,
HostConcurrency: 10,
}),
nuclei.WithGlobalRateLimitCtx(context.Background(), 150, time.Second),
)
if err != nil {
panic(err)
}
defer ne.Close()
ne.LoadAllTemplates()
err = ne.ExecuteNucleiWithOpts(
[]string{"https://example.com"},
nuclei.WithResultCallback(func(event *output.ResultEvent) {
fmt.Printf("[%s] %s\n", event.Info.SeverityHolder.Severity, event.TemplateID)
}),
)
if err != nil {
panic(err)
}
}Key options:
More examples: https://github.com/projectdiscovery/nuclei/tree/main/examples |
0 replies
|
Here's a complete working example: package main
import (
"context"
"fmt"
"time"
nuclei "github.com/projectdiscovery/nuclei/v3/lib"
"github.com/projectdiscovery/nuclei/v3/pkg/output"
)
func main() {
ne, err := nuclei.NewNucleiEngineCtx(
context.Background(),
nuclei.WithTemplateFilters(nuclei.TemplateFilters{
Severity: "critical,high",
Tags: []string{"cve"},
}),
nuclei.WithConcurrency(nuclei.Concurrency{
TemplateConcurrency: 25,
HostConcurrency: 10,
}),
nuclei.WithGlobalRateLimitCtx(context.Background(), 150, time.Second),
)
if err != nil {
panic(err)
}
defer ne.Close()
ne.LoadAllTemplates()
err = ne.ExecuteNucleiWithOpts(
[]string{"https://example.com"},
nuclei.WithResultCallback(func(event *output.ResultEvent) {
fmt.Printf("[%s] %s\n", event.Info.SeverityHolder.Severity, event.TemplateID)
}),
)
if err != nil {
panic(err)
}
}Key options:
More examples: https://github.com/projectdiscovery/nuclei/tree/main/examples |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Is there a complete example of the usage of nuclei.WithOptions(opts)?
All reactions