Documentation ¶
Index ¶
- Variables
- type Action
- type Actions
- type Config
- type Connector
- type InformAction
- type Lock
- type LockEntry
- type LockFileInfo
- type Locker
- type LogAction
- type MockLock
- type MockSubmitter
- func (m *MockSubmitter) ExtractExpertViewURL(result *gdetect.Result) (urlExpertView string, err error)
- func (m *MockSubmitter) GetAPIVersion(ctx context.Context) (version string, err error)
- func (m *MockSubmitter) GetProfileStatus(ctx context.Context) (status gdetect.ProfileStatus, err error)
- func (m *MockSubmitter) GetResultBySHA256(ctx context.Context, sha256 string) (result gdetect.Result, err error)
- func (m *MockSubmitter) GetResultByUUID(ctx context.Context, uuid string) (result gdetect.Result, err error)
- func (m *MockSubmitter) GetResults(ctx context.Context, from int, size int, tags ...string) (submissions []gdetect.Submission, err error)
- func (m *MockSubmitter) SubmitFile(ctx context.Context, filepath string, options gdetect.SubmitOptions) (uuid string, err error)
- func (m *MockSubmitter) SubmitReader(ctx context.Context, r io.Reader, options gdetect.SubmitOptions) (uuid string, err error)
- func (m *MockSubmitter) WaitForFile(ctx context.Context, filepath string, options gdetect.WaitForOptions) (result gdetect.Result, err error)
- func (m *MockSubmitter) WaitForReader(ctx context.Context, r io.Reader, options gdetect.WaitForOptions) (result gdetect.Result, err error)
- type MultiAction
- type NoAction
- type QuarantineAction
- type QuarantinedFile
- type RemoveFileAction
- type Report
- type ReportAction
- type ReportsWriter
- type Submitter
- type SummarizedGMalwareResult
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrIndexNotFound = errors.New("index part not found") ErrFileNotFound = errors.New("file part not found") )
View Source
var LockPasswordIter = 4096
View Source
var Logger = slog.New(slog.NewJSONHandler(os.Stderr, nil))
View Source
var MaxFileSize int64 = 100 * 1024 * 1024
View Source
var MaxWorkers = 40
View Source
var Now = time.Now
for test purposes
View Source
var Since = time.Since
Functions ¶
This section is empty.
Types ¶
type Action ¶ added in v0.2.0
type Action interface {
Handle(path string, result SummarizedGMalwareResult, report *Report) error
}
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
func NewConnector ¶
type InformAction ¶
func (*InformAction) Handle ¶
func (a *InformAction) Handle(path string, result SummarizedGMalwareResult, report *Report) (err error)
type LockFileInfo ¶
func (*LockFileInfo) Size ¶
func (lfi *LockFileInfo) Size() int64
type MockLock ¶
type MockLock struct { LockFileMock func(file string, in io.Reader, info os.FileInfo, reason string, out io.Writer) error UnlockFileMock func(in io.Reader, out io.Writer) (file string, info os.FileInfo, reason string, err error) GetHeaderMock func(in io.Reader) (entry LockEntry, err error) }
type MockSubmitter ¶
type MockSubmitter struct { ExtractExpertViewURLMock func(result *gdetect.Result) (urlExpertView string, err error) GetResultByUUIDMock func(ctx context.Context, uuid string) (result gdetect.Result, err error) GetResultBySHA256Mock func(ctx context.Context, sha256 string) (result gdetect.Result, err error) GetResultsMock func(ctx context.Context, from int, size int, tags ...string) (submissions []gdetect.Submission, err error) SubmitFileMock func(ctx context.Context, filepath string, options gdetect.SubmitOptions) (uuid string, err error) SubmitReaderMock func(ctx context.Context, r io.Reader, options gdetect.SubmitOptions) (uuid string, err error) WaitForFileMock func(ctx context.Context, filepath string, options gdetect.WaitForOptions) (result gdetect.Result, err error) WaitForReaderMock func(ctx context.Context, r io.Reader, options gdetect.WaitForOptions) (result gdetect.Result, err error) GetProfileStatusMock func(ctx context.Context) (status gdetect.ProfileStatus, err error) GetAPIVersionMock func(ctx context.Context) (version string, err error) }
func (*MockSubmitter) ExtractExpertViewURL ¶
func (m *MockSubmitter) ExtractExpertViewURL(result *gdetect.Result) (urlExpertView string, err error)
func (*MockSubmitter) GetAPIVersion ¶
func (m *MockSubmitter) GetAPIVersion(ctx context.Context) (version string, err error)
func (*MockSubmitter) GetProfileStatus ¶
func (m *MockSubmitter) GetProfileStatus(ctx context.Context) (status gdetect.ProfileStatus, err error)
func (*MockSubmitter) GetResultBySHA256 ¶
func (*MockSubmitter) GetResultByUUID ¶
func (*MockSubmitter) GetResults ¶
func (m *MockSubmitter) GetResults(ctx context.Context, from int, size int, tags ...string) (submissions []gdetect.Submission, err error)
func (*MockSubmitter) SubmitFile ¶
func (m *MockSubmitter) SubmitFile(ctx context.Context, filepath string, options gdetect.SubmitOptions) (uuid string, err error)
func (*MockSubmitter) SubmitReader ¶
func (m *MockSubmitter) SubmitReader(ctx context.Context, r io.Reader, options gdetect.SubmitOptions) (uuid string, err error)
func (*MockSubmitter) WaitForFile ¶
func (m *MockSubmitter) WaitForFile(ctx context.Context, filepath string, options gdetect.WaitForOptions) (result gdetect.Result, err error)
func (*MockSubmitter) WaitForReader ¶
func (m *MockSubmitter) WaitForReader(ctx context.Context, r io.Reader, options gdetect.WaitForOptions) (result gdetect.Result, err error)
type MultiAction ¶
type MultiAction struct {
Actions []Action
}
func NewMultiAction ¶
func NewMultiAction(actions ...Action) *MultiAction
func (*MultiAction) Handle ¶
func (a *MultiAction) Handle(path string, result SummarizedGMalwareResult, report *Report) (err error)
type QuarantineAction ¶
type QuarantineAction struct {
// contains filtered or unexported fields
}
func NewQuarantineAction ¶
func NewQuarantineAction(cache cache.Cacher, root string, locker Locker) *QuarantineAction
func (*QuarantineAction) Handle ¶
func (a *QuarantineAction) Handle(path string, result SummarizedGMalwareResult, report *Report) (err error)
func (*QuarantineAction) ListQuarantinedFiles ¶
func (a *QuarantineAction) ListQuarantinedFiles(ctx context.Context) (qfiles chan QuarantinedFile, err error)
func (*QuarantineAction) Restore ¶
func (a *QuarantineAction) Restore(id string) (err error)
type QuarantinedFile ¶
type RemoveFileAction ¶
type RemoveFileAction struct{}
func (*RemoveFileAction) Handle ¶
func (a *RemoveFileAction) Handle(path string, result SummarizedGMalwareResult, report *Report) (err error)
type Report ¶
type Report struct { FileName string `json:"file-name"` Sha256 string `json:"sha256"` Malicious bool `json:"malicious"` Deleted bool `json:"deleted,omitempty"` QuarantineLocation string `json:"quarantine-location,omitempty"` ExpertViewURL string `json:"expert-View-url,omitempty"` HasBeenRestored bool `json:"has-been-restored,omitempty"` }
type ReportAction ¶
type ReportAction struct{}
func (*ReportAction) Handle ¶
func (a *ReportAction) Handle(path string, result SummarizedGMalwareResult, report *Report) (err error)
type ReportsWriter ¶
type ReportsWriter struct {
// contains filtered or unexported fields
}
func NewReportsWriter ¶
func NewReportsWriter(dst io.WriteSeeker) *ReportsWriter
func (*ReportsWriter) Write ¶
func (rw *ReportsWriter) Write(r Report) (err error)
type SummarizedGMalwareResult ¶ added in v0.2.0
type SummarizedGMalwareResult struct { MaliciousSubfiles map[string]SummarizedGMalwareResult `json:"malicious-subfiles,omitempty"` Sha256 string `json:"sha256"` Malware bool `json:"malware"` Malwares []string `json:"malwares"` }
Click to show internal directories.
Click to hide internal directories.