diff --git a/cmd/permission-denied-history.go b/cmd/permission-denied-history.go index 9246ff6..dcc791a 100644 --- a/cmd/permission-denied-history.go +++ b/cmd/permission-denied-history.go @@ -65,7 +65,7 @@ func runPermissionDeniedHistory(cmd *cobra.Command, _ []string) error { if awsClient.Region != aws.DefaultRegion { fmt.Println("") - fmt.Println("Fetching IAM events from", aws.DefaultRegion) + fmt.Printf("Fetching AWS global events from %s...\n", aws.DefaultRegion) awsClient, err = aws.GetAWSClientWithRegion(aws.DefaultRegion) if err != nil { diff --git a/cmd/write-history.go b/cmd/write-history.go index 7130a24..211d219 100644 --- a/cmd/write-history.go +++ b/cmd/write-history.go @@ -85,7 +85,7 @@ func runWriteHistory(cmd *cobra.Command, _ []string) error { if awsClient.Region != aws.DefaultRegion { fmt.Println("") - fmt.Println("Fetching IAM events from", aws.DefaultRegion) + fmt.Printf("Fetching AWS global events from %s...\n", aws.DefaultRegion) awsClient, err = aws.GetAWSClientWithRegion(aws.DefaultRegion) if err != nil { diff --git a/go.mod b/go.mod index 832b08a..7f2c1da 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,13 @@ require ( github.com/spf13/cobra v1.7.0 ) +require ( + github.com/fatih/color v1.15.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect + golang.org/x/sys v0.6.0 // indirect +) + require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect diff --git a/go.sum b/go.sum index 5574e36..c0d5d1f 100644 --- a/go.sum +++ b/go.sum @@ -4,12 +4,19 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -36,7 +43,10 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/pkg/utils/aws/cloudtrail.go b/pkg/utils/aws/cloudtrail.go index 319eb9c..6b10876 100644 --- a/pkg/utils/aws/cloudtrail.go +++ b/pkg/utils/aws/cloudtrail.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/cloudtrail" + "github.com/fatih/color" "golang.org/x/exp/slices" ) @@ -48,6 +49,8 @@ func (c *Client) PrintCloudTrailWriteEvents( } for _, resource := range resourceARNs { + fmt.Println("") + fmt.Printf("Looking for write-events on %s...\n", resource.ARN) resourceCopy := resource // Fixes G601 lookupInput := &cloudtrail.LookupEventsInput{ StartTime: aws.Time(startTime), @@ -203,7 +206,7 @@ func printEventNonRaw( accumulatingString += fmt.Sprintf(" | EventID: %s", aws.StringValue(event.EventId)) } - fmt.Println(accumulatingString) + fmt.Println(color.GreenString(accumulatingString)) return nil }