Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/lib/helper.go
2061 views
1
package nuclei
2
3
import (
4
"context"
5
6
"github.com/projectdiscovery/nuclei/v3/pkg/catalog/config"
7
uncoverNuclei "github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/uncover"
8
"github.com/projectdiscovery/nuclei/v3/pkg/templates"
9
"github.com/projectdiscovery/uncover"
10
)
11
12
// helper.go file proxy execution of all nuclei functions that are nested deep inside multiple packages
13
// but are helpful / useful while using nuclei as a library
14
15
// GetTargetsFromUncover returns targets from uncover in given format .
16
// supported formats are any string with [ip,host,port,url] placeholders
17
func GetTargetsFromUncover(ctx context.Context, outputFormat string, opts *uncover.Options) (chan string, error) {
18
return uncoverNuclei.GetTargetsFromUncover(ctx, outputFormat, opts)
19
}
20
21
// GetTargetsFromTemplateMetadata returns all targets by querying engine metadata (ex: fofo-query,shodan-query) etc from given templates .
22
// supported formats are any string with [ip,host,port,url] placeholders
23
func GetTargetsFromTemplateMetadata(ctx context.Context, templates []*templates.Template, outputFormat string, opts *uncover.Options) chan string {
24
return uncoverNuclei.GetUncoverTargetsFromMetadata(ctx, templates, outputFormat, opts)
25
}
26
27
// DefaultConfig is instance of default nuclei configs
28
// any mutations to this config will be reflected in all nuclei instances (saves some config to disk)
29
var DefaultConfig *config.Config
30
31
func init() {
32
DefaultConfig = config.DefaultConfig
33
}
34
35