mirror of
https://github.com/safedep/vet.git
synced 2025-12-10 00:22:08 -06:00
chore: Render malysis report URL in console (#302)
This commit is contained in:
parent
141e984067
commit
3fab4697a7
@ -16,6 +16,7 @@ import (
|
||||
"github.com/safedep/dry/utils"
|
||||
"github.com/safedep/vet/internal/auth"
|
||||
"github.com/safedep/vet/internal/ui"
|
||||
"github.com/safedep/vet/pkg/malysis"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -120,7 +121,8 @@ func executeMalwareAnalysis() error {
|
||||
ui.PrintError("Failed to render malware analysis report in JSON format: %v", err)
|
||||
}
|
||||
|
||||
return renderMalwareAnalysisReport(malwareAnalysisPackageUrl, report)
|
||||
return renderMalwareAnalysisReport(malwareAnalysisPackageUrl,
|
||||
analyzePackageResponse.GetAnalysisId(), report)
|
||||
}
|
||||
|
||||
func renderToJSON(report *malysisv1pb.Report) error {
|
||||
@ -136,7 +138,7 @@ func renderToJSON(report *malysisv1pb.Report) error {
|
||||
return os.WriteFile(malwareAnalysisReportJSON, []byte(data), 0644)
|
||||
}
|
||||
|
||||
func renderMalwareAnalysisReport(purl string, report *malysisv1pb.Report) error {
|
||||
func renderMalwareAnalysisReport(purl string, analysisId string, report *malysisv1pb.Report) error {
|
||||
ui.PrintMsg("Malware analysis report for package: %s", purl)
|
||||
|
||||
tbl := table.NewWriter()
|
||||
@ -156,5 +158,14 @@ func renderMalwareAnalysisReport(purl string, report *malysisv1pb.Report) error
|
||||
tbl.AppendRow(table.Row{purl, status, confidence})
|
||||
tbl.Render()
|
||||
|
||||
fmt.Println()
|
||||
fmt.Println(text.FgHiYellow.Sprintf("** The full report is available at: %s",
|
||||
reportVisualizationUrl(analysisId)))
|
||||
fmt.Println()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func reportVisualizationUrl(analysisId string) string {
|
||||
return malysis.ReportURL(analysisId)
|
||||
}
|
||||
|
||||
7
pkg/malysis/url.go
Normal file
7
pkg/malysis/url.go
Normal file
@ -0,0 +1,7 @@
|
||||
package malysis
|
||||
|
||||
import "fmt"
|
||||
|
||||
func ReportURL(reportId string) string {
|
||||
return fmt.Sprintf("https://platform.safedep.io/community/malysis/%s", reportId)
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user