Add easier way to delete host tags #16833
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.
Currently the only way to delete a host tag is to do this odd syntax:
Note that the documentation for the
hosts
command makes it so that it seems like the-d
and-t
options are the own options and should not be combined as the-d
option should just delete the host itself:However in the code it seems like we have this odd switch whereby if you specify the
-d
and-t
options and also specify the parameters to them correctly, _defying the documentation, only then is it possible to delete the host tags. Considering this is completely against good practice and basically falls into the realm of undocumented behavior, I decided to fix this.The new option
-T
will act like-t
however it will delete the tag instead of adding it. It performs the same operations that were being done before but exposes it via a proper option with associated documentation.Spec files have not yet been added but will be soon.
Verification
List the steps needed to make sure this thing works
msfconsole
hosts -a 127.0.0.1
hosts -t test 127.0.0.1
hosts -c address,tags 127.0.0.1
hosts -T test 127.0.0.1
hosts
hosts --help