# Script para baixar e executar o AnyDesk Clear # Repositório: https://github.com/codsec/Anydesk-Clear if (-not $args) { Write-Host '' Write-Host 'Verifique o script original em: ' -NoNewline Write-Host 'https://github.com/codsec/Anydesk-Clear' -ForegroundColor Green Write-Host '' } & { $psv = (Get-Host).Version.Major $troubleshoot = 'https://github.com/codsec/Anydesk-Clear/issues' if ($ExecutionContext.SessionState.LanguageMode.value__ -ne 0) { Write-Host "PowerShell não está em Full Language Mode." Write-Host "Execute o PowerShell como administrador com permissões completas." -ForegroundColor White -BackgroundColor Blue return } try { [void][System.AppDomain]::CurrentDomain.GetAssemblies(); [void][System.Math]::Sqrt(144) } catch { Write-Host "Erro: $($_.Exception.Message)" -ForegroundColor Red Write-Host "Falha ao carregar comandos .NET. Tente reparar o PowerShell." -ForegroundColor White -BackgroundColor Blue return } function Check3rdAV { $cmd = if ($psv -ge 3) { 'Get-CimInstance' } else { 'Get-WmiObject' } $avList = & $cmd -Namespace root\SecurityCenter2 -Class AntiVirusProduct | Where-Object { $_.displayName -notlike '*windows*' } | Select-Object -ExpandProperty displayName if ($avList) { Write-Host 'Antivírus de terceiros pode estar bloqueando o script: ' -ForegroundColor Yellow Write-Host ($avList -join ', ') } } function CheckFile { param ([string]$FilePath) if (-not (Test-Path $FilePath)) { Check3rdAV Write-Host "Falha ao criar o arquivo temporário, abortando!" Write-Host "Ajuda - $troubleshoot" -ForegroundColor White -BackgroundColor Blue throw } } try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 } catch {} # URLs do seu repositório (pode adicionar mirrors aqui) $URLs = @( 'https://raw.githubusercontent.com/codsec/Anydesk-Clear/refs/heads/main/anydesk.ps1' ) Write-Progress -Activity "Baixando..." -Status "Aguarde" $errors = @() foreach ($URL in $URLs | Sort-Object { Get-Random }) { try { if ($psv -ge 3) { $response = Invoke-RestMethod $URL } else { $w = New-Object Net.WebClient $response = $w.DownloadString($URL) } break } catch { $errors += $_ } } Write-Progress -Activity "Baixando..." -Status "Concluído" -Completed if (-not $response) { Check3rdAV foreach ($err in $errors) { Write-Host "Erro: $($err.Exception.Message)" -ForegroundColor Red } Write-Host "Falha ao baixar o script do repositório, abortando!" return } $rand = [Guid]::NewGuid().Guid $isAdmin = [bool]([Security.Principal.WindowsIdentity]::GetCurrent().Groups -match 'S-1-5-32-544') $FilePath = if ($isAdmin) { "$env:SystemRoot\Temp\anydesk_clear_$rand.ps1" } else { "$env:USERPROFILE\AppData\Local\Temp\anydesk_clear_$rand.ps1" } Set-Content -Path $FilePath -Value $response -Encoding UTF8 CheckFile $FilePath Write-Host "Executando o script do AnyDesk Clear..." -ForegroundColor Cyan powershell -ExecutionPolicy Bypass -File $FilePath @args Remove-Item -Path $FilePath -Force } @args