loader

package
v3.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthStoreId = "auth_store"
)

Variables

View Source
var (
	TrustedTemplateDomains = []string{"cloud.projectdiscovery.io"}
)

Functions

func IsHTTPBasedProtocolUsed

func IsHTTPBasedProtocolUsed(store *Store) bool

IsHTTPBasedProtocolUsed returns true if http/headless protocol is being used for any templates.

Types

type Config

type Config struct {
	StoreId                  string // used to set store id (optional)
	Templates                []string
	TemplateURLs             []string
	Workflows                []string
	WorkflowURLs             []string
	ExcludeTemplates         []string
	IncludeTemplates         []string
	RemoteTemplateDomainList []string

	Tags              []string
	ExcludeTags       []string
	Protocols         templateTypes.ProtocolTypes
	ExcludeProtocols  templateTypes.ProtocolTypes
	Authors           []string
	Severities        severity.Severities
	ExcludeSeverities severity.Severities
	IncludeTags       []string
	IncludeIds        []string
	ExcludeIds        []string
	IncludeConditions []string

	Catalog         catalog.Catalog
	ExecutorOptions protocols.ExecutorOptions
}

Config contains the configuration options for the loader

func NewConfig

func NewConfig(options *types.Options, catalog catalog.Catalog, executerOpts protocols.ExecutorOptions) *Config

NewConfig returns a new loader config

type ContentType

type ContentType string
const (
	Template ContentType = "Template"
	Workflow ContentType = "Workflow"
)

type RemoteContent

type RemoteContent struct {
	Content []string
	Type    ContentType
	Error   error
}

type Store

type Store struct {

	// NotFoundCallback is called for each not found template
	// This overrides error handling for not found templates
	NotFoundCallback func(template string) bool
	// contains filtered or unexported fields
}

Store is a storage for loaded nuclei templates

func New

func New(cfg *Config) (*Store, error)

New creates a new template store based on provided configuration

func (*Store) ID

func (store *Store) ID() string

func (*Store) Load

func (store *Store) Load()

Load loads all the templates from a store, performs filtering and returns the complete compiled templates for a nuclei execution configuration.

func (*Store) LoadTemplates

func (store *Store) LoadTemplates(templatesList []string) []*templates.Template

LoadTemplates takes a list of templates and returns paths for them

func (*Store) LoadTemplatesOnlyMetadata

func (store *Store) LoadTemplatesOnlyMetadata() error

LoadTemplatesOnlyMetadata loads only the metadata of the templates

func (*Store) LoadTemplatesWithTags

func (store *Store) LoadTemplatesWithTags(templatesList, tags []string) []*templates.Template

LoadTemplatesWithTags takes a list of templates and extra tags returning templates that match.

func (*Store) LoadWorkflows

func (store *Store) LoadWorkflows(workflowsList []string) []*templates.Template

LoadWorkflows takes a list of workflows and returns paths for them

func (*Store) ReadTemplateFromURI

func (store *Store) ReadTemplateFromURI(uri string, remote bool) ([]byte, error)

ReadTemplateFromURI should only be used for viewing templates and should not be used anywhere else like loading and executing templates there is no sandbox restriction here

func (*Store) RegisterPreprocessor

func (store *Store) RegisterPreprocessor(preprocessor templates.Preprocessor)

RegisterPreprocessor allows a custom preprocessor to be passed to the store to run against templates

func (*Store) Templates

func (store *Store) Templates() []*templates.Template

Templates returns all the templates in the store

func (*Store) ValidateTemplates

func (store *Store) ValidateTemplates() error

ValidateTemplates takes a list of templates and validates them erroring out on discovering any faulty templates.

func (*Store) Workflows

func (store *Store) Workflows() []*templates.Template

Workflows returns all the workflows in the store

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL