Skip to content

oriolOrnaque/VBAObfuscator

Repository files navigation

VBA Obfuscator

VBA Macro obfuscator

Requires ANTLR4 Runtime library 4.8: https://www.antlr.org/download/antlr-runtime-4.8.jar

Uses ANTLR to parse a VBA file and obtain an Abstract Syntax Tree that describes the program. Then walks the tree and changes nodes acording to certain 'morphs', i.e. randomize variables names, encode literals, add useless code, etc.

Input

Sub Something()

Dim A As Integer
A = 100
MsgBox A

End Sub

Sub MoreSomethingElses()
Dim B As String
B = "Hello world"
MsgBox B
End Sub

Sub SomethingElse()
    Dim A As Boolean
    A = True
End Sub

Output


Sub qxgsimknfa()
Dim hjqdfzxgly as Integer
hjqdfzxgly = 0 - 6254 - 224 - 55 - 62 - 60 - 11 - 2 - 0 - 1
MsgBox hjqdfzxgly
End Sub
Sub gwogeznbid()

Dim hpdqnzwdrc As Integer
hpdqnzwdrc = 0 + 21 + 39 + 32 + 6 + 1 + 0 + 1
MsgBox hpdqnzwdrc

End Sub
Sub zkigfdhxjr()
Dim nidslhsbco as Integer
nidslhsbco = 0 - 2112 - 12060 - 5592 - 758 - 464 - 84 - 2 - 5
MsgBox nidslhsbco
End Sub



Sub vptaksnuca()
Dim tsbfwwtaco as Integer
tsbfwwtaco = 0 + 11147 + 2657 + 4773 + 1746 + 3831 + 832 + 181 + 101 + 13 + 205
MsgBox tsbfwwtaco
End Sub
Sub ffrvhiebgh()
Dim xatbbhvmfa As String
xatbbhvmfa = qakyjxlowy("2248656c6c6f20776f726c6422")
MsgBox xatbbhvmfa
End Sub
Sub aaywxbfilu()
Dim enpatzaeoi as Integer
enpatzaeoi = 0 - 9156 - 1578 - 326 - 27 - 217 - 29 - 40 - 18
MsgBox enpatzaeoi
End Sub
Public Function qakyjxlowy(ByVal luznneuskl As String) As String
Dim sxzbipbglb   As String
Dim eyrgjyayae As String
Dim planxfjawg         As Long
    For planxfjawg = 1 To Len(luznneuskl) Step 2
        sxzbipbglb = Chr$(Val("&H" & Mid$(luznneuskl, planxfjawg, 2)))
        eyrgjyayae = eyrgjyayae & sxzbipbglb
    Next planxfjawg
    qakyjxlowy = eyrgjyayae
End Function




Sub gvixfhkafv()
Dim ulpjmxpgay as Integer
ulpjmxpgay = 0 + 450 + 9291 + 722 + 396 + 50 + 140 + 5 + 0 + 10 + 9 + 1
MsgBox ulpjmxpgay
End Sub
Sub iptcuinysv()
    Dim hzxoexpcqt As Boolean
    hzxoexpcqt = (((((Not (False Xor False)) And ((False Xor False) Or (False Xor False))) Or (((False Xor True) Xor (False And False)) Or ((True And True) Xor (False Or False)))) Or ((((True Xor False) Or (True Or True)) Xor ((False Or True) Xor (True Xor False))) Xor ((Not (True Or False)) And ((Not False) Or (False And True))))) Or ((Not (((Not False) Xor (True Xor True)) Or (Not (False Xor True)))) Xor ((((False Or False) Xor (True And True)) Or ((True Or False) And (True Xor False))) Xor (Not ((False Or False) Or (False And False))))))
End Sub
Sub dnmnvsxbhl()
Dim lesrscgots as Integer
lesrscgots = 0 + 15555 + 1632 + 1489 + 2269 + 396 + 703 + 391 + 103 + 11 + 1 + 0 + 1 + 0 + 0 + 1
MsgBox lesrscgots
End Sub