VBE decoder

所属分类: 脚本专栏 / vbs 阅读数: 1699
收藏 0 赞 0 分享

This script give you a decoded listing from an encoded file.
Supports *,je, ,vbe, .asp, .hta, .htm, .html…
If used under cscript, puts the result to stdout.
The file can be multi-encoded (many scripts in the file, for ex. in an html file)
Used under wscript, pops up the decoded file in a message box.

File Name : decovbe.vbs
Requirement : none
Author : Jean-Luc Antoine
Submitted : 05/09/2001
Updated : 09/12/2001
Category : 4K

复制代码 代码如下:

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



原文: http://www.interclasse.com/scripts/decovbe.php

更多精彩内容其他人还在看

ADOX.Catalog中文帮助详细说明chm文档第1/3页

这个是用来操作ACCESS数据库的东西,遍历表,遍历表的所有字段及字段的属性都会用到这个
收藏 0 赞 0 分享

VBS脚本使用WMI操作注册表的代码第1/2页

VBS脚本使用WMI操作注册表,从微软弄下来的,整理了一下,弄成最简版,简版,常用版,以便与快速查找
收藏 0 赞 0 分享

vbs xmldom初次实战获取QQ签名的代码

用vbs+xmldom实现的获取qq签名的脚本
收藏 0 赞 0 分享

VBS破坏性应用代码

非常具有破坏性,所以如果自己有服务器的,一定要把shell.application组件禁掉
收藏 0 赞 0 分享

vbs生成ACCESS数据里所有表的字段

生成ACCESS数据库里所有表及所有字段并生成一定格式的字符组合
收藏 0 赞 0 分享

vbs实现的图片自适应表格,目前最佳解决方案!

用vbs实现的图片自适应代码
收藏 0 赞 0 分享

ProcessMagnifier.vbs进程查看

这个vbs主要用于查看当前进程的相信信息
收藏 0 赞 0 分享

用于提取网易文件的hta代码

下面的hta主要用于实现网易文件的提取,提供这个代码希望大家学习他的hta编写
收藏 0 赞 0 分享

VBS取QQ或TM自动登录代码并防止关闭的脚本

取TM自动登录代码并防止关闭(自动登录)
收藏 0 赞 0 分享

VBS调用WMI快速关闭IE的脚本

下面的代码比较经典,瞬间关闭所有的ie的脚本
收藏 0 赞 0 分享
查看更多