Files
inquiry_robot/deploy/_remote_find_admin.ps1
T

44 lines
2.0 KiB
PowerShell

$ErrorActionPreference = "Continue"
Write-Output "=== search mysql/postgres root hints (filenames + key names only) ==="
Get-ChildItem "C:\yutongda\secure","C:\yutongda\config","C:\yutongda\ops" -Recurse -File -ErrorAction SilentlyContinue |
Where-Object { $_.Name -match 'mysql|postgres|root|dba|admin|credential|pass' } |
Select-Object -ExpandProperty FullName
Write-Output "=== try pg superuser with pgpass.txt against data host ==="
$psql = "C:\yutongda\tools\pgsql\bin\psql.exe"
$raw = (Get-Content "C:\yutongda\secure\pgpass.txt" -Raw).Trim()
# pgpass may be plain password or host:port:db:user:pass
$pgPass = $raw
$pgUser = "postgres"
if ($raw -match ':') {
$parts = $raw -split ':'
if ($parts.Length -ge 5) {
$pgUser = $parts[3]
$pgPass = $parts[4]
"pgpass_format=libpq parts_user=$pgUser"
} else {
"pgpass_format=colon_but_not_5"
}
} else {
"pgpass_format=plain_password"
}
$env:PGPASSWORD = $pgPass
$env:PGCONNECT_TIMEOUT = "8"
& $psql -h 10.206.0.14 -p 5432 -U $pgUser -d postgres -c "SELECT current_user, rolsuper FROM pg_roles WHERE rolname = current_user;" 2>&1 | ForEach-Object { "$_" }
Write-Output "=== redis old cli auth ==="
$redisCred = Get-Content "C:\yutongda\secure\redis-credentials.json" -Raw | ConvertFrom-Json
$rcli = "C:\yutongda\tools\redis-5.0.14.1\redis-cli.exe"
# try AUTH after -a only
$env:REDISCLI_AUTH = $redisCred.application_password
& $rcli -h $redisCred.host -p $redisCred.port -a $redisCred.application_password -n 1 --no-auth-warning PING 2>&1 | ForEach-Object { if ($_ -notmatch 'Warning') { "app=$($_)" } }
& $rcli -h $redisCred.host -p $redisCred.port -a $redisCred.operations_password -n 1 --no-auth-warning PING 2>&1 | ForEach-Object { if ($_ -notmatch 'Warning') { "ops=$($_)" } }
Write-Output "=== minio root bucket list via python urllib? ==="
# just check endpoint responds
curl.exe -s -o NUL -w "minio_http=%{http_code}" http://127.0.0.1:9000/minio/health/live
Write-Output ""
curl.exe -s -o NUL -w "minio_console=%{http_code}" http://127.0.0.1:9001/
Write-Output ""
Write-Output "SEARCH_DONE"