Fix VERBOSE flag ignored when set before module load#21105
Open
SilentSobs wants to merge 1 commit intorapid7:masterfrom
Open
Fix VERBOSE flag ignored when set before module load#21105SilentSobs wants to merge 1 commit intorapid7:masterfrom
SilentSobs wants to merge 1 commit intorapid7:masterfrom
Conversation
When 'set VERBOSE false' is called before 'use <module>', the value is stored in the framework datastore as a raw string 'false' without going through OptBool#normalize. Ruby treats non-empty strings as truthy, so the verbose condition evaluated 'false' (string) as true. Fix by using .to_s =~ TRUE_REGEX for both module and framework datastore lookups, consistent with how OptBool normalizes boolean values.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #21099
When
set VERBOSE falseis called beforeuse <module>, the value is stored in the framework datastore as a raw string"false"without going throughOptBool#normalize. Ruby treats non-empty strings as truthy, so the verbose condition evaluated"false"(string) astrue, causing verbose output to always appear regardless of the flag.Fix by using
.to_s =~ TRUE_REGEXfor both module and framework datastore lookups, consistent with howOptBoolnormalizes boolean values.Verification
msfconsoleset VERBOSE falsesetg RHOSTS <target>use auxiliary/scanner/smtp/smtp_enumset USER_FILE user.txtrunset VERBOSE truebeforeuseset VERBOSEat all