這篇文章主要為大家展示了“VBS腳本如何實(shí)現(xiàn)加密/解密”,內(nèi)容簡(jiǎn)而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“VBS腳本如何實(shí)現(xiàn)加密/解密”這篇文章吧。
創(chuàng)新互聯(lián)建站堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都做網(wǎng)站、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿(mǎn)足客戶(hù)于互聯(lián)網(wǎng)時(shí)代的清原網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!Dim WshSHell,FSO On Error Resume Next Set WshSHell = WScript.CreateObject("WScript.Shell") Set FSO = CreateObject("Scripting.FileSystemObject") Set Args = WScript.Arguments Ver="1.1" CloseTime = 5 FileName = WScript.ScriptName FileFullName = WScript.ScriptFullName FilePath = FSO.GetParentFolderName(FileFullName) InsPath = FSO.GetSpecialFolder(1) InsFullName = FSO.BuildPath(InsPath ,FileName) Copyright="廢鐵" QQ="QQ:415736" Email="Email:415736@163.com" InsTitle="加密/解密VBS腳本(簡(jiǎn)易免殺版)"&Ver InsAnswer="加密/解密VBS腳本(簡(jiǎn)易免殺版)"&Ver RegPath2="HKEY_CLASSES_ROOT\vbsfile\shell\EnCode_VBS\" RegValue1="加密/解密VBS腳本"&Ver RegForm1="REG_SZ" RegPath3="HKEY_CLASSES_ROOT\vbsfile\shell\EnCode_VBS\command\" RegValue2="wscript.exe " & chr(34) & InsFullName & chr(34) & " " & chr(34) & "%L" & chr(34) RegPath4="HKEY_CLASSES_ROOT\vbsfile\shell\EnCode_VBS\EnCode_Very" RegValue3="0" RegValue4="1" IF FileFullName <> InsFullName then intAnswer = MsgBox("【是】將“"+ InsAnswer +"”加入到右鍵菜單,"&Chr(10)&Chr(10)&"【否】將“ "+ InsAnswer +"”從右鍵菜單刪除。 ", vbQuestion + vbYesNoCancel, "安裝 - "+ InsTitle +" - "+ Copyright) If intAnswer = vbYes Then WshSHell.RegWrite RegPath2,RegValue1,RegForm1 WshSHell.RegWrite RegPath3,RegValue2,RegForm1 WshSHell.RegWrite RegPath4,RegValue4,RegForm1 FSO.GetFile(FileFullName).Copy(InsFullName) WshSHell.popup _ "添加腳本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _ "添加注冊(cè)表項(xiàng):"+chr(10)+chr(34)+ RegPath2 +chr(34)+chr(10)+ _ chr(10) & CloseTime & " 秒鐘后本窗口將自動(dòng)關(guān)閉!" +chr(10)+chr(10)+ _ chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _ , CloseTime, "安裝成功 - "+ InsTitle +" - "+ Copyright, 0 + 64 end if If intAnswer = vbNo Then WshSHell.RegDelete RegPath4 WshSHell.RegDelete RegPath3 WshSHell.RegDelete RegPath2 FSO.DeleteFile InsFullName WshSHell.popup _ "刪除腳本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _ "刪除注冊(cè)表項(xiàng):"+chr(10)+chr(34)+ RegPath2 +chr(34)+chr(10)+ _ chr(10) & CloseTime & " 秒鐘后本窗口將自動(dòng)關(guān)閉!" +chr(10)+chr(10)+ _ chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _ , CloseTime, "卸載成功 - "+ InsTitle +" - "+ Copyright, 0 + 64 end if ELSE Package = WScript.Arguments.Item(0) PkgName=FSO.GetBaseName(Package) PkgPath=FSO.GetParentFolderName(Package) Set ReadFile = FSO.OpenTextFile(Package, 1) ReadAllTextFile=ReadFile.ReadAll if left(ReadAllTextFile,10)<>"Rem EnCode" then EnCodePanDuan="Rem EnCode-Easy By QQ:415736" CodeString=ReadAllTextFile For i=1 To Len(CodeString) TempNum = Asc(Mid(CodeString,i,1)) If TempNum = 13 Then TempNum = 28 ElseIf TempNum = 10 Then TempNum = 29 elseif TempNum=34 Then TempNum = 18 elseif TempNum>96 and TempNum<110 then TempNum=TempNum+13 elseif TempNum>109 and TempNum<123 then TempNum=TempNum-13 elseif TempNum>47 and TempNum<53 then TempNum=TempNum+5 elseif TempNum>52 and TempNum<58 then TempNum=TempNum-5 End If ThisText = ThisText & chr(TempNum) Next Call EnCodeFile Else Call UnCodeFile end if End if Set WshSHell = Nothing Set FSO = Nothing Set Args = Nothing WScript.Quit(0) Sub EnCodeFile() Set NewFile = FSO.CreateTextFile(FSO.BuildPath(PkgPath ,PkgName&"_Encode.VBS"), True) NewFile.WriteLine(EnCodePanDuan) NewFile.WriteLine("ExeString="&chr(34)&ThisText&chr(34)) NewFile.WriteLine("Execute("&chr(34)&"For i=1 To Len(ExeString)"&chr(34)&"&vbCrLf&"&chr(34) &"TempNum = Asc(Mid(ExeString,i,1))"&chr(34)&"&vbCrLf&"&chr(34)&"If TempNum = 28 Then"&chr (34)&"&vbCrLf&"&chr(34)&"TempNum = 13"&chr(34)&"&vbCrLf&"&chr(34)&"ElseIf TempNum = 29 Then"&chr(34)&"&vbCrLf&"&chr(34)&"TempNum = 10"&chr(34)&"&vbCrLf&"&chr(34)&"elseif TempNum=18 Then"&chr(34)&"&vbCrLf&"&chr(34)&"TempNum = 34"&chr(34)&"&vbCrLf&"&chr(34) &"elseif TempNum>96 and TempNum<110 then"&chr(34)&"&vbCrLf&"&chr(34) &"TempNum=TempNum+13"&chr(34)&"&vbCrLf&"&chr(34)&"elseif TempNum>109 and TempNum<123 then"&chr(34)&"&vbCrLf&"&chr(34)&"TempNum=TempNum-13"&chr(34)&"&vbCrLf&"&chr(34)&"elseif TempNum>47 and TempNum<53 then"&chr(34)&"&vbCrLf&"&chr(34)&"TempNum=TempNum+5"&chr(34) &"&vbCrLf&"&chr(34)&"elseif TempNum>52 and TempNum<58 then"&chr(34)&"&vbCrLf&"&chr(34) &"TempNum=TempNum-5"&chr(34)&"&vbCrLf&"&chr(34)&"End If"&chr(34)&"&vbCrLf&"&chr(34) &"ThisText = ThisText & chr(TempNum)"&chr(34)&"&vbCrLf&"&chr(34)&"Next"&chr(34)&")") NewFile.WriteLine("Execute(ThisText)") NewFile.Close WshShell.popup chr(10) &_ "加密成功了!保存為文件:"+ chr(10) &chr(10) & _ FSO.BuildPath(PkgPath ,PkgName&"_Encode.VBS")+chr(10)+chr(10)+ _ chr(10) & CloseTime & " 秒鐘后本窗口將自動(dòng)關(guān)閉!" +chr(10)+chr(10)+ _ chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _ , CloseTime, EnCodePanDuan +" - "+ Copyright, 0 + 64 End Sub Sub UnCodeFile() Set ReadFile = FSO.OpenTextFile(Package, 1) ReadLineTextFile1=ReadFile.ReadLine ReadLineTextFile2=ReadFile.ReadLine ReadLineTextFile3=ReadFile.ReadLine ReadFile.Close Set NewFile = FSO.CreateTextFile(FSO.BuildPath(PkgPath ,PkgName&"_Uncode.VBS"), True) NewFile.WriteLine(ReadLineTextFile2) NewFile.WriteLine(ReadLineTextFile3) NewFile.WriteLine("EnCodePanDuan="&chr(34)&ReadLineTextFile1&chr(34)&vbCrLf&"EnCodePD="&chr (34)&"Rem EnCode-Very By QQ:415736"&chr(34)&vbCrLf&"For i=1 To Len (ThisText)"&vbCrLf&"TempNum = Asc(Mid(ThisText,i,1))"&vbCrLf&"TempChar = Chr (TempNum)"&vbCrLf&"if EnCodePanDuan=EnCodePD then"&vbCrLf&"If TempChar = Chr(58) Then"&vbCrLf&"TempChar = Chr(13)"&vbCrLf&"End If"&vbCrLf&"End If"&vbCrLf&"ThisTextTem = ThisTextTem & TempChar"&vbCrLf&"Next") NewFile.WriteLine("strCode = (ThisTextTem)"&vbCrLf&"Set WshSHell = WScript.CreateObject ("&chr(34)&"WScript.Shell"&chr(34)&")"&vbCrLf&"Set FSO = CreateObject("&chr(34) &"Scripting.filesystemobject"&chr(34)&")"&vbCrLf&"FileName = WScript.ScriptName"&vbCrLf&"Set fC = FSO.OpenTextFile(FileName, 2, true)"&vbCrLf&"fC.Write strCode"&vbCrLf&"fC.Close"&vbCrLf&"Set WshSHell = Nothing"&vbCrLf&"Set FSO = Nothing"&vbCrLf&"WScript.Quit(0)") NewFile.Close WScript.Sleep 1500 WshSHell.Run (chr(34)&FSO.BuildPath(PkgPath ,PkgName&"_Uncode.VBS")&chr(34)), vbHide WshShell.popup chr(10) &_ "解密成功了!保存為文件:"+ chr(10) &chr(10) & _ FSO.BuildPath(PkgPath ,PkgName&"_Uncode.VBS")+chr(10)+chr(10)+ _ chr(10) & CloseTime & " 秒鐘后本窗口將自動(dòng)關(guān)閉!" +chr(10)+chr(10)+ _ chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _ , CloseTime, "解密成功 - "+ InsTitle +" - "+ Copyright, 0 + 64 End Sub
以上是“VBS腳本如何實(shí)現(xiàn)加密/解密”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!