nuclei/lib/helper.go
Tarun Koyalwar dc44105baf
nuclei v3 : misc updates (#4247)
* use parsed options while signing

* update project layout to v3

* fix .gitignore

* remove example template

* misc updates

* bump tlsx version

* hide template sig warning with env

* js: retain value while using log

* fix nil pointer derefernce

* misc doc update

---------

Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
2023-10-17 17:44:13 +05:30

34 lines
1.4 KiB
Go

package nuclei
import (
"context"
"github.com/projectdiscovery/nuclei/v3/pkg/catalog/config"
uncoverNuclei "github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/uncover"
"github.com/projectdiscovery/nuclei/v3/pkg/templates"
"github.com/projectdiscovery/uncover"
)
// helper.go file proxy execution of all nuclei functions that are nested deep inside multiple packages
// but are helpful / useful while using nuclei as a library
// GetTargetsFromUncover returns targets from uncover in given format .
// supported formats are any string with [ip,host,port,url] placeholders
func GetTargetsFromUncover(ctx context.Context, outputFormat string, opts *uncover.Options) (chan string, error) {
return uncoverNuclei.GetTargetsFromUncover(ctx, outputFormat, opts)
}
// GetTargetsFromTemplateMetadata returns all targets by querying engine metadata (ex: fofo-query,shodan-query) etc from given templates .
// supported formats are any string with [ip,host,port,url] placeholders
func GetTargetsFromTemplateMetadata(ctx context.Context, templates []*templates.Template, outputFormat string, opts *uncover.Options) chan string {
return uncoverNuclei.GetUncoverTargetsFromMetadata(ctx, templates, outputFormat, opts)
}
// DefaultConfig is instance of default nuclei configs
// any mutations to this config will be reflected in all nuclei instances (saves some config to disk)
var DefaultConfig *config.Config
func init() {
DefaultConfig = config.DefaultConfig
}