reporter

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: GPL-3.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBucketExistCheck = xerrors.New("bucket existence cannot be checked because s3:ListBucket or s3:ListAllMyBuckets is not allowed")

ErrBucketExistCheck : bucket existence cannot be checked because s3:ListBucket or s3:ListAllMyBuckets is not allowed

Functions

func JSONDir

func JSONDir(resultsDir string, args []string) (path string, err error)

JSONDir returns If there is args, check if it is a valid format and return the corresponding path under results. If arg passed via PIPE (such as history subcommand), return that path. Otherwise, returns the path of the latest directory

func ListValidJSONDirs

func ListValidJSONDirs(resultsDir string) (dirs []string, err error)

ListValidJSONDirs returns valid json directory as array Returned array is sorted so that recent directories are at the head

func LoadScanResults

func LoadScanResults(jsonDir string) (results models.ScanResults, err error)

LoadScanResults read JSON data

func OverwriteJSONFile

func OverwriteJSONFile(dir string, r models.ScanResult) error

OverwriteJSONFile overwrites scanresults JSON in the dir

Types

type AzureBlobWriter

type AzureBlobWriter struct {
	FormatJSON        bool
	FormatFullText    bool
	FormatOneLineText bool
	FormatList        bool
	Gzip              bool

	config.AzureConf
}

AzureBlobWriter writes results to AzureBlob

func (AzureBlobWriter) Validate

func (w AzureBlobWriter) Validate() error

Validate check the existence of Azure storage container

func (AzureBlobWriter) Write

func (w AzureBlobWriter) Write(rs ...models.ScanResult) (err error)

Write results to Azure Blob storage

type ChatWorkWriter

type ChatWorkWriter struct {
	Cnf   config.ChatWorkConf
	Proxy string
}

ChatWorkWriter send report to ChatWork

func (ChatWorkWriter) Write

func (w ChatWorkWriter) Write(rs ...models.ScanResult) (err error)

Write results to ChatWork

type EMailSender

type EMailSender interface {
	Send(subject, body string) error
}

EMailSender is interface of sending e-mail

func NewEMailSender

func NewEMailSender(cnf config.SMTPConf) EMailSender

NewEMailSender creates emailSender

type EMailWriter

type EMailWriter struct {
	FormatOneEMail    bool
	FormatOneLineText bool
	FormatList        bool
	Cnf               config.SMTPConf
}

EMailWriter send mail

func (EMailWriter) Write

func (w EMailWriter) Write(rs ...models.ScanResult) (err error)

Write results to Email

type GoogleChatWriter added in v0.15.13

type GoogleChatWriter struct {
	Cnf   config.GoogleChatConf
	Proxy string
}

GoogleChatWriter send report to GoogleChat

func (GoogleChatWriter) Write added in v0.15.13

func (w GoogleChatWriter) Write(rs ...models.ScanResult) (err error)

Write results to Google Chat

type HTTPRequestWriter

type HTTPRequestWriter struct {
	URL string
}

HTTPRequestWriter writes results to HTTP request

func (HTTPRequestWriter) Write

func (w HTTPRequestWriter) Write(rs ...models.ScanResult) (err error)

Write sends results as HTTP response

type HTTPResponseWriter

type HTTPResponseWriter struct {
	Writer http.ResponseWriter
}

HTTPResponseWriter writes results to HTTP response

func (HTTPResponseWriter) Write

func (w HTTPResponseWriter) Write(rs ...models.ScanResult) (err error)

Write sends results as HTTP response

type LocalFileWriter

type LocalFileWriter struct {
	CurrentDir          string
	DiffPlus            bool
	DiffMinus           bool
	FormatJSON          bool
	FormatCsv           bool
	FormatFullText      bool
	FormatOneLineText   bool
	FormatList          bool
	FormatCycloneDXJSON bool
	FormatCycloneDXXML  bool
	Gzip                bool
}

LocalFileWriter writes results to a local file.

func (LocalFileWriter) Write

func (w LocalFileWriter) Write(rs ...models.ScanResult) (err error)

Write results to Local File

type ResultWriter

type ResultWriter interface {
	Write(...models.ScanResult) error
}

ResultWriter Interface

type S3Writer

type S3Writer struct {
	FormatJSON        bool
	FormatFullText    bool
	FormatOneLineText bool
	FormatList        bool
	Gzip              bool

	config.AWSConf
}

S3Writer writes results to S3

func (S3Writer) Validate

func (w S3Writer) Validate() error

Validate check the existence of S3 bucket

type SlackWriter

type SlackWriter struct {
	FormatOneLineText bool

	Cnf   config.SlackConf
	Proxy string
	// contains filtered or unexported fields
}

SlackWriter send report to slack

func (SlackWriter) Write

func (w SlackWriter) Write(rs ...models.ScanResult) (err error)

Write results to Slack

type StdoutWriter

type StdoutWriter struct {
	FormatFullText    bool
	FormatOneLineText bool
	FormatList        bool
}

StdoutWriter write to stdout

func (StdoutWriter) Write

func (w StdoutWriter) Write(rs ...models.ScanResult) error

Write results to stdout

func (StdoutWriter) WriteScanSummary

func (w StdoutWriter) WriteScanSummary(rs ...models.ScanResult)

WriteScanSummary prints Scan summary at the end of scan

type SyslogWriter

type SyslogWriter struct {
	Cnf syslogConf.Conf
}

SyslogWriter send report to syslog

func (SyslogWriter) Write

func (w SyslogWriter) Write(rs ...models.ScanResult) (err error)

Write results to syslog

type TelegramWriter

type TelegramWriter struct {
	Cnf   config.TelegramConf
	Proxy string
}

TelegramWriter sends report to Telegram

func (TelegramWriter) Write

func (w TelegramWriter) Write(rs ...models.ScanResult) (err error)

Write results to Telegram

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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