oletools icon indicating copy to clipboard operation
oletools copied to clipboard

add comment delete function

Open Utah1A opened this issue 4 years ago • 2 comments

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.

Utah1A avatar Jul 13 '21 07:07 Utah1A

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...

decalage2 avatar Jul 14 '21 14:07 decalage2

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.

Utah1A avatar Jul 14 '21 15:07 Utah1A