Documentation
¶
Overview ¶
Package nuclei implements a scan module for running Nuclei vulnerability templates.
Index ¶
Constants ¶
const Label = "Nuclei"
Variables ¶
This section is empty.
Functions ¶
func CheckSetup ¶
CheckSetup checks whether Setup() executed accordingly. Scan arguments should be checked by the scanner.
func GetPortTemplates ¶
func GetPortTemplates( logger utils.Logger, pathTemplates string, port int, includeIds []string, excludeIds []string, ) ([]string, error)
GetPortTemplates returns the IDs of templates relevant for a given port. Inclusion logic:
- If includeIds is empty: Include templates that match the provided port OR have a dynamic port AND whose ID is not in excludeIds
- If includeIds is not empty: Include templates whose ID is in includeIds AND have a port matching the provided port OR a dynamic port
func Setup ¶
Setup configures the environment accordingly, if the scan module has some special requirements. A successful setup is required before a scan can be started. It resolves the latest nuclei-templates release tag from the GitHub API at runtime, wipes any existing templates directory, and downloads a fresh copy into the given templatesDir before applying preprocessing rules (admin-on-demand, always-current model).
Types ¶
type Result ¶
type Result struct {
Data *ResultData
Status string // Final scan status (success or graceful error). Should be stored along with the scan results.
Exception bool // Indicates if something went wrong badly and results shall be discarded. This should never be
}
Result describes the final state of a single scan run.
type ResultData ¶
type ResultData struct {
Findings []*nulcleioutput.ResultEvent
}
ResultData holds Nuclei result events produced during a scan.
type Scanner ¶
type Scanner struct {
Label string
Started time.Time
Finished time.Time
// contains filtered or unexported fields
}
Scanner holds configuration and runtime state for a single Nuclei scan.
func NewScanner ¶
func NewScanner( logger utils.Logger, target string, port *int, pathTemplates string, includeSeverities string, excludeSeverities string, includeTags []string, excludeTags []string, includeIds []string, excludeIds []string, includeProtocols string, excludeProtocols string, username string, password string, proxy string, ) (*Scanner, error)
NewScanner constructs a Scanner instance
func (*Scanner) Run ¶
Run starts scan execution. This must either be executed as a goroutine, or another thread must be active listening on the scan's result channel, in order to avoid a deadlock situation.
func (*Scanner) SetContext ¶
SetContext can be used to pass an existing context from outside. If timeout is supplied later when calling Run() the external context and the deadline context will be combined. Once set, the context cannot be changed anymore, because it might have been wrapped internally already.