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 ¶
This section is empty.
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) InitDiscoverCommand ¶ added in v0.0.30
func (a *NetworkScan) InitDiscoverCommand()
InitDiscoverCommand initializes the discover command and its subcommands (host, os, port, service, tls). Each subcommand implements a specific network discovery functionality.
func (*NetworkScan) InitEnumerateCommand ¶ added in v0.0.30
func (a *NetworkScan) InitEnumerateCommand()
InitEnumerateCommand initializes the enumerate command and its subcommands (ftp, grpc, smtp, ssh). Each subcommand implements service-specific enumeration functionality for different network protocols.
func (*NetworkScan) InitPentestCommand ¶ added in v0.0.30
func (a *NetworkScan) InitPentestCommand()
InitPentestCommand initializes the pentest 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.