@@ -108,7 +108,7 @@ func matchMitreData(ttp parseutils.TTP, tactic string, technique string, subTech
108108 return true
109109}
110110
111- func filterTTPs (cfg * Config , platforms []string , tactic string , technique string , subTech string , ttpRefs []string , tally map [string ]int , totalCount int , verbose bool ) (int , []string ) {
111+ func filterTTPs (cfg * Config , platforms []string , tactic string , technique string , subTech string , ttpRefs []string , tally map [string ]int , totalCount int ) (int , []string ) {
112112 updatedTTPRefs := []string {}
113113 filterPlatform := ! slices .Contains (platforms , "any" )
114114 fmt .Printf ("Filtering by platforms: %s\n " , platforms )
@@ -128,22 +128,22 @@ func filterTTPs(cfg *Config, platforms []string, tactic string, technique string
128128 for _ , ttpRef := range ttpRefs {
129129 _ , path , err := cfg .repoCollection .ResolveTTPRef (ttpRef )
130130 if err != nil {
131- if verbose {
131+ if logConfig . Verbose {
132132 fmt .Printf ("Error resolving TTP ref: %v with error: %v\n " , ttpRef , err )
133133 }
134134 continue
135135 }
136136 content , err := afero .ReadFile (fs , path )
137137 if err != nil {
138- if verbose {
138+ if logConfig . Verbose {
139139 fmt .Printf ("Error reading TTP ref: %v on path %v with error: %v" , ttpRef , path , err )
140140 }
141141 continue
142142 }
143143
144144 ttp , err := parseutils .ParseTTP (content , path )
145145 if err != nil {
146- if verbose {
146+ if logConfig . Verbose {
147147 fmt .Printf ("Error parsing TTP ref: %v with error: %v\n " , ttpRef , err )
148148 }
149149 continue
@@ -181,7 +181,6 @@ func buildEnumTTPsCommand(cfg *Config) *cobra.Command {
181181 var tactic string
182182 var technique string
183183 var subTech string
184- var verbose bool
185184 var tally = map [string ]int {
186185 "linux" : 0 ,
187186 "windows" : 0 ,
@@ -219,7 +218,7 @@ func buildEnumTTPsCommand(cfg *Config) *cobra.Command {
219218 fmt .Printf ("Total %d TTPs found in repo: %s\n " , len (ttpRefs ), repo )
220219
221220 // Filtering by platform and Attack ID
222- totalCount , ttpRefs = filterTTPs (cfg , platforms , tactic , technique , subTech , ttpRefs , tally , totalCount , verbose )
221+ totalCount , ttpRefs = filterTTPs (cfg , platforms , tactic , technique , subTech , ttpRefs , tally , totalCount )
223222
224223 // Printing data as per platform
225224 if ! slices .Contains (platforms , "any" ) {
@@ -231,7 +230,7 @@ func buildEnumTTPsCommand(cfg *Config) *cobra.Command {
231230 fmt .Println ("Total TTPs found: " , totalCount )
232231 }
233232
234- if verbose {
233+ if logConfig . Verbose {
235234 fmt .Println ("Verbose output - TTPs found: " )
236235 // Printing filtered out TTPs
237236 for _ , ttpRef := range ttpRefs {
@@ -246,6 +245,5 @@ func buildEnumTTPsCommand(cfg *Config) *cobra.Command {
246245 enumTTPsCmd .PersistentFlags ().StringVar (& tactic , "tactic" , "" , "Tactic to search for" )
247246 enumTTPsCmd .PersistentFlags ().StringVar (& technique , "technique" , "" , "Technique to search for" )
248247 enumTTPsCmd .PersistentFlags ().StringVar (& subTech , "sub-tech" , "" , "Sub technique to search for" )
249- enumTTPsCmd .PersistentFlags ().BoolVar (& verbose , "verbose" , false , "Verbose output that displays all matching TTPs" )
250248 return enumTTPsCmd
251249}
0 commit comments