add option to stop scanning host after first successful protocol (#242)

This commit is contained in:
Meteorite 2020-02-04 03:45:08 +03:00 committed by GitHub
parent d9885ed26c
commit c3ef8dcd8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 0 deletions

View File

@ -46,6 +46,7 @@ func SetOutputFunc(f OutputResultsFunc) {
func init() {
config.Multiple.ContinueOnError = true // set default for multiple value
config.Multiple.BreakOnSuccess = false // set default for multiple value
}
var config Config

View File

@ -6,6 +6,7 @@ import "errors"
type MultipleCommand struct {
ConfigFileName string `short:"c" long:"config-file" default:"-" description:"Config filename, use - for stdin"`
ContinueOnError bool `long:"continue-on-error" description:"If proceeding protocols error, do not run following protocols (default: true)"`
BreakOnSuccess bool `long:"break-on-success" description:"If proceeding protocols succeed, do not run following protocols (default: false)"`
}
// Validate the options sent to MultipleCommand

View File

@ -135,6 +135,9 @@ func grabTarget(input ScanTarget, m *Monitor) []byte {
if res.Error != nil && !config.Multiple.ContinueOnError {
break
}
if res.Status == SCAN_SUCCESS && config.Multiple.BreakOnSuccess {
break
}
}
var ipstr string