34 lines
1.0 KiB
PowerShell
34 lines
1.0 KiB
PowerShell
# List privilege-related credential file KEYS only (no secret values)
|
|
$ErrorActionPreference = "Continue"
|
|
$files = @(
|
|
'C:\yutongda\secure\application-database-credentials.json',
|
|
'C:\yutongda\secure\redis-credentials.json',
|
|
'C:\yutongda\config\minio.env',
|
|
'C:\yutongda\config\minio-app.env',
|
|
'C:\yutongda\secure\pgpass.txt'
|
|
)
|
|
foreach ($f in $files) {
|
|
Write-Output "==== $f exists=$(Test-Path $f) ===="
|
|
if (-not (Test-Path $f)) { continue }
|
|
if ($f -match '\.json$') {
|
|
try {
|
|
$j = Get-Content $f -Raw | ConvertFrom-Json
|
|
$j.PSObject.Properties.Name
|
|
# show nested keys only
|
|
foreach ($p in $j.PSObject.Properties) {
|
|
if ($p.Value -is [psobject]) {
|
|
" $($p.Name): $($p.Value.PSObject.Properties.Name -join ',')"
|
|
}
|
|
}
|
|
} catch { "json_parse_fail=$_" }
|
|
} else {
|
|
# only key names before =
|
|
Get-Content $f | ForEach-Object {
|
|
if ($_ -match '^\s*#') { return }
|
|
if ($_ -match '^([^=]+)=') { $matches[1] }
|
|
elseif ($_ -match '^\S') { 'line_present' }
|
|
}
|
|
}
|
|
}
|
|
Write-Output "DONE_KEYS"
|