From e56217dea8cf57744008c0cf1f387011ba613414 Mon Sep 17 00:00:00 2001 From: "Victor M. Alvarez" Date: Thu, 2 Aug 2018 19:10:43 +0200 Subject: [PATCH] In content searches print whether the match was in a subfile or not. --- cmd/search.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/search.go b/cmd/search.go index f61e28d..a81e62f 100644 --- a/cmd/search.go +++ b/cmd/search.go @@ -134,6 +134,7 @@ func (m *matchPrinter) Do(fileObj interface{}, ds *utils.DoerState) string { var s string confidence := f.ContextAttributes["confidence"].(float64) snippetID := f.ContextAttributes["snippet"].(string) + inSubFile := f.ContextAttributes["match_in_subfile"].(bool) snippets := make([]string, 0) _, err := m.client.GetData(vt.URL("intelligence/search/snippets/%s", snippetID), &snippets) if err == nil { @@ -144,8 +145,8 @@ func (m *matchPrinter) Do(fileObj interface{}, ds *utils.DoerState) string { s = "" } line = fmt.Sprintf( - "%s\n\nsha256 : %s\nscore : %03.1f \n\n%s\n", - strings.Repeat("_", 76), f.ID, confidence, s) + "%s\n\nsha256 : %s\nscore : %03.1f \nsubfile : %v\n\n%s\n", + strings.Repeat("_", 76), f.ID, confidence, inSubFile, s) } return line }