Skip to content

Commit

Permalink
Enhance usage instructions in CLI (closes #28)
Browse files Browse the repository at this point in the history
  • Loading branch information
christophetd committed Jan 21, 2022
1 parent 708e2ca commit 06c9d81
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 9 deletions.
16 changes: 13 additions & 3 deletions cmd/stratus/cleanup_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@ import (
"github.com/datadog/stratus-red-team/pkg/stratus/runner"
"github.com/spf13/cobra"
"log"
"os"
)

var forceCleanup bool

func buildCleanupCmd() *cobra.Command {
cleanupCmd := &cobra.Command{
Use: "cleanup",
Aliases: []string{"clean"},
Short: "Cleans up any leftover infrastructure or configuration from a TTP.",
Use: "cleanup attack-technique-id [attack-technique-id]...",
Aliases: []string{"clean"},
Short: "Cleans up any leftover infrastructure or configuration from a TTP.",
Example: "stratus cleanup aws.defense-evasion.stop-cloudtrail",
DisableFlagsInUseLine: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
cmd.Help()
os.Exit(0)
}
return nil
},
Args: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return nil // no technique specified == all techniques
Expand Down
14 changes: 12 additions & 2 deletions cmd/stratus/detonate_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,25 @@ import (
"github.com/datadog/stratus-red-team/pkg/stratus/runner"
"github.com/spf13/cobra"
"log"
"os"
)

var detonateNoWarmup bool
var detonateCleanup bool

func buildDetonateCmd() *cobra.Command {
detonateCmd := &cobra.Command{
Use: "detonate",
Short: "Detonate one or multiple attack techniques",
Use: "detonate attack-technique-id [attack-technique-id]...",
Short: "Detonate one or multiple attack techniques",
Example: "stratus detonate aws.defense-evasion.stop-cloudtrail",
DisableFlagsInUseLine: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
cmd.Help()
os.Exit(0)
}
return nil
},
Args: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return errors.New("you must specify at least one attack technique")
Expand Down
14 changes: 12 additions & 2 deletions cmd/stratus/revert_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,24 @@ import (
"github.com/datadog/stratus-red-team/pkg/stratus/runner"
"github.com/spf13/cobra"
"log"
"os"
)

var revertForce bool

func buildRevertCmd() *cobra.Command {
detonateCmd := &cobra.Command{
Use: "revert",
Short: "Revert the detonation of an attack technique",
Use: "revert attack-technique-id [attack-technique-id]...",
Short: "Revert the detonation of an attack technique",
Example: "stratus revert aws.defense-evasion.stop-cloudtrail",
DisableFlagsInUseLine: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
cmd.Help()
os.Exit(0)
}
return nil
},
Args: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return errors.New("you must specify at least one attack technique")
Expand Down
14 changes: 12 additions & 2 deletions cmd/stratus/warmup_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,24 @@ import (
"github.com/datadog/stratus-red-team/pkg/stratus/runner"
"github.com/spf13/cobra"
"log"
"os"
)

var forceWarmup bool

func buildWarmupCmd() *cobra.Command {
warmupCmd := &cobra.Command{
Use: "warmup",
Short: "\"Warm up\" an attack technique by spinning up the pre-requisite infrastructure or configuration, without detonating it",
Use: "warmup attack-technique-id [attack-technique-id]...",
Short: "\"Warm up\" an attack technique by spinning up the pre-requisite infrastructure or configuration, without detonating it",
Example: "stratus warmup aws.defense-evasion.stop-cloudtrail",
DisableFlagsInUseLine: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
cmd.Help()
os.Exit(0)
}
return nil
},
Args: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return errors.New("you must specify at least one attack technique")
Expand Down

0 comments on commit 06c9d81

Please sign in to comment.