utils

package
v2.19.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const AttackerEmailEnvVarKey = "STRATUS_RED_TEAM_ATTACKER_EMAIL"

Variables

This section is empty.

Functions

func AwsConfigFromCredentials

func AwsConfigFromCredentials(accessKeyId string, secretAccessKey string, sessionToken string, detonationUid *uuid.UUID) aws.Config

func CoalesceErr

func CoalesceErr(args ...error) error

func CustomUserAgentApiOptions added in v2.17.0

func CustomUserAgentApiOptions(uniqueCorrelationId uuid.UUID) config.LoadOptionsFunc

func DownloadAllObjects added in v2.9.0

func DownloadAllObjects(client *s3.Client, bucketName string) error

func FileExists

func FileExists(path string) bool

func GetCurrentAccountId

func GetCurrentAccountId(cfg aws.Config) (string, error)

func IndexOf added in v2.7.0

func IndexOf[T comparable](slice []T, searchValue T) int

IndexOf returns the index of a given value in a slice, or -1 if not found

func IsErrorDueToEBSEncryptionByDefault

func IsErrorDueToEBSEncryptionByDefault(err error) bool

func ListAllObjectVersions added in v2.9.0

func ListAllObjectVersions(s3Client *s3.Client, bucketName string) ([]s3types.ObjectIdentifier, error)

func MD5HashBase64 added in v2.9.0

func MD5HashBase64(text string) string

func Min

func Min(a int, b int) int

The Min function returns the smallest of two integers Note: math.Min only works for float64

func RandomHexString

func RandomHexString(length int) string

func RandomString

func RandomString(length int) string

func Remove added in v2.7.0

func Remove(slice []string, index int) []string

Remove removes an element from a slice at a given index

func SHA256Hash added in v2.18.0

func SHA256Hash(input string) string

func UploadFile added in v2.9.0

func UploadFile(s3Client *s3.Client, bucketName string, filename string, contents io.Reader) error

func WaitForAndAssumeAWSRole added in v2.5.6

func WaitForAndAssumeAWSRole(awsConnection *aws.Config, roleArn string) error

WaitForAndAssumeAWSRole waits for an AWS role to be assumable (due to eventual consistency) then sets a credentials provider that can be used to assume the role.

func WaitForInstanceToRegisterInSSM added in v2.14.0

func WaitForInstanceToRegisterInSSM(ssmClient *ssm.Client, instanceId string) error

utility function for a single instance

func WaitForInstancesToRegisterInSSM added in v2.14.0

func WaitForInstancesToRegisterInSSM(ssmClient *ssm.Client, instanceIds []string) error

WaitForInstancesToRegisterInSSM waits for a set of instances to be registered in SSM may be slow (60+ seconds)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL