Files
inquiry_robot/deploy/_remote_login_captcha_check.ps1
T

27 lines
1.2 KiB
PowerShell

# Check captcha flag on running ledger + try login without captcha
$ErrorActionPreference = 'Continue'
Write-Output '=== overlay jeecg.loginCaptcha ==='
Select-String -Path 'E:\wwwroot\inquiry-new\config\application-inquiry.yml' -Pattern 'loginCaptcha|cas:' | ForEach-Object { $_.Line }
Write-Output '=== process cmdline ==='
Get-CimInstance Win32_Process -Filter "Name='java.exe'" | ForEach-Object {
if ($_.CommandLine -like '*inquiry-new*') {
$_.CommandLine.Substring(0, [Math]::Min(300, $_.CommandLine.Length))
}
}
Write-Output '=== login attempt ==='
$body = '{"username":"admin","password":"123456","captcha":"","checkKey":""}'
try {
$r = Invoke-WebRequest -Uri 'http://127.0.0.1:8180/jeecgboot/sys/login' -Method POST -Body $body -ContentType 'application/json;charset=UTF-8' -UseBasicParsing -TimeoutSec 15
"status=$($r.StatusCode) body=$($r.Content.Substring(0,[Math]::Min(300,$r.Content.Length)))"
} catch {
$resp = $_.Exception.Response
if ($resp) {
$reader = New-Object System.IO.StreamReader($resp.GetResponseStream())
$txt = $reader.ReadToEnd()
"http_err status=$([int]$resp.StatusCode) body=$txt"
} else {
"err=$($_.Exception.Message)"
}
}
Write-Output 'CAPTCHA_CHECK_DONE'