-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathvbs_obfuscator.vbs
48 lines (43 loc) · 1.09 KB
/
vbs_obfuscator.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
' https://isvbscriptdead.com/vbs-obfuscator/
Option Explicit
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
If WScript.Arguments.Count = 0 Then
WScript.Echo "Missing parameter(s): VBScript source file(s)"
WScript.Quit
End If
Dim fso, i
Const ForReading = 1
Set fso = CreateObject("Scripting.FileSystemObject")
For i = 0 To WScript.Arguments.Count - 1
Dim FileName
FileName = WScript.Arguments(i)
Dim MyFile
Set MyFile = fso.OpenTextFile(FileName, ForReading)
Dim vbs
vbs = MyFile.ReadAll
WScript.Echo Obfuscator(vbs)
MyFile.Close
Next
Set fso = Nothing