【问题标题】:Encoded VBS not working when called from HTA从 HTA 调用时,编码的 VBS 不起作用
【发布时间】:2018-04-04 17:33:35
【问题描述】:

我们有一个 HTA 用于使用 VBS 自动登录到服务器。为了维护安全,我们想要对 VBS 进行编码,它具有登录服务器的凭据。我们遇到了一个 VBS 脚本,当将 VBS 文件拖到它上面时,它会对其进行编码,输出是一个 VBE 文件。

现在,当从 HTA 调用此 VBE 时,它显示错误,似乎无法正确读取 VBE。

下面是我们如何将 VBE 链接到 out HTA:

<script language="VBScript" src="hola.vbe" > </script>

另外,下面是编码代码:

Option Explicit 

dim oEncoder, oFilesToEncode, file, sDest 
dim sFileOut, oFile, oEncFile, oFSO, i 
dim oStream, sSourceFile 

set oFilesToEncode = WScript.Arguments 
set oEncoder = CreateObject("Scripting.Encoder") 
For i = 0 to oFilesToEncode.Count - 1 
    set oFSO = CreateObject("Scripting.FileSystemObject") 
    file = oFilesToEncode(i) 
    set oFile = oFSO.GetFile(file) 
    Set oStream = oFile.OpenAsTextStream(1) 
    sSourceFile=oStream.ReadAll 
    oStream.Close 
    sDest = oEncoder.EncodeScriptFile(".vbs",sSourceFile,0,"") 
    sFileOut = Left(file, Len(file) - 3) & "vbe" 
    Set oEncFile = oFSO.CreateTextFile(sFileOut) 
    oEncFile.Write sDest 
    oEncFile.Close 
Next 

根据我的理解,编码后的 VBS 应该可以正常工作,不知道为什么在这种情况下我们会出现褪色问题。

【问题讨论】:

    标签: vbscript hta


    【解决方案1】:

    为了使用编码的 VBScript,您需要指定与language="VBScript.Encode" 一起使用的语言引擎,而不仅仅是language="VBScript"

    此外,如果您想使用它“维护安全”,请务必小心。脚本编码器的目的是阻止随意检查,但它不会在任何传统意义上“加密”代码,而是not that hard 来取回纯脚本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-31
      • 2015-08-31
      • 1970-01-01
      相关资源
      最近更新 更多