Documentation
¶
Index ¶
- func AskForConfirmation(s string) bool
- func CheckPath(cmd string) bool
- func Contains(slice []string, target string) bool
- func DirExists(path string) bool
- func DownloadFile(url string, filepath string) error
- func EvaluateDockerComposeStatus(install ...bool) error
- func FetchLogs(containerName string, lines string) []string
- func FileExists(path string) bool
- func GenerateRandomPassword(pwLength int, safe bool) string
- func GetConfigAll() []byte
- func GetCwdFromExe() string
- func ParseBloodHoundEnvironmentVariables()
- func RunBasicCmd(name string, args []string) (string, error)
- func RunCmd(name string, args []string) error
- func RunDockerComposeDown(yaml string, volumes bool)
- func RunDockerComposeInstall(yaml string)
- func RunDockerComposeRestart(yaml string)
- func RunDockerComposeStart(yaml string)
- func RunDockerComposeStop(yaml string)
- func RunDockerComposeUninstall(yaml string)
- func RunDockerComposeUp(yaml string)
- func RunDockerComposeUpgrade(yaml string)
- func SetConfig(key string, value string)
- func WriteBloodHoundEnvironmentVariables()
- type Configuration
- type Configurations
- type Container
- type Containers
- type HealthIssue
- type HealthIssues
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AskForConfirmation ¶
AskForConfirmation asks the user for confirmation. A user must type in "yes" or "no" and then press enter. It has fuzzy matching, so "y", "Y", "yes", "YES", and "Yes" all count as confirmations. If the input is not recognized, it will ask again. The function does not return until it gets a valid response from the user. Original source: https://gist.github.com/r0l1/3dcbb0c8f6cfe9c66ab8008f55f8f28b
func CheckPath ¶
CheckPath checks the $PATH environment variable for a given "cmd" and return a "bool" indicating if it exists.
func Contains ¶
Contains checks if a slice of strings ("slice" parameter) contains a given string ("search" parameter).
func DirExists ¶
DirExists determines if a given string is a valid directory. Reference: https://golangcode.com/check-if-a-file-exists/
func DownloadFile ¶
DownloadFile downloads a file from the specified URL and saves it to the provided filepath.
func EvaluateDockerComposeStatus ¶
EvaluateDockerComposeStatus determines if the host has the "docker compose" plugin or the "docker compose" script installed and set the global `dockerCmd` variable.
func FetchLogs ¶
FetchLogs fetches logs from the container with the specified "name" label ("containerName" parameter).
func FileExists ¶
FileExists determines if a given string is a valid filepath. Reference: https://golangcode.com/check-if-a-file-exists/
func GenerateRandomPassword ¶
GenerateRandomPassword generates a random password of the given length The password will be comprised of a-zA-Z0-9 and !@#$%^&*()_-+=/?<>., Special characters exclude the following: '";:`~\/| Exclusions are to help avoid issues with escaping and breaking quotes in env files
func GetConfigAll ¶
func GetConfigAll() []byte
GetConfigAll retrieves all values from the JSON config configuration file.
func GetCwdFromExe ¶
func GetCwdFromExe() string
GetCwdFromExe gets the current working directory based on "bloodhound-cli" location.
func ParseBloodHoundEnvironmentVariables ¶
func ParseBloodHoundEnvironmentVariables()
ParseBloodHoundEnvironmentVariables attempts to find and open an existing JSON config file or create a new one. If a JSON config file is found, load it into the Viper configuration. If a JSON config file is not found, create a new one with default values. Then write the final file with `WriteBloodHoundEnvironmentVariables()`.
func RunBasicCmd ¶
RunBasicCmd executes a given command ("name") with a list of arguments ("args") and return a "string" with the output.
func RunCmd ¶
RunCmd executes a given command ("name") with a list of arguments ("args") and return stdout and stderr buffers.
func RunDockerComposeDown ¶
RunDockerComposeDown executes the "docker compose" commands to bring down the environment with the specified YAML file ("yaml" parameter).
func RunDockerComposeInstall ¶
func RunDockerComposeInstall(yaml string)
RunDockerComposeInstall executes the "docker compose" commands for a first-time installation with the specified YAML file ("yaml" parameter).
func RunDockerComposeRestart ¶
func RunDockerComposeRestart(yaml string)
RunDockerComposeRestart executes the "docker compose" commands to restart the environment with the specified YAML file ("yaml" parameter).
func RunDockerComposeStart ¶
func RunDockerComposeStart(yaml string)
RunDockerComposeStart executes the "docker compose" commands to start the environment with the specified YAML file ("yaml" parameter).
func RunDockerComposeStop ¶
func RunDockerComposeStop(yaml string)
RunDockerComposeStop executes the "docker compose" commands to stop all services in the environment with the specified YAML file ("yaml" parameter).
func RunDockerComposeUninstall ¶ added in v0.1.3
func RunDockerComposeUninstall(yaml string)
RunDockerComposeUninstall executes the "docker compose" commands to bring down containers and remove containers, images, and volumes with the specified YAML file ("yaml" parameter).
func RunDockerComposeUp ¶
func RunDockerComposeUp(yaml string)
RunDockerComposeUp executes the "docker compose" commands to bring up the environment with the specified YAML file ("yaml" parameter).
func RunDockerComposeUpgrade ¶
func RunDockerComposeUpgrade(yaml string)
RunDockerComposeUpgrade executes the "docker compose" commands for re-building or upgrading an installation with the specified YAML file ("yaml" parameter).
func WriteBloodHoundEnvironmentVariables ¶
func WriteBloodHoundEnvironmentVariables()
WriteBloodHoundEnvironmentVariables writes the environment variables to the JSON config file.
Types ¶
type Configuration ¶
Configuration is a custom type for storing configuration values as Key:Val pairs.
type Configurations ¶
type Configurations []Configuration
Configurations is a custom type for storing `Configuration` values
func GetConfig ¶
func GetConfig(args []string) Configurations
GetConfig retrieves the specified values from the JSON config file.
func (Configurations) Len ¶
func (c Configurations) Len() int
Len returns the length of a Configurations struct
func (Configurations) Less ¶
func (c Configurations) Less(i, j int) bool
Less determines if one Configuration is less than another Configuration
func (Configurations) Swap ¶
func (c Configurations) Swap(i, j int)
Swap exchanges the position of two Configuration values in a Configurations struct
type Container ¶
Container is a custom type for storing container information similar to output from "docker containers ls".
type Containers ¶
type Containers []Container
Containers is a collection of Container structs
func GetRunning ¶
func GetRunning() Containers
GetRunning determines if the container with the specified "name" label ("containerName" parameter) is running.
func (Containers) Less ¶
func (c Containers) Less(i, j int) bool
Less determines if one Container is less than another Container
func (Containers) Swap ¶
func (c Containers) Swap(i, j int)
Swap exchanges the position of two Container values in a Containers struct
type HealthIssue ¶
HealthIssue is a custom type for storing healthcheck output.
type HealthIssues ¶
type HealthIssues []HealthIssue
func (HealthIssues) Len ¶
func (c HealthIssues) Len() int
func (HealthIssues) Less ¶
func (c HealthIssues) Less(i, j int) bool
func (HealthIssues) Swap ¶
func (c HealthIssues) Swap(i, j int)