亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何編寫VBS加解密代碼

發布時間:2021-10-11 23:05:22 來源:億速云 閱讀:175 作者:iii 欄目:開發技術

本篇內容介紹了“如何編寫VBS加解密”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

一、加密

復制代碼 代碼如下:

Dim ObjectFSO

If (lcase(right(wscript.fullname,11))="wscript.exe") Then
 WScript.Quit(0)
End If

If wscript.arguments.count<2 Then
 Wscript.Echo "VBS Code Encoder v1.0 Powered by ENUN. http://www.enun.net/"
 Wscript.Echo "Notes: dFileName Must be '*.vbe'!"
 Wscript.Echo "Usage: cscript.exe //nologo sFileName dFileName"
 Wscript.Echo "   eg: cscript.exe //nologo test.vbs enc.vbe"
 WScript.Quit(0)
End If

sFileName = Wscript.Arguments(0)
dFileName = Wscript.Arguments(1)

Set ObjectFSO = CreateObject("Scripting.FileSystemObject")
Set ReadData = ObjectFSO.OpenTextFile(sFileName, 1)

ObjectFSO.OpenTextFile(dFileName, 8, true).Write(Encoder(ReadData.Readall))

Function Encoder(data)
    Encoder = CreateObject("Scripting.Encoder").EncodeScriptFile(".vbs", data, 0, "VBScript")
End Function

二、解密

復制代碼 代碼如下:

option explicit

Dim oArgs, NomFichier

'Optional argument : the encoded filename

NomFichier=""
Set oArgs = WScript.Arguments
Select Case oArgs.Count

Case 0 'No Arg, popup a dialog box to choose the file
        NomFichier=BrowseForFolder("Choose an encoded file", &H4031, &H0011)
Case 1
        If Instr(oArgs(0),"?")=0 Then '-? ou /? => aide
                NomFichier=oArgs(0)
        End If
Case Else
        WScript.Echo "Too many parameters"
End Select

Set oArgs = Nothing

If NomFichier<>"" Then
        Dim fso
        Set fso=WScript.CreateObject("Scripting.FileSystemObject")
        If fso.FileExists(NomFichier) Then
                Dim fic,contenu
                Set fic = fso.OpenTextFile(NomFichier, 1)
                Contenu=fic.readAll
                fic.close
                Set fic=Nothing
                Const TagInit="#@~^" '#@~^awQAAA==
                Const TagFin="==^#~@" '& chr(0)
                Dim DebutCode, FinCode
                Do
     FinCode=0
     DebutCode=Instr(Contenu,TagInit)
     If DebutCode>0 Then
      If (Instr(DebutCode,Contenu,"==")-DebutCode)=10 Then 'If "==" follows the tag
       FinCode=Instr(DebutCode,Contenu,TagFin)
       If FinCode>0 Then
        Contenu=Left(Contenu,DebutCode-1) & _
        Decode(Mid(Contenu,DebutCode+12,FinCode-DebutCode-12-6)) & _
        Mid(Contenu,FinCode+6)
       End If
      End If
     End If
                Loop Until FinCode=0
                WScript.Echo Contenu
        Else
                WScript.Echo Nomfichier & " not found"
        End If
        Set fso=Nothing

Else
        WScript.Echo "Please give a filename"
        WScript.Echo "Usage : " & wscript.fullname  & " " & WScript.ScriptFullName & " <filename>"

End If
 

Function Decode(Chaine)
        Dim se,i,c,j,index,ChaineTemp
        Dim tDecode(127)
        Const Combinaison="1231232332321323132311233213233211323231311231321323112331123132"
        Set se=WSCript.CreateObject("Scripting.Encoder")
        For i=9 to 127
                tDecode(i)="JLA"
        Next

        For i=9 to 127
                ChaineTemp=Mid(se.EncodeScriptFile(".vbs",string(3,i),0,""),13,3)
                For j=1 to 3
                        c=Asc(Mid(ChaineTemp,j,1))
                        tDecode(c)=Left(tDecode(c),j-1) & chr(i) & Mid(tDecode(c),j+1)
                Next
        Next

        'Next line we correct a bug, otherwise a ")" could be decoded to a ">"
        tDecode(42)=Left(tDecode(42),1) & ")" & Right(tDecode(42),1)
        Set se=Nothing
        Chaine=Replace(Replace(Chaine,"@&",chr(10)),"@#",chr(13))
        Chaine=Replace(Replace(Chaine,"@*",">"),"@!","<")
        Chaine=Replace(Chaine,"@$","@")
        index=-1
        For i=1 to Len(Chaine)
                c=asc(Mid(Chaine,i,1))
                If c<128 Then index=index+1
                If (c=9) or ((c>31) and (c<128)) Then
                        If (c<>60) and (c<>62) and (c<>64) Then
                                Chaine=Left(Chaine,i-1) & Mid(tDecode(c),Mid(Combinaison,(index mod 64)+1,1),1) & Mid(Chaine,i+1)
                        End If
                End If
        Next
        Decode=Chaine
End Function
 

Function BrowseForFolder(ByVal pstrPrompt, ByVal pintBrowseType, ByVal pintLocation)
        Dim ShellObject, pstrTempFolder, x
        Set ShellObject=WScript.CreateObject("Shell.Application")
        On Error Resume Next
        Set pstrTempFolder=ShellObject.BrowseForFolder(&H0,pstrPrompt,pintBrowseType,pintLocation)
        BrowseForFolder=pstrTempFolder.ParentFolder.ParseName(pstrTempFolder.Title).Path
        If Err.Number<>0 Then BrowseForFolder=""
        Set pstrTempFolder=Nothing
        Set ShellObject=Nothing
End Function

“如何編寫VBS加解密”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

vbs
AI

桐城市| 凤翔县| 米林县| 宁化县| 察哈| 新邵县| 阿鲁科尔沁旗| 黑水县| 海丰县| 天镇县| 筠连县| 通道| 奈曼旗| 南丰县| 梁平县| 湟中县| 大埔县| 措勤县| 车险| 高唐县| 泌阳县| 泉州市| 温州市| 兴国县| 扬中市| 江山市| 阿鲁科尔沁旗| 江西省| 海丰县| 抚远县| 凉山| 噶尔县| 永丰县| 陵水| 小金县| 靖安县| 西宁市| 栖霞市| 南投县| 新郑市| 芦山县|