Add conditional option validation depending on SESSION/RHOST connection #18875
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.
The new session types allows certain modules to connect over either
RHOST
or an existingSESSION
but this meant when normally theRHOST
option was required the be set that could no longer be the case leading to a compromised user experience since we were no longer communicating which options needed to be setThis PR resolves that by adding conditional validation of options depending on the chosen connection type so for example if you want to connect via
RHOST
we also check (where applicable) thatRPORT
or theUSERNAME
is set. Then when a connection is made over an existingSESSION
we can still allow the user to only setSESSION
and not worry about the missing values only required for a newRHOST
connectionValidation Steps
SESSION
is set no option related toRHOST
are forced to be setSESSION
doesn't need to be set when connecting viaRHOST
RHOST
and RPORT/USERNAME/etc aren't set the user is notified of all missing required optionsSESSION
norRHOST
is set there is a warning telling the user thisNote: Some options can be an empty string so if you
unset OPTION
and don't get the expected outcome you may need to doset --clear OPTION