Repository navigation
Conversation
Report ANSI escape sequences (ESC[) found in plain VBA source as suspicious, with display-safe reporting (ESC rendered as text). Sequences found only in deobfuscated content are not reported, matching the existing backspace guard. Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Trim the trailing blank line so the file ends exactly like upstream master. Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
…bfuscated content (issue decalage2#874) Five regression tests: plain-source detection, display-safe keyword (no raw ESC), clean-code negative, and Base64/Hex-deobfuscation negatives matching the backspace guard. Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Author
|
Could a maintainer review this plain-VBA ANSI escape-code detection for #874? Please let me know if the detection approach needs changing or if additional cases are needed before review. Thanks. |
Author
|
One more follow-up on this. Please let me know if there's a preferred next step, or if anything in the change needs rework - glad to iterate. |
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 #874.
What
olevba now reports ANSI escape sequences (
ESC[) found in plain VBA source as suspicious: "May use ANSI escape codes to manipulate console output, which is unusual in VBA code" (newSUSPICIOUS_KEYWORDS_NOREGEXentry).detect_suspicious.ESC[, so a raw ESC character never reaches reports or the console (complements the display-path sanitization from Prevent parsing of escape characters #873).Tests
Five new tests in
tests/olevba/test_ansi_escape.py: plain-source detection, no raw ESC in the reported keyword, clean-code negative, and Base64/Hex deobfuscation negatives.Verification
python -m unittest discover(the CI command): 94 tests, OK, on Python 3.10.12 with pyparsing 2.4.7 (within the declared range>=2.1.0,<4).pylint -E --ignore=thirdparty oletools tests(the CI lint): clean.PyparsingDeprecationWarningoutput trips the strict output assertions, andtest_xlmhits aJSONDecodeError). This change adds none: the failure set is identical with and without the patch.