File tree Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 4
4
"log"
5
5
6
6
"github.com/spf13/cobra"
7
- "github.com/spf13/viper"
8
7
9
8
"github.com/privateerproj/privateer-sdk/raidengine"
10
9
)
15
14
Use : "debug" ,
16
15
Short : "Run the Raid in debug mode" ,
17
16
Run : func (cmd * cobra.Command , args []string ) {
18
- err := raidengine .Run (RaidName , viper . GetString ( "raids.wireframe.tactic" ), getStrikes ())
17
+ err := raidengine .Run (RaidName , getStrikes ())
19
18
if err != nil {
20
19
log .Fatal (err )
21
20
}
Original file line number Diff line number Diff line change 1
1
package cmd
2
2
3
3
import (
4
+ "fmt"
4
5
"os"
5
6
6
7
"github.com/spf13/cobra"
@@ -72,22 +73,29 @@ func cleanupFunc() error {
72
73
// Adding raidengine.SetupCloseHandler(cleanupFunc) will allow you to append custom cleanup behavior
73
74
func (r * Raid ) Start () error {
74
75
raidengine .SetupCloseHandler (cleanupFunc )
75
- return raidengine .Run (RaidName , viper . GetString ( "tactic" ), getStrikes ()) // Return errors from strike executions
76
+ return raidengine .Run (RaidName , getStrikes ()) // Return errors from strike executions
76
77
}
77
78
78
79
// GetStrikes returns a list of probe objects
79
- func getStrikes () map [ string ] []raidengine.Strike {
80
+ func getStrikes () []raidengine.Strike {
80
81
logger := raidengine .GetLogger (RaidName , false )
81
82
a := & strikes.Antijokes {
82
83
Log : logger ,
83
84
}
84
- return map [string ][]raidengine.Strike {
85
- "PCI " : {
85
+ availableStrikes := map [string ][]raidengine.Strike {
86
+ "CCC-Taxonomy " : {
86
87
a .KnockKnock ,
87
88
},
88
89
"CIS" : {
89
90
a .KnockKnock ,
90
91
a .ChickenCrossedRoad ,
91
92
},
92
93
}
94
+ tactic := viper .GetString ("raids.wireframe.tactic" )
95
+ strikes := availableStrikes [tactic ]
96
+ if len (strikes ) == 0 {
97
+ message := fmt .Sprintf ("No strikes were found for the provided strike set: %s" , tactic )
98
+ logger .Error (message )
99
+ }
100
+ return strikes
93
101
}
Original file line number Diff line number Diff line change 4
4
5
5
require (
6
6
github.com/hashicorp/go-hclog v1.2.0
7
- github.com/privateerproj/privateer-sdk v0.0.3
7
+ github.com/privateerproj/privateer-sdk v0.0.4
8
8
github.com/spf13/cobra v1.4.0
9
9
github.com/spf13/viper v1.15.0
10
10
)
You can’t perform that action at this time.
0 commit comments