当前位置: 首页 > 图文教程 > 脚本技术 > VBScript > vbs版的解密base64加密的脚本

VBScript
VBS的各种应用的比较实用小代码
用VBS调用程序并对程序的运行情况进行监控的两个代码
禁止QQ上网的vbs代码
一个收集的下载木马并运行的VBS代码
可以将文件转换为vbs语句的vbs代码
收藏的比较精典VBS代码
好玩的vbs特色代码vbs栈类
使用VBScript 中的类组织开发
防SQL注入的VBSrcipt代码
用VBSrcipt判断是否是日期
Stream、WshShell、WshUrlShortcut对象及Shell.Application的参数与使用
用vbs模拟的一个asp的分页显示功能
本地连接禁用/启用批处理脚本
右键发送(sendto),创建快捷方式到自定义的位置 的vbs
WINDOWS脚本实践:为SAP补丁制作的VBS脚本代码
Adsutil.vbs 在脚本攻击中的妙用[我非我原创]
用VBS修改IIS Metabase 的代码
用VBS实现脚本结束进程与防止进程启动
用vbs实现在启动 Windows 资源管理器时打开特定文件夹
用vbs实现的确定共享文件夹的本地路径?

VBScript 中的 vbs版的解密base64加密的脚本


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 90 ::
收藏到网摘: n/a

复制代码 代码如下:

Function fDecode(sStringToDecode)
'This function will decode a Base64 encoded string and returns the decoded string.
'This becomes usefull when attempting to hide passwords from prying eyes.
Const CharList = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Dim iDataLength, sOutputString, iGroupInitialCharacter
sStringToDecode = Replace(Replace(Replace(sStringToDecode, vbCrLf, ""), vbTab, ""), " ", "")
iDataLength = Len(sStringToDecode)
If iDataLength Mod 4 <> 0 Then
fDecode = "Bad string passed to fDecode() function."
Exit Function
End If
For iGroupInitialCharacter = 1 To iDataLength Step 4
Dim iDataByteCount, iCharacterCounter, sCharacter, iData, iGroup, sPreliminaryOutString
iDataByteCount = 3
iGroup = 0
For iCharacterCounter = 0 To 3
sCharacter = Mid(sStringToDecode, iGroupInitialCharacter + iCharacterCounter, 1)
If sCharacter = "=" Then
iDataByteCount = iDataByteCount - 1
iData = 0
Else
iData = InStr(1, CharList, sCharacter, 0) - 1
If iData = -1 Then
fDecode = "Bad string passed to fDecode() function."
Exit Function
End If
End If
iGroup = 64 * iGroup + iData
Next
iGroup = Hex(iGroup)
iGroup = String(6 - Len(iGroup), "0") & iGroup
sPreliminaryOutString = Chr(CByte("&H" & Mid(iGroup, 1, 2))) & Chr(CByte("&H" & Mid(iGroup, 3, 2))) & Chr(CByte("&H" & Mid(iGroup, 5, 2)))
sOutputString = sOutputString & Left(sPreliminaryOutString, iDataByteCount)
Next
fDecode = sOutputString
End Function