Documentation ¶
Overview ¶
Package output implements output writing interfaces for nuclei.
Index ¶
- type InternalEvent
- type InternalWrappedEvent
- type IssueTrackerMetadata
- type JSONLogRequest
- type MultiWriter
- func (mw *MultiWriter) Close()
- func (mw *MultiWriter) Colorizer() aurora.Aurora
- func (mw *MultiWriter) Request(templateID, url, requestType string, err error)
- func (mw *MultiWriter) Write(event *ResultEvent) error
- func (mw *MultiWriter) WriteFailure(event *InternalWrappedEvent) error
- func (mw *MultiWriter) WriteStoreDebugData(host, templateID, eventType string, data string)
- type ResultEvent
- type StandardWriter
- func (w *StandardWriter) Close()
- func (w *StandardWriter) Colorizer() aurora.Aurora
- func (w *StandardWriter) Request(templatePath, input, requestType string, requestErr error)
- func (w *StandardWriter) Write(event *ResultEvent) error
- func (w *StandardWriter) WriteFailure(wrappedEvent *InternalWrappedEvent) error
- func (w *StandardWriter) WriteStoreDebugData(host, templateID, eventType string, data string)
- type Writer
- type WriterOptions
- func WithAurora(aurora aurora.Aurora) WriterOptions
- func WithErrorSink(errorFile io.WriteCloser) WriterOptions
- func WithJson(json bool, dumpReqResp bool) WriterOptions
- func WithMatcherStatus(matcherStatus bool) WriterOptions
- func WithNoMetadata(noMetadata bool) WriterOptions
- func WithSeverityColors(severityColors func(severity.Severity) string) WriterOptions
- func WithStoreResponse(storeResponse bool, respDir string) WriterOptions
- func WithTimestamp(timestamp bool) WriterOptions
- func WithTraceSink(traceFile io.WriteCloser) WriterOptions
- func WithWriter(outputFile io.WriteCloser) WriterOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InternalEvent ¶
type InternalEvent map[string]interface{}
InternalEvent is an internal output generation structure for nuclei.
func (InternalEvent) Set ¶
func (ie InternalEvent) Set(k string, v interface{})
type InternalWrappedEvent ¶
type InternalWrappedEvent struct { // Mutex is internal field which is implicitly used // to synchronize callback(event) and interactsh polling updates // Refer protocols/http.Request.ExecuteWithResults for more details sync.RWMutex InternalEvent InternalEvent Results []*ResultEvent OperatorsResult *operators.Result UsesInteractsh bool // Only applicable if interactsh is used // This is used to avoid duplicate successful interactsh events InteractshMatched atomic.Bool }
InternalWrappedEvent is a wrapped event with operators result added to it.
func (*InternalWrappedEvent) HasOperatorResult ¶
func (iwe *InternalWrappedEvent) HasOperatorResult() bool
func (*InternalWrappedEvent) HasResults ¶
func (iwe *InternalWrappedEvent) HasResults() bool
func (*InternalWrappedEvent) SetOperatorResult ¶
func (iwe *InternalWrappedEvent) SetOperatorResult(operatorResult *operators.Result)
type IssueTrackerMetadata ¶
type JSONLogRequest ¶
type JSONLogRequest struct { Template string `json:"template"` Input string `json:"input"` Error string `json:"error"` Type string `json:"type"` }
JSONLogRequest is a trace/error log request written to file
type MultiWriter ¶
type MultiWriter struct {
// contains filtered or unexported fields
}
func NewMultiWriter ¶
func NewMultiWriter(writers ...Writer) *MultiWriter
NewMultiWriter creates a new MultiWriter instance
func (*MultiWriter) Close ¶
func (mw *MultiWriter) Close()
func (*MultiWriter) Colorizer ¶
func (mw *MultiWriter) Colorizer() aurora.Aurora
func (*MultiWriter) Request ¶
func (mw *MultiWriter) Request(templateID, url, requestType string, err error)
func (*MultiWriter) Write ¶
func (mw *MultiWriter) Write(event *ResultEvent) error
func (*MultiWriter) WriteFailure ¶
func (mw *MultiWriter) WriteFailure(event *InternalWrappedEvent) error
func (*MultiWriter) WriteStoreDebugData ¶
func (mw *MultiWriter) WriteStoreDebugData(host, templateID, eventType string, data string)
type ResultEvent ¶
type ResultEvent struct { // Template is the relative filename for the template Template string `json:"template,omitempty"` // TemplateURL is the URL of the template for the result inside the nuclei // templates repository if it belongs to the repository. TemplateURL string `json:"template-url,omitempty"` // TemplateID is the ID of the template for the result. TemplateID string `json:"template-id"` // TemplatePath is the path of template TemplatePath string `json:"template-path,omitempty"` // TemplateEncoded is the base64 encoded template TemplateEncoded string `json:"template-encoded,omitempty"` // Info contains information block of the template for the result. Info model.Info `json:"info,inline"` // MatcherName is the name of the matcher matched if any. MatcherName string `json:"matcher-name,omitempty"` // ExtractorName is the name of the extractor matched if any. ExtractorName string `json:"extractor-name,omitempty"` // Type is the type of the result event. Type string `json:"type"` // Host is the host input on which match was found. Host string `json:"host,omitempty"` // Port is port of the host input on which match was found (if applicable). Port string `json:"port,omitempty"` // Scheme is the scheme of the host input on which match was found (if applicable). Scheme string `json:"scheme,omitempty"` // URL is the Base URL of the host input on which match was found (if applicable). URL string `json:"url,omitempty"` // Path is the path input on which match was found. Path string `json:"path,omitempty"` // Matched contains the matched input in its transformed form. Matched string `json:"matched-at,omitempty"` // ExtractedResults contains the extraction result from the inputs. ExtractedResults []string `json:"extracted-results,omitempty"` // Request is the optional, dumped request for the match. Request string `json:"request,omitempty"` // Response is the optional, dumped response for the match. Response string `json:"response,omitempty"` // Metadata contains any optional metadata for the event Metadata map[string]interface{} `json:"meta,omitempty"` // IP is the IP address for the found result event. IP string `json:"ip,omitempty"` // Timestamp is the time the result was found at. Timestamp time.Time `json:"timestamp"` // Interaction is the full details of interactsh interaction. Interaction *server.Interaction `json:"interaction,omitempty"` // CURLCommand is an optional curl command to reproduce the request // Only applicable if the report is for HTTP. CURLCommand string `json:"curl-command,omitempty"` // MatcherStatus is the status of the match MatcherStatus bool `json:"matcher-status"` // Lines is the line count for the specified match Lines []int `json:"matched-line,omitempty"` // IssueTrackers is the metadata for issue trackers IssueTrackers map[string]IssueTrackerMetadata `json:"issue_trackers,omitempty"` // ReqURLPattern when enabled contains base URL pattern that was used to generate the request // must be enabled by setting protocols.ExecuterOptions.ExportReqURLPattern to true ReqURLPattern string `json:"req_url_pattern,omitempty"` // Fields related to HTTP Fuzzing functionality of nuclei. // The output contains additional fields when the result is // for a fuzzing template. IsFuzzingResult bool `json:"is_fuzzing_result,omitempty"` FuzzingMethod string `json:"fuzzing_method,omitempty"` FuzzingParameter string `json:"fuzzing_parameter,omitempty"` FuzzingPosition string `json:"fuzzing_position,omitempty"` FileToIndexPosition map[string]int `json:"-"` Error string `json:"error,omitempty"` }
ResultEvent is a wrapped result event for a single nuclei output.
type StandardWriter ¶
type StandardWriter struct { DisableStdout bool AddNewLinesOutputFile bool // by default this is only done for stdout // contains filtered or unexported fields }
StandardWriter is a writer writing output to file and screen for results.
func NewStandardWriter ¶
func NewStandardWriter(options *types.Options) (*StandardWriter, error)
NewStandardWriter creates a new output writer based on user configurations
func NewWriter ¶
func NewWriter(opts ...WriterOptions) (*StandardWriter, error)
NewWriter creates a new output writer if no writer is specified it writes to stdout
func (*StandardWriter) Close ¶
func (w *StandardWriter) Close()
Close closes the output writing interface
func (*StandardWriter) Colorizer ¶
func (w *StandardWriter) Colorizer() aurora.Aurora
Colorizer returns the colorizer instance for writer
func (*StandardWriter) Request ¶
func (w *StandardWriter) Request(templatePath, input, requestType string, requestErr error)
Request writes a log the requests trace log
func (*StandardWriter) Write ¶
func (w *StandardWriter) Write(event *ResultEvent) error
Write writes the event to file and/or screen.
func (*StandardWriter) WriteFailure ¶
func (w *StandardWriter) WriteFailure(wrappedEvent *InternalWrappedEvent) error
WriteFailure writes the failure event for template to file and/or screen.
func (*StandardWriter) WriteStoreDebugData ¶
func (w *StandardWriter) WriteStoreDebugData(host, templateID, eventType string, data string)
type Writer ¶
type Writer interface { // Close closes the output writer interface Close() // Colorizer returns the colorizer instance for writer Colorizer() aurora.Aurora // Write writes the event to file and/or screen. Write(*ResultEvent) error // WriteFailure writes the optional failure event for template to file and/or screen. WriteFailure(*InternalWrappedEvent) error // Request logs a request in the trace log Request(templateID, url, requestType string, err error) // WriteStoreDebugData writes the request/response debug data to file WriteStoreDebugData(host, templateID, eventType string, data string) }
Writer is an interface which writes output to somewhere for nuclei events.
type WriterOptions ¶
type WriterOptions func(s *StandardWriter) error
WriterOptions contains configuration options for a writer
func WithAurora ¶
func WithAurora(aurora aurora.Aurora) WriterOptions
WithAurora sets the aurora instance for the writer
func WithErrorSink ¶
func WithErrorSink(errorFile io.WriteCloser) WriterOptions
WithErrorSink sets the writer where error output is written
func WithJson ¶
func WithJson(json bool, dumpReqResp bool) WriterOptions
WithJson writes output in json format
func WithMatcherStatus ¶
func WithMatcherStatus(matcherStatus bool) WriterOptions
WithMatcherStatus writes output with matcher status
func WithNoMetadata ¶
func WithNoMetadata(noMetadata bool) WriterOptions
WithNoMetadata disables metadata output
func WithSeverityColors ¶
func WithSeverityColors(severityColors func(severity.Severity) string) WriterOptions
WithSeverityColors sets the color function for severity
func WithStoreResponse ¶
func WithStoreResponse(storeResponse bool, respDir string) WriterOptions
WithStoreResponse sets the store response option
func WithTimestamp ¶
func WithTimestamp(timestamp bool) WriterOptions
WithTimestamp writes output with timestamp
func WithTraceSink ¶
func WithTraceSink(traceFile io.WriteCloser) WriterOptions
WithTraceSink sets the writer where trace output is written
func WithWriter ¶
func WithWriter(outputFile io.WriteCloser) WriterOptions
WithWriter sets the writer for the writer