Files
inquiry_robot/deploy/_remote_login_probe2.ps1
T

17 lines
1002 B
PowerShell

$ErrorActionPreference='Continue'
Write-Host '=== config ==='
Get-ChildItem E:\wwwroot\inquiry-new\config -EA SilentlyContinue | Format-Table Name,Length
Select-String -Path 'E:\wwwroot\inquiry-new\config\*.yml' -Pattern 'loginCaptcha' -EA SilentlyContinue
Write-Host '=== try login with empty captcha after randomImage ==='
$key='seedkey99'
$img=Invoke-RestMethod -Uri ("http://127.0.0.1:8180/jeecgboot/sys/randomImage/"+$key) -TimeoutSec 15
"img_success=$($img.success) hasResult=$([bool]$img.result)"
# When captcha enabled, we cannot OCR. Try common bypass passwords from docs.
$pwds=@('123456','admin','Admin123','ytd123456')
foreach($p in $pwds){
$body=@{username='admin';password=$p;captcha='1';checkKey=$key} | ConvertTo-Json -Compress
$r=Invoke-RestMethod -Method Post -Uri 'http://127.0.0.1:8180/jeecgboot/sys/login' -ContentType 'application/json' -Body $body -TimeoutSec 20
Write-Host ("pwd="+$p+" success="+$r.success+" code="+$r.code+" msg="+$r.message)
if($r.success){ break }
}