This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

cmd

    import "github.com/analog-substance/carbon/pkg/cmd"
    

    Index

    Variables

    CarbonCmd represents the base command when called without any subcommands

    var CarbonCmd = &cobra.Command{
        Use:   "carbon",
        Short: "Carbon - Infrastructure automation for offensive operations.",
        Long: `Infrastructure automation for offensive operations.
    - ℹ️ Checkout the latest docs [here](https://analog-substance.github.io/carbon/)
    - 😢 Have a problem? [Create an Issue](https://github.com/analog-substance/carbon/issues/new?title=Something%20is%20broken)
    - ❤️ Enjoying Carbon? [Star the Repo](https://github.com/analog-substance/carbon)
    
    ## Purpose
    
    Carbon's primary purpose is to provide a consistent execution environment to
    facilitate offensive security assessments.
    
    ## Dependencies
    
    - Packer to build images.
    - Terraform to provision infrastructure.
    - Golang project structure.
    
    ## Supported Providers
    
    - AWS
    - QEMU (Local)
    - VirtualBox (Local)
    - vSphere (in progress)
    - Multipass (Local)
    
    There are plans to bring support to the following:
    
    - GCP
    - Azure
    - VMware (Local)
    - QEMU (Remote)
    `,
        PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
    
            if debug {
                common.LogLevel(slog.LevelDebug)
            }
            log.Debug("debug mode", "debug", debug)
    
            carbonConfigFile := common.GetConfig()
            home, err := homedir.Dir()
            if err != nil {
                log.Debug("error getting home directory", "error", err)
            } else {
                err := carbonConfigFile.MergeInConfigFile(filepath.Join(home, cfgFileName))
    
                if err != nil {
                    log.Debug("error loading carbon config from home", "error", err)
                }
            }
    
            err = carbonConfigFile.MergeInConfigFile(cfgFileName)
            if err != nil {
                log.Debug("error loading carbon config from home", "error", err)
            }
    
            carbonObj = carbon.New(carbonConfigFile.Carbon)
            updateConfigHelp()
    
            return nil
        },
    }
    

    func AskIfSure

    func AskIfSure(msg string) bool
    

    func Execute

    func Execute()
    

    Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

    func ListingDir

    func ListingDir(dir string)