mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
feat: Add analyzer for malysis query
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user