-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathvbs_rot47_obfuscator.vbs
49 lines (44 loc) · 1.16 KB
/
vbs_rot47_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
49
' https://isvbscriptdead.com/vbs-obfuscator/
Option Explicit
Function Rot47(str)
Dim i, j, k, r
j = Len(str)
r = ""
For i = 1 to j
k = Asc(Mid(str, i, 1))
If k >= 33 And k <= 126 Then
r = r & Chr(33 + ((k + 14) Mod 94))
Else
r = r & Chr(k)
End If
Next
Rot47 = r
End Function
Function Obfuscator(vbs)
Dim length, s, i, F
F = "Function l(str):Dim i,j,k,r:j=Len(str):r=" & Chr(34) & Chr(34) & ":For i=1 to j:k=Asc(Mid(str,i,1)):If k>=33 And k<=126 Then:r=r&Chr(33+((k+14)Mod 94)):Else:r=r&Chr(k):End If:Next:l=r:End Function"
length = Len(vbs)
s = ""
For i = 1 To length
s = s & Rot47(Mid(vbs, i, 1))
Next
Obfuscator = F & vbCrlf & "Execute l(" & Chr(34) & (s)& Chr(34) &")" & vbCrLf
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