-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[winlogbeat] Default to raw api (#42275)
* Default to raw api * Install sysmon event manifests * Re-generate golden files * Remove unused renderer option * Fix tests * Fix tests * Remove field from docs * Fix doc default value * Make script compatible with older ps * Print error * Fix web request * Clean tests and Fallback to use latest available metadata if non found * Fix security pipeline for new rendered events * Regenerate ingest golden files * Fix test for win2016 * fix github action * Update winlogbeat/sys/wineventlog/metadata_store_test.go Co-authored-by: Leszek Kubik <[email protected]> * simplify sysmon script * Add retries and simplify call --------- Co-authored-by: Leszek Kubik <[email protected]>
- Loading branch information
Showing
244 changed files
with
4,516 additions
and
3,777 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
$downloadUrl = "https://live.sysinternals.com/Sysmon64.exe" | ||
$tempFolder = "$env:TEMP\SysmonDownload" | ||
$sysmonPath = "$tempFolder\Sysmon64.exe" | ||
|
||
if (!(Test-Path $tempFolder)) { | ||
New-Item -ItemType Directory -Path $tempFolder | ||
} | ||
|
||
$ProgressPreference = 'SilentlyContinue' | ||
function ParseErrorForResponseBody($Error) { | ||
if ($PSVersionTable.PSVersion.Major -lt 6) { | ||
if ($Error.Exception.Response) { | ||
$Reader = New-Object System.IO.StreamReader($Error.Exception.Response.GetResponseStream()) | ||
$Reader.BaseStream.Position = 0 | ||
$Reader.DiscardBufferedData() | ||
$ResponseBody = $Reader.ReadToEnd() | ||
if ($ResponseBody.StartsWith('{')) { | ||
$ResponseBody = $ResponseBody | ConvertFrom-Json | ||
} | ||
return $ResponseBody | ||
} | ||
} | ||
else { | ||
return $Error.ErrorDetails.Message | ||
} | ||
} | ||
|
||
$attempts=1 | ||
do | ||
{ | ||
$attempts++ | ||
try { | ||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | ||
$result = Invoke-WebRequest -Uri $downloadUrl -OutFile $sysmonPath -UseBasicParsing | ||
break | ||
} | ||
catch { | ||
$resp = ParseErrorForResponseBody($_) | ||
Write-Host "$resp" | ||
if ($attempts -gt 5) { | ||
exit 1 | ||
} | ||
} | ||
} while ($attempts -le 5) | ||
|
||
Write-Host "Sysmon64.exe downloaded successfully." | ||
|
||
if ($sysmonPath) { | ||
Start-Process -FilePath $sysmonPath -ArgumentList "-m" -Wait | ||
|
||
Write-Host "Sysmon event manifest installation completed." | ||
} else { | ||
Write-Host "Sysmon executable not found in the downloaded archive." | ||
} | ||
|
||
Remove-Item -Path $tempFolder -Force -Recurse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.