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

Obfuscating Strings that are the same as Sub Names #8

Open
FiSHonAUT opened this issue Dec 30, 2022 · 1 comment
Open

Obfuscating Strings that are the same as Sub Names #8

FiSHonAUT opened this issue Dec 30, 2022 · 1 comment

Comments

@FiSHonAUT
Copy link

FiSHonAUT commented Dec 30, 2022

Example:

Private Sub Login()
Dim s as String
    s = "Login"
End Sub

The obfuscator changes both Logins:

Private Sub o10101010101()
Dim s as String
    s = "o10101010101"
End Sub

It is because of this Pattern in your code:
sPattern = "([\*\.\^\*\+\#\(\)\-\=\/\,\:\;\s\" & VBA.Chr$(34) & "])" & sFinde & "([\*\.\^\*\+\!\@\#\$\%\&\(\)\-\=\/\,\:\;\s\" & VBA.Chr$(34) & "]|$)"
Why exactly is there this VBA.Chr$(34)? Because of that Strings get obfuscated.

@FiSHonAUT
Copy link
Author

FiSHonAUT commented Jan 2, 2023

I worked on the problem and I think I found a nice solution for this problem. I changed the pattern to

sPattern = "([\*\.\^\*\+\#\(\)\-\=\/\,\:\;\s\""])" & _
           "(" & sFinde & "(?=([^""]*""[^""]*"")*[^""]*$))" & _
           "(?=([\*\.\^\*\+\!\@\#\$\%\&\(\)\-\=\/\,\:\;\s\""]|$))"

With (?=([^"]*"[^"]*")*[^"]*$) you exclude EVERYTHING inside of quotes.
Of course, the Regex-Line also has to be changed to
sCode = RegExpFindReplace(sCode, sPattern, "$1" & sReplace)

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

1 participant