utils

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const AzureOutputDirectory = "/azure/"
View Source
const CloudFoxClientDirName = ".cloudfox"
View Source
const LogFileName = "cloudfox.log"

Variables

View Source
var (
	TxtLoggerName = "root"
	TxtLog        = TxtLogger()
	UtilsFs       = afero.NewOsFs()
)

Functions

func AWSConfigFileLoader

func AWSConfigFileLoader(AWSProfile string, version string) aws.Config

func AWSWhoami

func AWSWhoami(awsProfile string, version string) (*sts.GetCallerIdentityOutput, error)

func AzGetResourceGroups

func AzGetResourceGroups(subscriptionID string, authorizer autorest.Authorizer) []string

func AzGetScopeInformation

func AzGetScopeInformation() map[string]map[string][]string

func AzNewGraphAuthorizer

func AzNewGraphAuthorizer(tenantID string) autorest.Authorizer

func AzNewResourceManagerAuthorizer

func AzNewResourceManagerAuthorizer() autorest.Authorizer

func BuildAWSPath added in v1.7.1

func BuildAWSPath(Caller sts.GetCallerIdentityOutput) string

func CheckErr added in v1.7.2

func CheckErr(e error, msg string)

func ConfirmSelectedProfiles added in v1.7.2

func ConfirmSelectedProfiles(AWSProfiles []string) bool

func Contains

func Contains(element string, array []string) bool

Checks if element is part of array.

func GetAllAWSProfiles added in v1.7.2

func GetAllAWSProfiles(AWSConfirm bool) []string

func GetLogDirPath

func GetLogDirPath() *string

This function returns ~/.cloudfox. If the folder does not exist the function creates it.

func GetSelectedAWSProfiles added in v1.7.2

func GetSelectedAWSProfiles(AWSProfilesListPath string) []string

func InitLogging

func InitLogging() *os.File

Initializes logging. Don't forget to use 'defer file.close()' after invoking this function.

func LoadFileLinesIntoArray

func LoadFileLinesIntoArray(input string) []string

func OutputSelector

func OutputSelector(verbosity int, outputType string, header []string, body [][]string, outputDirectory string, fileName string, callingModule string)

verbosity = 1 (Output and loot printed to file). verbosity = 2 (Output and loot printed to file, output printed screen). verbosity = 3 (Output and loot printed to file and screen). outputType = "table", "csv"

func TxtLogger

func TxtLogger() *logrus.Logger

txtLogger - Returns the txt logger

Types

type OutputData2

type OutputData2 struct {
	Headers       []string
	Body          [][]string
	FilePath      string
	FullFilename  string
	CallingModule string
	Verbosity     int
	Directory     string
}

This struct is here to mantain compatibility with legacy cloudfox code

Jump to

Keyboard shortcuts

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