Allow scanner modules to skip hosts on fail_with #14048
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm not sure if this is a bug or simply a feature gap, but either way scanner modules who have a
run_host
method defined can not utilize thefail_with
pattern of exiting out. This is becausefail_with
raises aMsf::Auxiliary::Failed
exception which isn't ignored on a per-host basis. I would think that withinrun_host
we'd want failures to simply cause the processing of that one host to be aborted and not the entire range that the user specified. This would also allow scanner modules to invoke mixin methods that usefail_with
without breaking.I would assume that
fail_with
instances that should cause the entire module to be aborted (likeFailure::BadConfig
) would be placed in the top levelrun
method before callingsuper
to invoke the scan logic. I can't seem to find an instance of any scanners doing this though.I updated the Jupyter Login module as a contrived example to show that if it fails to identify the remote server, it'll
fail_with
an appropriate reason and the scanner will move on. This behavior came up while working with the contributor on #13906 (see their comment).Verification
msfconsole
use auxiliary/scanner/http/jupyter_login
set RHOSTS
to some Class-C