落地报价模板主账与后台:合同映射、灌种 SQL/脚本、智能体填表,并补测服运维探针与合同文档对齐。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
$ErrorActionPreference = "Continue"
|
||||
Get-Content "E:\wwwroot\.env" | ForEach-Object {
|
||||
$line = $_.Trim()
|
||||
if (-not $line -or $line.StartsWith("#")) { return }
|
||||
$i = $line.IndexOf("=")
|
||||
if ($i -lt 1) { return }
|
||||
Set-Item -Path ("Env:" + $line.Substring(0, $i).Trim()) -Value $line.Substring($i + 1).Trim().Trim('"')
|
||||
}
|
||||
if ($env:REDIS_URL -match "redis://([^:/@]+):([^@]+)@([^:/]+)(?::(\d+))?(?:/(\d+))?") {
|
||||
$user = $Matches[1]; $pass = $Matches[2]; $host = $Matches[3]; $port = $Matches[4]; if (-not $port) { $port = "6379" }
|
||||
} else { Write-Host "parse_fail"; exit 1 }
|
||||
$decoded = [Uri]::UnescapeDataString($pass)
|
||||
Write-Host ("user=" + $user + " pw_len=" + $pass.Length + " decoded_len=" + $decoded.Length + " has_pct=" + ($pass -match "%") + " host=" + $host + " port=" + $port)
|
||||
|
||||
# try python redis if present
|
||||
$py = $null
|
||||
foreach ($c in @("C:\yutongda\tools\python\python.exe","C:\Python39\python.exe","python")) {
|
||||
try { $v = & $c -c "print(1)" 2>$null; if ($v -eq "1") { $py = $c; break } } catch {}
|
||||
}
|
||||
Write-Host ("python=" + $py)
|
||||
if ($py) {
|
||||
$script = @"
|
||||
import socket,sys
|
||||
host='$host'; port=int('$port'); user='$user'
|
||||
# password via env to avoid shell escaping issues
|
||||
import os
|
||||
pw=os.environ['PROBE_REDIS_PW']
|
||||
pw2=os.environ.get('PROBE_REDIS_PW2',pw)
|
||||
|
||||
def probe(name, auth_cmd):
|
||||
s=socket.create_connection((host,port),3)
|
||||
s.settimeout(3)
|
||||
s.sendall(auth_cmd)
|
||||
data=s.recv(128)
|
||||
s.close()
|
||||
print(name, data[:80])
|
||||
|
||||
# RESP AUTH password
|
||||
def resp_arr(*parts):
|
||||
out='*%d\r\n'%len(parts)
|
||||
for p in parts:
|
||||
b=p.encode('utf-8') if isinstance(p,str) else p
|
||||
out+='$%d\r\n'%len(b)
|
||||
out+=b.decode('latin1') if isinstance(b,bytes) else ''
|
||||
# rebuild properly
|
||||
# better
|
||||
chunks=[('*%d\r\n'%len(parts)).encode()]
|
||||
for p in parts:
|
||||
b=p.encode('utf-8')
|
||||
chunks.append(('$%d\r\n'%len(b)).encode()); chunks.append(b); chunks.append(b'\r\n')
|
||||
return b''.join(chunks)
|
||||
|
||||
for name,cmd in [
|
||||
('auth_pw_only', resp_arr('AUTH', pw)),
|
||||
('auth_user_pw', resp_arr('AUTH', user, pw)),
|
||||
('auth_pw_decoded', resp_arr('AUTH', pw2)),
|
||||
('auth_user_pw_decoded', resp_arr('AUTH', user, pw2)),
|
||||
('ping_noauth', resp_arr('PING')),
|
||||
]:
|
||||
try:
|
||||
s=socket.create_connection((host,port),3); s.settimeout(3); s.sendall(cmd); print(name, s.recv(120)); s.close()
|
||||
except Exception as e:
|
||||
print(name, 'ERR', e)
|
||||
"@
|
||||
$env:PROBE_REDIS_PW = $pass
|
||||
$env:PROBE_REDIS_PW2 = $decoded
|
||||
$tmp = Join-Path $env:TEMP "redis_probe.py"
|
||||
Set-Content -Path $tmp -Value $script -Encoding ASCII
|
||||
& $py $tmp
|
||||
}
|
||||
|
||||
# how does prod 8080 pass redis? cmdline snippet without secrets
|
||||
Get-CimInstance Win32_Process -Filter "Name='java.exe'" | ForEach-Object {
|
||||
if ($_.CommandLine -like '*8080*' -or $_.CommandLine -like '*jeecg-boot*' -or $_.CommandLine -like '*wwwroot*jeecg*') {
|
||||
$cl = $_.CommandLine
|
||||
if ($cl.Length -gt 250) { $cl = $cl.Substring(0,250) }
|
||||
Write-Host ("java8080ish pid=" + $_.ProcessId + " cmd=" + $cl)
|
||||
}
|
||||
}
|
||||
Write-Host "AUTH_PROBE_DONE"
|
||||
Reference in New Issue
Block a user