airbus-cert/vbSparkle

[Suggestion] var names

syndrome5 opened this issue · 2 comments

Hello,

Congratulations for this work. I'll try this tool to the future Vb codes I receive from our kind adversaries.

A suggestion about the variable names. Because I see on your web version that variable like "JDoosP683hfbelbx" are still the same names on the output. I would agree if you say that it is not the main goal of vbSparkle. But I think it would be very interesting to create shorter names to improve visibility of the code.

What do you think ?

Regards

Thanks for this suggestion, indeed I plan to add options such as automatic renaming of variable names, configurable via patterns and customizable naming convention.

I have made some progress on these days.

Currently only available on my own fork (https://github.com/sbruyere/vbSparkle), I've added an option class that allows you to customize the behavior of vbSparkle.

These options are:

  • indentation (default is 4 spaces)
  • renaming of symbols (default None)
  • dead code treatment (default is Comment)

Basically, here is how to declare these options:

var result = VbPartialEvaluator.PrettifyEncoded(content, new EvaluatorOptions()
{
    SymbolRenamingMode = SymbolRenamingMode.None,
    JunkCodeProcessingMode = JunkCodeProcessingMode.Remove,
    IndentSpacing = 4,
});

Also, the currently available options for SymbolRenamingMode are :

[Flags]
public enum SymbolRenamingMode
{
    None,
    Variables,
    Constants,
    All = Variables | Constants
}

The variable renaming is very basic (like var_{idx}), support variable & constants, does not support scope-oriented renaming.

The whole is functional and I'll continue improving it. It'll be PR(ed) very soon to the AirbusCERT repository.