Documentation
¶
Overview ¶
Package cmd implements the CobraCLI commands for the networkscan 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 ¶
func LoadBruteForceConfig ¶ added in v0.0.13
func LoadBruteForceConfig(module bruteforcefern.ModuleType, targets []string, usernames []string, passwords []string, timeout int, sleep int, retries int, successfulOnly bool, stopFirstSuccess bool) (*bruteforcefern.BruteForceRunConfig, error)
func LoadTLSConfig ¶ added in v0.0.19
func LoadTLSConfig(targets []string, timeout int, insecure bool) serviceFern.ServiceTlsConfig
Types ¶
type NetworkScan ¶
type NetworkScan struct {
Version string
RootFlags config.RootFlags
OutputConfig writer.OutputConfig
OutputSignal signal.Signal
RootCmd *cobra.Command
}
NetworkScan is the main struct for the networkscan CLI that holds the root command and all subcommands used throughout execution of the CLI. It is also responsible for holding the Output configuration and the Output signal that is used by subcommands. The Output Signal is used to write the output of the command to the desired output format after the execution of the invoked command's Run function.
func NewNetworkScan ¶
func NewNetworkScan(version string) *NetworkScan
NewNetworkScan creates a new NetworkScan struct with the provided version string. The NetworkScan struct is used to hold the root command and all subcommands used throughout execution of the CLI. We pass the version command here from the main.go file, where we set the version string during the build process.
func (*NetworkScan) InitHostCommand ¶ added in v0.0.3
func (a *NetworkScan) InitHostCommand()
InitHostCommand initializes the host command for the networkscan CLI. It also sets up the flags for the host command and its subcommands.
func (*NetworkScan) InitPortCommand ¶ added in v0.0.3
func (a *NetworkScan) InitPortCommand()
InitPortCommand initializes the port command for the networkscan CLI. It also sets up the flags for the port command and its subcommands.
func (*NetworkScan) InitRootCommand ¶
func (a *NetworkScan) InitRootCommand()
InitRootCommand initializes the root command for the networkscan CLI. This function sets up the root command and version command for the CLI. It also sets up the persistent flags for the root command, such as the log level, output format, and output file. Critically, this sets the PersistentPreRunE and PersistentPostRunE functions that are inherited by all subcommands. The PersistentPreRunE function is used to validate the output flags. The PersistentPostRunE function is used to write the output of the command to the desired output format after the execution of the invoked command's Run function.
func (*NetworkScan) InitServiceCommand ¶ added in v0.0.29
func (a *NetworkScan) InitServiceCommand()
InitServiceCommand initializes the service command for the networkscan CLI. It also sets up the flags for the service command and its subcommands.