cmd

package
v0.0.88 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package cmd implements the CobraCLI commands for the webscan CLI. Subcommands for the CLI should all live within this package. Logic should be delegated to internal packages and functions to keep the CLI commands clean and focused on CLI I/O.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WebScan

type WebScan struct {
	Version      string
	RootFlags    config.RootFlags
	OutputConfig writer.OutputConfig
	OutputSignal signal.Signal
	RootCmd      *cobra.Command
	VersionCmd   *cobra.Command
}

WebScan is the main struct for the webscan CLI. It contains both the root command and all subcommands that can be invoked during the execution of the CLI. It also is responsible for managing the output configuration as well as the output signal itself, which will be written after the execution of the invoked command's Run function.

func NewWebScan

func NewWebScan(version string) *WebScan

NewWebScan creates a new WebScan struct with the provided version string. The Webscan struct is used throughout the subcommands as a contex within which output results and configuration values can be stored. We pass the version value in from the main.go file, where we set the version string during the build process.

func (*WebScan) InitDiscoverCommand added in v0.0.83

func (a *WebScan) InitDiscoverCommand()

InitDiscoverCommand initializes the 'discover' command and its subcommands for the CLI.

func (*WebScan) InitEnumerateCommand added in v0.0.83

func (a *WebScan) InitEnumerateCommand()

InitEnumerateCommand initializes the 'enumerate' command and its subcommands for the CLI.

func (*WebScan) InitPentestCommand added in v0.0.83

func (a *WebScan) InitPentestCommand()

InitPentestCommand initializes the 'pentest' command and its subcommands for the CLI.

func (*WebScan) InitRootCommand

func (a *WebScan) InitRootCommand()

InitRootCommand initializes the root command for the webscan CLI. This command is the parent command for all other subcommands that can be invoked. It also sets up the version command, which prints the version of the CLI when invoked. The root command also sets up the output configuration and signal, which are used to write the output of the subcommands to the appropriate location (file or stdout). Here, we set the PersistentPreRunE and PersistentPostRunE functions that are propagated to all subcommands. These functions are used to set up the output configuration and signal before the command is run, and to write the output signal after the command has completed.

Jump to

Keyboard shortcuts

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