0
我有啓動TestNG測試的VBScript。在調用測試之前,應該下載正在測試的應用程序的.jar文件。這裏是代碼的主要部分:即使不執行VBScript文件也會自行刪除
'Variables - input args
Dim objArgs
Set objArgs = wscript.Arguments
finalHour = CInt(objArgs(1))
Set oShell = WScript.CreateObject("WSCript.shell")
Set UAC = CreateObject("Shell.Application")
'save script stating date
startDay = Day(Now)
startHour = Hour(Now)
downloadLink = "http://....ru:.../.../"
savePath = "C:\monitoring\build-under-test\"
WScript.Echo "Download jar files from '" & downloadLink & "...'"
'DownloadFile downloadLink & "some.jar", savePath & "some.jar"
Dim xHttp: Set xHttp = CreateObject("Microsoft.XMLHTTP")
Dim bStrm: Set bStrm = CreateObject("ADODB.Stream")
xHttp.Open "GET", downloadLink & "account.jar", False
xHttp.Send
With bStrm
.Type = 1 '//binary
.Open
.Write xHttp.ResponseBody
.SaveToFile savePath & "account.jar", 1 '//overwrite
.Close
End With
xHttp = Nothing
bStrm = Nothing
Do
WScript.Echo "Executing: run-suite.bat " & objArgs(0) & " - at " & Now
WScript.Echo " finalHour = " & finalHour
'With waiting of last command execution
oShell.Run "run-suite.bat " & objArgs(0) & " " & objArgs(1) & " false true > C:\monitoring\results\logfiles\" & logBatName, 1, True
currentHour = Hour(Now)
WScript.Echo " checking: currentHour < finalHour :: " & currentHour & " < " & finalHour
Loop While currentHour < finalHour
的問題是,當我執行這個文件:
cscript.exe "run-monitoring.vbs" "test-suite\monitoring-all-tests.xml" 21
這個文件刪除自身。然後,我重新創建文件後,它再次刪除自己沒有運行命令。所以我開始重新創建它並註釋行以找到強制刪除文件的行。它是:
.SaveToFile savePath & "account.jar", 1 '//overwrite
當我刪除評論,文件刪除自己。即使在PC重新啓動後。
這是爲什麼?爲什麼即使沒有運行它,文件也會重新執行?
對我來說,Windows Defender會將其檢測爲「TrojanDownloader.HTML/Adodb.gen!A」並移至隔離區。檢查您的防病毒日誌。 –
* \ * facepalm \ **。 –