Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add comment delete function #702

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Utah1A
Copy link

@Utah1A Utah1A commented Jul 13, 2021

I find that your vba_code initialisation module does not do what it should do with comments, which makes it easy to treat text content as code and is highly prone to false positives.

So I add a module in oletools/olevba.py to delete the comments in vba_code.

@decalage2 decalage2 self-requested a review July 14, 2021 13:58
@decalage2 decalage2 self-assigned this Jul 14, 2021
@decalage2 decalage2 added this to the Next Release milestone Jul 14, 2021
@decalage2
Copy link
Owner

Hi @Yu-tu, thank you for the proposal. I think it should be an option for the caller to decide if comments are kept or removed. Most of the time, I prefer to keep the full source code.
Another solution would be to just provide a function to remove comments (as you did), without calling it every time in olevba. Then it would be up to the application to call it or not after it gets the VBA code, if it's better to remove comments.
Also I see that you process each line, character by character. It would be much faster to use string functions to split on the first occurence of '. But it's not so straightforward. You can have ' within VBA strings, in that case you need to ignore them...

@Utah1A
Copy link
Author

Utah1A commented Jul 14, 2021

Thank you for your adoption, I am a beginner, may not have a good code specification, but I think this will be more time complexity than split and get position 0 lol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants