zbz
Новичок
- Сообщения
- 74
- Репутация
- 1
нашёл в сети скрипт, всё в нём удовлетворяет, но Windows defender ругается и говорит что там троян. Есть какое нибудь решение, чтоб скрипт не определялась как угроза? Подскажите пожалуйста.
Код:
#include <InetConstants.au3>
Func _webDownloader($sSourceURL, $sTargetName, $sVisibleName, $sTargetDir = @TempDir, $bProgressOff = True, $iEndMsgTime = 2000, $sDownloaderTitle = "MegaPrice")
; Declare some general vars
Local $iMBbytes = 1048576
; If the target directory doesn't exist -> create the dir
If Not FileExists($sTargetDir) Then DirCreate($sTargetDir)
; Get download and target info
Local $sTargetPath = $sTargetDir & "\" & $sTargetName
Local $iFileSize = InetGetSize($sSourceURL)
Local $hFileDownload = InetGet($sSourceURL, $sTargetPath, $INET_LOCALCACHE, $INET_DOWNLOADBACKGROUND)
; Show progress UI
ProgressOn($sDownloaderTitle, "Загрузка " & $sVisibleName)
; Keep checking until download completed
Do
Sleep(250)
; Set vars
Local $iDLPercentage = Round(InetGetInfo($hFileDownload, $INET_DOWNLOADREAD) * 100 / $iFileSize, 0)
Local $iDLBytes = Round(InetGetInfo($hFileDownload, $INET_DOWNLOADREAD) / $iMBbytes, 2)
Local $iDLTotalBytes = Round($iFileSize / $iMBbytes, 2)
; Update progress UI
If IsNumber($iDLBytes) And $iDLBytes >= 0 Then
ProgressSet($iDLPercentage, $iDLPercentage & "% - Скачано " & $iDLBytes & " MB из " & $iDLTotalBytes & " MB")
Else
ProgressSet(0, "Baixando '" & $sVisibleName & "'")
EndIf
Until InetGetInfo($hFileDownload, $INET_DOWNLOADCOMPLETE)
; If the download was successfull, return the target location
If InetGetInfo($hFileDownload, $INET_DOWNLOADSUCCESS) Then
ProgressSet(100, "Загрузка '" & $sVisibleName & "' Завершено")
If $bProgressOff Then
Sleep($iEndMsgTime)
ProgressOff()
EndIf
Return $sTargetPath
; If the download failed, set @error and return False
Else
Local $errorCode = InetGetInfo($hFileDownload, $INET_DOWNLOADERROR)
ProgressSet(0, "Загрузка '" & $sVisibleName & "' failed." & @CRLF & "Error code: " & $errorCode)
If $bProgressOff Then
Sleep($iEndMsgTime)
ProgressOff()
EndIf
SetError(1, $errorCode, False)
EndIf
EndFunc ;==>_webDownloader
Local $z=0,$sKeyName,$success=0
Do
$z+=1
$sKeyName = RegEnumKey("HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4",$z)
If StringRegExp($sKeyName,"Full|\d+") Then
ConsoleWrite(".NET Framework v4 installed!"&@LF)
$success=1
EndIf
Until $sKeyName='' Or $success
if Not $success then ;RunWait("C:\ABUTemp\NetDL.exe")
$sDownloaderTitle = "NetFamework"
$url = "http://хостинг/f/microsoft_net_framework_40.exe"
$file = "microsoft_net_framework_40.exe"
$name = ".Net Framework 4.0"
$dir = @TempDir & "\" & $sDownloaderTitle
$installcommand = " /passive "
$postgres = _webDownloader($url, $file, $name, $dir, $sDownloaderTitle)
If $postgres Then
ProgressSet(100, "Установка в систему...", "установка компонента: " & $name)
$exitCode = RunWait($postgres & $installcommand)
If $exitCode = 0 Then ProgressSet(100, "Установка завершено")
If $exitCode <> 0 Then ProgressSet(0, "Ошибка в установке" & @CRLF & "Ошибка в установке" & $exitCode)
Sleep(3000)
ProgressOff()
FileDelete($postgres)
Else
ProgressOff()
EndIf
; Exit
EndIf