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

[Suggestion] var names #1

Open
syndrome5 opened this issue Jan 2, 2023 · 2 comments
Open

[Suggestion] var names #1

syndrome5 opened this issue Jan 2, 2023 · 2 comments

Comments

@syndrome5
Copy link

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

@sbruyere
Copy link
Contributor

sbruyere commented Jan 3, 2023

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

@sbruyere
Copy link
Contributor

sbruyere commented Jan 6, 2023

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.

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

No branches or pull requests

2 participants