Merge pull request #22 from igor04091968/реконструкция-кода-репозитория-298c5
Update from task 9d312d5c-ebcc-4c50-a5f3-9e14f71298c5
This commit is contained in:
+49
-33
@@ -1,51 +1,67 @@
|
|||||||
```
|
# PowerShell/Windows specific
|
||||||
# Dependencies
|
Thumbs.db
|
||||||
node_modules/
|
Desktop.ini
|
||||||
package-lock.json
|
$RECYCLE.BIN/
|
||||||
|
System Volume Information/
|
||||||
# Logs and temp files
|
|
||||||
*.log
|
|
||||||
*.tmp
|
*.tmp
|
||||||
|
*.log
|
||||||
|
|
||||||
# Environment
|
# Environment variables
|
||||||
.env
|
.env
|
||||||
.env.local
|
.env.local
|
||||||
*.env.*
|
*.env.*
|
||||||
|
|
||||||
# Editors
|
# IDE/Editor files
|
||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
# Python
|
# Dependencies and build artifacts
|
||||||
|
node_modules/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
*.pyo
|
*.class
|
||||||
*.pyd
|
*.o
|
||||||
.Python
|
*.obj
|
||||||
env/
|
*.exe
|
||||||
venv/
|
*.dll
|
||||||
.venv/
|
*.so
|
||||||
pip-log.txt
|
*.a
|
||||||
pip-delete-this-directory.txt
|
*.out
|
||||||
|
|
||||||
# Build directories
|
|
||||||
dist/
|
dist/
|
||||||
build/
|
build/
|
||||||
*.egg-info/
|
target/
|
||||||
|
.venv/
|
||||||
# Coverage
|
venv/
|
||||||
|
.mypy_cache/
|
||||||
|
.pytest_cache/
|
||||||
.coverage
|
.coverage
|
||||||
coverage/
|
coverage/
|
||||||
htmlcov/
|
htmlcov/
|
||||||
.nyc_output/
|
.gradle/
|
||||||
|
|
||||||
# Testing
|
# System files
|
||||||
.pytest_cache/
|
|
||||||
.mypy_cache/
|
|
||||||
.tox/
|
|
||||||
.hypothesis/
|
|
||||||
|
|
||||||
# OS generated files
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
*.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
|
||||||
@@ -48,6 +48,16 @@ function Get-DeploymentConfig {
|
|||||||
return $null
|
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
|
$deploymentConfig = Get-DeploymentConfig -Path $ConfigPath
|
||||||
$resolvedServerHost = if ($ServerHost) { $ServerHost } elseif ($deploymentConfig) { [string]$deploymentConfig.server.host } else { throw 'ServerHost is required.' }
|
$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 }
|
$resolvedServerPort = if ($PSBoundParameters.ContainsKey('ServerPort')) { $ServerPort } elseif ($deploymentConfig) { [int]$deploymentConfig.server.port } else { 5600 }
|
||||||
@@ -541,7 +551,7 @@ function Send-DlpIncidentHeartbeat {
|
|||||||
} + $captureData
|
} + $captureData
|
||||||
} | ConvertTo-Json -Depth 5 -Compress
|
} | 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 {
|
function Get-FileSha256Hex {
|
||||||
@@ -707,7 +717,7 @@ function Ensure-Bucket {
|
|||||||
hostname = $script:Hostname
|
hostname = $script:Hostname
|
||||||
} | ConvertTo-Json -Compress
|
} | 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
|
$script:KnownBuckets[$BucketId] = $true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -733,7 +743,7 @@ function Send-Heartbeat {
|
|||||||
}
|
}
|
||||||
} | ConvertTo-Json -Depth 4 -Compress
|
} | 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 {
|
function Send-CategoryHeartbeat {
|
||||||
@@ -770,7 +780,7 @@ function Send-CategoryHeartbeat {
|
|||||||
}
|
}
|
||||||
} | ConvertTo-Json -Depth 4 -Compress
|
} | 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
|
Load-CustomCategoryRules -Path $resolvedRulesPath
|
||||||
|
|||||||
Reference in New Issue
Block a user