How to implement encryption / decryption with VBS script
This article mainly shows you "how to encrypt/decrypt VBS scripts". The content is simple and easy to understand, and the organization is clear. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn this article "how to encrypt/decrypt VBS scripts".
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="scrap iron" QQ="QQ: 415736" Email="Email: 415736@163.com" InsTitle=" Encrypt/Decrypt VBS Script (Easy Kill Free Version)"&Ver InsAnswer=" Encrypt/Decrypt VBS Script (Easy Kill Free Version)"&Ver RegPath2="HKEY_CLASSES_ROOT\vbsfile\shell\EnCode_VBS\" RegValue1=" Encrypt/Decrypt VBS Script (Easy Kill Free Version)" Decryption VBS script "&Ver RegForm1="REG_SZ" RegPath3="HKEY_CLASSES_ROOT\vbsfile\shell\EnCode_VBS\command\" RegValue2="wscript.exe " & 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("Yes" adds "+ InsAnswer +""to the right-click menu,"&Chr (10)&Chr (10)&"No removes"+ InsAnswer +"" from the right-click menu. ", vbQuestion + vbYesNoCancel, " Install- "+ 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 _ "Add script file: "+chr(10)+InsFullName+chr (10)+ _ "Add registry key: "+chr(10)+chr(34)+ RegPath2 +chr(34)+chr (10)+ _ chr(10) & CloseTime & " This window will automatically close in seconds! " +chr(10)+chr(10)+ _ chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _ , CloseTime, " Installation successful- "+ InsTitle +" - "+ Copyright, 0 + 64 end if If intAnswer = vbNo Then WshSHell.RegDelete RegPath4 WshSHell.RegDelete RegPath3 WshSHell. RegDelete RegPath2 FSO.DeleteFile InsFullName WshSHell.popup _ "Delete script file: "+chr(10)+InsFullName+chr (10)+chr (10)+ _ "Delete registry key: "+chr(10)+chr(34)+ RegPath2 +chr (34)+chr (10)+ _ chr(10) & CloseTime & "This window will close automatically in seconds! " +chr(10)+chr(10)+ _ chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _ , CloseTime, " Unloading Success- "+ 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 TempNum109 and TempNum47 and TempNum52 and TempNum