VBS Plus decrypt for MS Script Encode_vbs

Source: Internet
Author: User
Tags chaine chr decrypt

First, encryption

Copy Code code as follows:

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 = Ob Jectfso.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

Second, decryption

Copy Code code as follows:

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
Todo
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 is decoded to a ' > '
Tdecode (=left) (Tdecode (1) & ")" & Right (Tdecode (42), 1)
Set se=nothing
Chaine=replace (Replace (Chaine, "@&", Chr ()), "@#", 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 +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



Original: http://www.enun.net/?p=866

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.