Documentation ¶
Index ¶
- type CommandMaker
- type CommandRunner
- type Component
- type Config
- type ExecCmd
- type ExecMaker
- type LoggingCmd
- type LoggingMaker
- type NMAP
- func (s *NMAP) Scan(ctx context.Context, host string) ([]domain.Finding, error)
- func (s *NMAP) ScanWithScripts(ctx context.Context, scripts []string, scriptArgs []string, host string) ([]domain.Finding, error)
- func (s *NMAP) WithScriptArgs(args []string) *NMAP
- func (s *NMAP) WithScripts(scripts []string) *NMAP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandMaker ¶
type CommandMaker interface {
MakeCommand(ctx context.Context, cmd string, args ...string) CommandRunner
}
CommandMaker is a stand-in for creating and instance of exec.Cmd directly.
type CommandRunner ¶
CommandRunner is a stand-in for calling cmd.Run() while also capturing input.
type Component ¶
Component loads a Scanner.
func NewComponent ¶
NewComponent populates the defaults.
type Config ¶
type Config struct { BinPath string `description:"Nmap binary path to execute."` BinArgs []string `description:"Nmap flags to pass to the binary. Note that -sV and -oX are always passed."` Scripts []string `description:"Nmap scripts to execute. Paths must be relative to the nmap script root."` ScriptArgs []string `description:"Any script arguments to inject. Form of argname='argvalue'"` }
Config contains options for the Scanner.
type ExecMaker ¶
type ExecMaker struct{}
ExecMaker implements the CommandMaker using exec.Cmd.
func (*ExecMaker) MakeCommand ¶
MakeCommand generates a CommandRunner implemented by ExecCmd.
type LoggingCmd ¶
type LoggingCmd struct { LogFn domain.LogFn Ctx context.Context CommandRunner CommandRunner Cmd string Args []string }
LoggingCmd emits debug logs when a command is issued.
func (*LoggingCmd) RunCommand ¶
RunCommand captures the shell output.
type LoggingMaker ¶
type LoggingMaker struct { LogFn domain.LogFn CommandMaker CommandMaker }
LoggingMaker wraps a CommandMaker in order to provide debug logging of shell commands.
func (*LoggingMaker) MakeCommand ¶
func (m *LoggingMaker) MakeCommand(ctx context.Context, cmd string, args ...string) CommandRunner
MakeCommand wraps the output of the nested maker with logging.
type NMAP ¶
type NMAP struct { BinPath string BinArgs []string Scripts []string ScriptArgs []string CommandStrings []string CommandMaker CommandMaker }
NMAP implements the scanner interface by making a subprocess call to nmap.
func (*NMAP) ScanWithScripts ¶
func (s *NMAP) ScanWithScripts(ctx context.Context, scripts []string, scriptArgs []string, host string) ([]domain.Finding, error)
ScanWithScripts overrides the default script and script arguments.
func (*NMAP) WithScriptArgs ¶
WithScriptArgs overrides the active scripts arguments for a scan.
func (*NMAP) WithScripts ¶
WithScripts overrides the active scripts for a scan.