VBScript Obfuscator in VBScript

in utopian-io •  7 years ago  (edited)

This is the VBScript Obfuscator written in VBScript. You can obfuscate your VBS source file easily with this command line utility.

Github: https://github.com/DoctorLai/VBScript_Obfuscator

How does it work?

The obfuscator will parse each character of your VBS file, and obfuscate it via a random character. The source code is thus obfuscated with concatenation of these characters.

The obfuscated source can be run with the VBScript function Execute but the source code looks pretty obfuscated.

Function vbs_obfuscator(n)
    Dim r, k
    r = Round(Rnd() * 10000) + 1
    k = Round(Rnd() * 2) + 1
    Select Case k
        Case 0
            vbs_obfuscator = "CLng(&H" & Hex(r + n) & ")-" & r
        Case 1
            vbs_obfuscator = (n - r) & "+CLng(&H" & Hex(r) & ")"
        Case Else
            vbs_obfuscator = (n * r) & "/CLng(&H" & Hex(r) & ")"
    End Select          
End Function
Function Obfuscator(vbs)
    Dim length, s, i
    length = Len(vbs)
    s = ""
    For i = 1 To length
        s = s & "chr(" & vbs_obfuscator(Asc(Mid(vbs, i))) + ")&"
    Next
    s = s & "vbCrlf"
    Obfuscator = "Execute " & s
End Function

Passing multiple filenames

You can pass multiple VBScript file names at command line, and the obfuscator will obfuscate each source and print the obfuscated string one by one to the console.

You can also redirect the console to save to new vbs via cscript.exe vbs_obfuscator.vbs sample.vbs > sample_obfuscated.vbs

Proof of work

doctorlai is my github ID and you can view my profile https://github.com/DoctorLai which has my steemit URL page.



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

Nice work, do you plan on adding more complex obfuscation steps? You could probably do a character map and reference the characters in complicated ways.

You can contact us on Discord.
[utopian-moderator]

  ·  7 years ago 

Thanks. Yes. I plan to add the defuscation first...

赞。虽然我看不太懂,但感觉很流壁…

  ·  7 years ago 

其实没有什么技术含量。隔行如隔山……

38F7EDE2-0265-475F-B966-0B127394158C.jpeg
不知道为什么,就想发这个给你看看哈哈

  ·  7 years ago 

哇哈哈, 妹子你太逗了。

我也觉得很流壁😂

Obfuscator 是什么?

  ·  7 years ago 

混淆

用来干嘛的呢?

  ·  7 years ago 

比如 C# 或者 JAVA 编译出的文件其实都可以反汇编成原代码,这时候把源代码搞乱又不影响运行就是一种比较好的保护代码的方式。

Hey @justyy I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x