diff --git a/.gitignore b/.gitignore index 880ff80..2aa2426 100644 --- a/.gitignore +++ b/.gitignore @@ -1,51 +1,67 @@ -``` -# Dependencies -node_modules/ -package-lock.json - -# Logs and temp files -*.log +# PowerShell/Windows specific +Thumbs.db +Desktop.ini +$RECYCLE.BIN/ +System Volume Information/ *.tmp +*.log -# Environment +# Environment variables .env .env.local *.env.* -# Editors +# IDE/Editor files .vscode/ .idea/ +*.swp +*.swo -# Python +# Dependencies and build artifacts +node_modules/ __pycache__/ *.pyc -*.pyo -*.pyd -.Python -env/ -venv/ -.venv/ -pip-log.txt -pip-delete-this-directory.txt - -# Build directories +*.class +*.o +*.obj +*.exe +*.dll +*.so +*.a +*.out dist/ build/ -*.egg-info/ - -# Coverage +target/ +.venv/ +venv/ +.mypy_cache/ +.pytest_cache/ .coverage coverage/ htmlcov/ -.nyc_output/ +.gradle/ -# Testing -.pytest_cache/ -.mypy_cache/ -.tox/ -.hypothesis/ - -# OS generated files +# System files .DS_Store -Thumbs.db -``` \ No newline at end of file +*.zip +*.gz +*.tar +*.tgz +*.bz2 +*.xz +*.7z +*.rar +*.zst +*.lz4 +*.lzh +*.cab +*.arj +*.rpm +*.deb +*.Z +*.lz +*.lzo +*.tar.gz +*.tar.bz2 +*.tar.xz +*.tar.zst \ No newline at end of file diff --git a/windows/browser-domains-native-collector.ps1 b/windows/browser-domains-native-collector.ps1 index 220961e..c949ca6 100755 --- a/windows/browser-domains-native-collector.ps1 +++ b/windows/browser-domains-native-collector.ps1 @@ -48,6 +48,16 @@ function Get-DeploymentConfig { return $null } +function Invoke-AwJsonPost { + param( + [Parameter(Mandatory = $true)][string]$Uri, + [Parameter(Mandatory = $true)][string]$Json + ) + + $bytes = [Text.Encoding]::UTF8.GetBytes($Json) + Invoke-RestMethod -Method Post -Uri $Uri -ContentType 'application/json; charset=utf-8' -Body $bytes | Out-Null +} + $deploymentConfig = Get-DeploymentConfig -Path $ConfigPath $resolvedServerHost = if ($ServerHost) { $ServerHost } elseif ($deploymentConfig) { [string]$deploymentConfig.server.host } else { throw 'ServerHost is required.' } $resolvedServerPort = if ($PSBoundParameters.ContainsKey('ServerPort')) { $ServerPort } elseif ($deploymentConfig) { [int]$deploymentConfig.server.port } else { 5600 } @@ -541,7 +551,7 @@ function Send-DlpIncidentHeartbeat { } + $captureData } | ConvertTo-Json -Depth 5 -Compress - Invoke-RestMethod -Method Post -Uri "$($script:ApiBase)/buckets/$bucketId/heartbeat?pulsetime=$resolvedPulseSeconds" -ContentType 'application/json' -Body $event | Out-Null + Invoke-AwJsonPost -Uri "$($script:ApiBase)/buckets/$bucketId/heartbeat?pulsetime=$resolvedPulseSeconds" -Json $event } function Get-FileSha256Hex { @@ -707,7 +717,7 @@ function Ensure-Bucket { hostname = $script:Hostname } | ConvertTo-Json -Compress - Invoke-RestMethod -Method Post -Uri "$($script:ApiBase)/buckets/$BucketId" -ContentType 'application/json' -Body $body | Out-Null + Invoke-AwJsonPost -Uri "$($script:ApiBase)/buckets/$BucketId" -Json $body $script:KnownBuckets[$BucketId] = $true } @@ -733,7 +743,7 @@ function Send-Heartbeat { } } | ConvertTo-Json -Depth 4 -Compress - Invoke-RestMethod -Method Post -Uri "$($script:ApiBase)/buckets/$BucketId/heartbeat?pulsetime=$resolvedPulseSeconds" -ContentType 'application/json' -Body $event | Out-Null + Invoke-AwJsonPost -Uri "$($script:ApiBase)/buckets/$BucketId/heartbeat?pulsetime=$resolvedPulseSeconds" -Json $event } function Send-CategoryHeartbeat { @@ -770,7 +780,7 @@ function Send-CategoryHeartbeat { } } | ConvertTo-Json -Depth 4 -Compress - Invoke-RestMethod -Method Post -Uri "$($script:ApiBase)/buckets/$bucketId/heartbeat?pulsetime=$resolvedPulseSeconds" -ContentType 'application/json' -Body $event | Out-Null + Invoke-AwJsonPost -Uri "$($script:ApiBase)/buckets/$bucketId/heartbeat?pulsetime=$resolvedPulseSeconds" -Json $event } Load-CustomCategoryRules -Path $resolvedRulesPath