internal

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

	ConfigMap = map[string]aws.Config{}
)
View Source
var Cache = cache.New(120*time.Minute, 0)
View Source
var ErrDirectoryDoesNotExist = errors.New("directory does not exist")

Functions

func AWSConfigFileLoader

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

func AWSWhoami

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

func BuildAWSPath

func BuildAWSPath(Caller sts.GetCallerIdentityOutput) string

func CheckErr

func CheckErr(e error, msg string)

func ConfirmSelectedProfiles

func ConfirmSelectedProfiles(AWSProfiles []string) bool

func Contains

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

Checks if element is part of array.

func GetAADUsersClient

func GetAADUsersClient(tenantID string) graphrbac.UsersClient

func GetARMresourcesClient added in v1.10.0

func GetARMresourcesClient(tenantID, subscriptionID string) *armresources.Client

func GetAllAWSProfiles

func GetAllAWSProfiles(AWSConfirm bool) []string

func GetEnabledRegions

func GetEnabledRegions(awsProfile string, version string, AwsMfaToken string) []string

func GetLogDirPath

func GetLogDirPath() *string

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

func GetNICClient

func GetNICClient(subscriptionID string) network.InterfacesClient

func GetPublicIPClient

func GetPublicIPClient(subscriptionID string) network.PublicIPAddressesClient

func GetResourceGroupsClient

func GetResourceGroupsClient(subscriptionID string) resources.GroupsClient

func GetRoleAssignmentsClient

func GetRoleAssignmentsClient(subscriptionID string) authorization.RoleAssignmentsClient

func GetRoleDefinitionsClient

func GetRoleDefinitionsClient(subscriptionName string) authorization.RoleDefinitionsClient

func GetSelectedAWSProfiles

func GetSelectedAWSProfiles(AWSProfilesListPath string) []string

func GetStorageAccountBlobClient added in v1.10.0

func GetStorageAccountBlobClient(tenantID, storageAccountName string) (*azblob.Client, error)

func GetStorageClient

func GetStorageClient(subscriptionID string) storage.AccountsClient

func GetSubscriptionsClient

func GetSubscriptionsClient() subscriptions.Client

func GetTenantsClient

func GetTenantsClient() subscriptions.TenantsClient

func GetVirtualMachinesClient

func GetVirtualMachinesClient(subscriptionID string) compute.VirtualMachinesClient

func GetgraphRbacClient added in v1.12.0

func GetgraphRbacClient(tenantID string) graphrbac.DomainsClient

func HandleOutput added in v1.14.0

func HandleOutput(
	cloudProvider string,
	format string,
	outputDirectory string,
	verbosity int,
	wrap bool,
	baseCloudfoxModule string,
	principal string,
	resultsIdentifier string,
	dataToOutput CloudfoxOutput,
) error

HandleOutput dynamically handles the output based on the provided arguments. TODO support brief of wide

func LoadCacheFromFiles added in v1.11.0

func LoadCacheFromFiles(directory string) error

func LoadCacheFromGobFiles added in v1.11.0

func LoadCacheFromGobFiles(directory string) error

func LoadFileLinesIntoArray

func LoadFileLinesIntoArray(input string) []string

func MockFileSystem

func MockFileSystem(switcher bool) afero.Fs

func OutputSelector

func OutputSelector(verbosity int, outputType string, header []string, body [][]string, outputDirectory string, fileName string, callingModule string, wrapTable bool, prefixIdentifier 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" prefixIdentifier = this string gets printed with control message calling module (e.g. aws profile, azure resource group, gcp project, etc)

func PrintTableToScreen

func PrintTableToScreen(header []string, body [][]string, wrapLines bool)

func ReorganizeAWSProfiles added in v1.11.0

func ReorganizeAWSProfiles(allProfiles []string, mgmtProfile string) []string

func SaveCacheToFiles added in v1.11.0

func SaveCacheToFiles(directory string, accountID string) error

func SaveCacheToGobFiles added in v1.11.0

func SaveCacheToGobFiles(directory string, accountID string) error

func SaveGraphToGob added in v1.14.0

func SaveGraphToGob[K comparable, T any](directory string, name string, g *graph.Graph[K, T]) error

func SpinUntil

func SpinUntil(callingModuleName string, counter *CommandCounter, done chan bool, spinType string)

func TxtLogger

func TxtLogger() *logrus.Logger

txtLogger - Returns the txt logger

func WriteJsonlFile added in v1.14.0

func WriteJsonlFile(file *os.File, data interface{}) error

Types

type CacheableAWSConfig added in v1.14.0

type CacheableAWSConfig struct {
	Region string
}

type CloudFoxRunData added in v1.14.0

type CloudFoxRunData struct {
	Profile        string
	AccountID      string
	OutputLocation string
}

func InitializeCloudFoxRunData added in v1.14.0

func InitializeCloudFoxRunData(AWSProfile string, version string, AwsMfaToken string, AWSOutputDirectory string) (CloudFoxRunData, error)

type CloudfoxOutput added in v1.14.0

type CloudfoxOutput interface {
	TableFiles() []TableFile
	LootFiles() []LootFile
}

TODO support datastructures that enable brief or wide format

type CommandCounter

type CommandCounter struct {
	Total     int
	Pending   int
	Complete  int
	Error     int
	Executing int
}

type Logger added in v1.14.0

type Logger struct {
	// contains filtered or unexported fields
}

func NewLogger added in v1.14.0

func NewLogger() Logger

func (*Logger) Error added in v1.14.0

func (l *Logger) Error(text string)

func (*Logger) ErrorM added in v1.14.0

func (l *Logger) ErrorM(text string, module string)

func (*Logger) Fatal added in v1.14.0

func (l *Logger) Fatal(text string)

func (*Logger) FatalM added in v1.14.0

func (l *Logger) FatalM(text string, module string)

func (*Logger) Info added in v1.14.0

func (l *Logger) Info(text string)

func (*Logger) InfoM added in v1.14.0

func (l *Logger) InfoM(text string, module string)

func (*Logger) Success added in v1.14.0

func (l *Logger) Success(text string)

func (*Logger) SuccessM added in v1.14.0

func (l *Logger) SuccessM(text string, module string)

type LootClient added in v1.10.0

type LootClient struct {
	DirectoryName string
	LootFiles     []LootFile
}

type LootFile added in v1.10.0

type LootFile struct {
	Name        string
	FilePointer afero.File
	Contents    string
}

type OutputClient added in v1.10.0

type OutputClient struct {
	Verbosity        int
	CallingModule    string
	PrefixIdentifier string
	Table            TableClient
	Loot             LootClient
}

func (*OutputClient) WriteFullOutput added in v1.10.0

func (o *OutputClient) WriteFullOutput(tables []TableFile, lootFiles []LootFile)

type OutputData2

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

This struct is here to maintain compatibility with legacy cloudfox code

type TableClient added in v1.10.0

type TableClient struct {
	Wrap          bool
	DirectoryName string
	TableFiles    []TableFile
}

type TableFile added in v1.10.0

type TableFile struct {
	Name              string
	TableFilePointer  afero.File
	CSVFilePointer    afero.File
	JSONFilePointer   afero.File
	TableCols         []string
	Header            []string
	Body              [][]string
	SkipPrintToScreen bool
}

Directories

Path Synopsis
aws

Jump to

Keyboard shortcuts

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