mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
33 lines
708 B
Go
33 lines
708 B
Go
package analyzer
|
|
|
|
import (
|
|
"context"
|
|
|
|
malysisv1 "buf.build/gen/go/safedep/api/protocolbuffers/go/safedep/messages/malysis/v1"
|
|
packagev1 "buf.build/gen/go/safedep/api/protocolbuffers/go/safedep/messages/package/v1"
|
|
)
|
|
|
|
// A base interface for all analyzers
|
|
type Analyzer interface {
|
|
Name() string
|
|
}
|
|
|
|
type MalysisResult struct {
|
|
AnalysisID string
|
|
Report *malysisv1.Report
|
|
}
|
|
|
|
func (m *MalysisResult) IsMalware() bool {
|
|
return m.Report.GetInference().GetIsMalware()
|
|
}
|
|
|
|
func (m *MalysisResult) Summary() string {
|
|
return m.Report.GetInference().GetSummary()
|
|
}
|
|
|
|
type MalysisAnalyzer interface {
|
|
Analyzer
|
|
|
|
Analyze(ctx context.Context, packageVersion *packagev1.PackageVersion) (*MalysisResult, error)
|
|
}
|