落地报价模板主账与后台:合同映射、灌种 SQL/脚本、智能体填表,并补测服运维探针与合同文档对齐。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
$ErrorActionPreference = "Continue"
|
||||
function Load-EnvFile($path) {
|
||||
$map = @{}
|
||||
if (-not (Test-Path $path)) { return $map }
|
||||
Get-Content $path | ForEach-Object {
|
||||
$line = $_.Trim()
|
||||
if (-not $line -or $line.StartsWith("#")) { return }
|
||||
$i = $line.IndexOf("=")
|
||||
if ($i -lt 1) { return }
|
||||
$k = $line.Substring(0,$i).Trim()
|
||||
$v = $line.Substring($i+1).Trim().Trim('"')
|
||||
$map[$k] = $v
|
||||
}
|
||||
return $map
|
||||
}
|
||||
function Show-RedisKeys($label, $map) {
|
||||
$keys = @("YTD_REDIS_HOST","YTD_REDIS_PORT","YTD_REDIS_DB","YTD_REDIS_USERNAME","YTD_REDIS_PASSWORD","REDIS_URL","REDIS_PASSWORD","REDIS_USERNAME")
|
||||
Write-Host ("=== " + $label + " ===")
|
||||
foreach ($k in $keys) {
|
||||
if ($map.ContainsKey($k)) {
|
||||
$v = $map[$k]
|
||||
$safe = $v
|
||||
if ($k -match "PASSWORD|URL") {
|
||||
if ($k -eq "REDIS_URL" -and $v -match "redis://([^:/@]+):([^@]+)@([^:/]+)") {
|
||||
Write-Host (" REDIS_URL user=" + $Matches[1] + " pw_len=" + $Matches[2].Length + " host=" + $Matches[3])
|
||||
continue
|
||||
}
|
||||
Write-Host (" " + $k + " len=" + $v.Length)
|
||||
} else {
|
||||
Write-Host (" " + $k + "=" + $v)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$candidates = @(
|
||||
"E:\wwwroot\.env",
|
||||
"C:\yutongda\.env",
|
||||
"C:\yutongda\releases\admin-rel26-local-source-20260911d\backend\.env",
|
||||
"C:\yutongda\releases\admin-rel26-local-source-20260911d\.env",
|
||||
"E:\wwwroot\inquiry-new\.env"
|
||||
)
|
||||
Get-ChildItem "C:\yutongda" -Filter ".env" -Recurse -Depth 4 -ErrorAction SilentlyContinue | Select-Object -First 10 | ForEach-Object { $candidates += $_.FullName }
|
||||
$candidates = $candidates | Select-Object -Unique
|
||||
foreach ($p in $candidates) {
|
||||
if (Test-Path $p) { Show-RedisKeys $p (Load-EnvFile $p) }
|
||||
}
|
||||
# Compare whether URL password equals any YTD_REDIS_PASSWORD found
|
||||
$www = Load-EnvFile "E:\wwwroot\.env"
|
||||
$urlPw = $null; $urlUser = $null
|
||||
if ($www["REDIS_URL"] -match "redis://([^:/@]+):([^@]+)@") { $urlUser = $Matches[1]; $urlPw = $Matches[2] }
|
||||
Get-ChildItem "C:\yutongda" -Filter ".env" -Recurse -Depth 4 -ErrorAction SilentlyContinue | ForEach-Object {
|
||||
$m = Load-EnvFile $_.FullName
|
||||
if ($m.ContainsKey("YTD_REDIS_PASSWORD") -and $urlPw) {
|
||||
$same = ($m["YTD_REDIS_PASSWORD"] -eq $urlPw)
|
||||
Write-Host ("cmp " + $_.FullName + " YTD_pw_len=" + $m["YTD_REDIS_PASSWORD"].Length + " same_as_www_url_pw=" + $same + " user=" + $m["YTD_REDIS_USERNAME"])
|
||||
}
|
||||
}
|
||||
Write-Host "COMPARE_DONE"
|
||||
Reference in New Issue
Block a user