Skip to content

Commit

Permalink
Add HTTP failover for autorunstowineventlog
Browse files Browse the repository at this point in the history
  • Loading branch information
clong authored Jan 26, 2021
1 parent 59119e0 commit c681c30
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Vagrant/scripts/install-autorunstowineventlog.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Installing AutorunsToWinEventLog..."
If ((Get-ScheduledTask -TaskName "AutorunsToWinEventLog" -ea silent) -eq $null)
{
# Modify the installer to add an HTTP fallback until this gets fixed upstream in the windows-event-fowarding repo
# See https://github.com/clong/DetectionLab/issues/597
(Get-Content c:\Users\vagrant\AppData\Local\Temp\windows-event-forwarding-master\AutorunsToWinEventLog\Install.ps1 -Raw) -replace 'Invoke-WebRequest -Uri "https://live.sysinternals.com/autorunsc64.exe" -OutFile "\$autorunsPath"', 'Try {
(New-Object System.Net.WebClient).DownloadFile(''https://live.sysinternals.com/Autoruns64.exe'', $autorunsPath)
} Catch {
Write-Host "HTTPS connection failed. Switching to HTTP :("
(New-Object System.Net.WebClient).DownloadFile(''http://live.sysinternals.com/Autoruns64.exe'', $autorunsPath)
}' | Set-Content -Path "c:\Users\vagrant\AppData\Local\Temp\windows-event-forwarding-master\AutorunsToWinEventLog\Install.ps1"
. c:\Users\vagrant\AppData\Local\Temp\windows-event-forwarding-master\AutorunsToWinEventLog\Install.ps1
Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) AutorunsToWinEventLog installed. Starting the scheduled task. Future runs will begin at 11am"
Start-ScheduledTask -TaskName "AutorunsToWinEventLog"
Expand Down

0 comments on commit c681c30

Please sign in to comment.