Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
|
start [2026/02/18 22:58] jango |
start [2026/02/19 22:31] (aktuell) jango |
||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| < | < | ||
| - | [22:55:17.197] # 33 -> HTTP -1 (0 ms) | + | param( |
| - | [22:55:17.407] # 34 -> HTTP -1 (0 ms) | + | |
| - | [22:55:17.611] # 35 -> HTTP -1 (0 ms) | + | [string]$Username = " |
| - | [22:55:17.825] # 36 -> HTTP -1 (0 ms) | + | [string]$Password = " |
| - | [22:55:18.042] # 37 -> HTTP -1 (0 ms) | + | [switch]$IgnoreCertErrors |
| - | [22:55:18.245] # 38 -> HTTP -1 (0 ms) | + | ) |
| - | [22:55:18.456] # 39 -> HTTP -1 (0 ms) | + | |
| - | [22:55:18.669] # 40 -> HTTP -1 (0 ms) | + | [Net.ServicePointManager]:: |
| - | [22:55:18.876] # 41 -> HTTP -1 (0 ms) | + | if ($IgnoreCertErrors) { [System.Net.ServicePointManager]:: |
| - | [22:55:19.086] # 42 -> HTTP -1 (0 ms) | + | |
| - | [22:55:19.286] # 43 -> HTTP -1 (0 ms) | + | function New-BasicAuthValue([string]$User, |
| - | [22:55:19.496] # 44 -> HTTP -1 (0 ms) | + | $pair = " |
| - | [22:55:19.701] # 45 -> HTTP -1 (0 ms) | + | "Basic " + [Convert]:: |
| - | [22:55:19.910] # 46 -> HTTP -1 (0 ms) | + | } |
| - | [22:55:20.120] # 47 -> HTTP -1 (0 ms) | + | |
| - | [22:55:20.321] # 48 -> HTTP -1 (0 ms) | + | $req = [System.Net.HttpWebRequest]:: |
| - | [22:55:20.531] # 49 -> HTTP -1 (0 ms) | + | $req.Method = " |
| - | [22:55:20.749] # 50 -> HTTP -1 (0 ms) | + | $req.AllowAutoRedirect = $false |
| + | $req.Headers.Add(" | ||
| + | $req.UserAgent = " | ||
| + | |||
| + | try { $resp = $req.GetResponse() } | ||
| + | catch [System.Net.WebException] { $resp = $_.Exception.Response } | ||
| + | |||
| + | if ($resp) { | ||
| + | "HTTP: {0}" -f ([int]$resp.StatusCode) | ||
| + | " | ||
| + | " | ||
| + | $resp.Close() | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | < | ||
| + | param( | ||
| + | [string]$Url = " | ||
| + | [switch]$IgnoreCertErrors | ||
| + | ) | ||
| + | |||
| + | [Net.ServicePointManager]:: | ||
| + | if ($IgnoreCertErrors) { [System.Net.ServicePointManager]:: | ||
| + | |||
| + | $req = [System.Net.HttpWebRequest]:: | ||
| + | $req.Method = " | ||
| + | $req.AllowAutoRedirect = $false | ||
| + | |||
| + | try { | ||
| + | $resp = $req.GetResponse() | ||
| + | } catch [System.Net.WebException] { | ||
| + | $resp = $_.Exception.Response | ||
| + | } | ||
| + | |||
| + | if ($resp) { | ||
| + | "HTTP: {0}" | ||
| + | " | ||
| + | $resp.Headers.GetValues(" | ||
| + | $resp.Close() | ||
| + | } else { | ||
| + | "No response (TLS/ | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | PS C: | ||
| + | Target: https:// | ||
| + | User: | ||
| + | Count: | ||
| + | |||
| + | [13: | ||
| + | [13:46:25.197] # 2 -> HTTP 401 (1187 ms) | ||
| + | [13:46:26.485] # 3 -> HTTP 401 (1181 ms) | ||
| + | [13:46:27.753] # 4 -> HTTP 401 (1159 ms) | ||
| + | [13:46:29.014] # 5 -> HTTP 401 (1147 ms) | ||
| + | [13:46:30.271] # 6 -> HTTP 401 (1151 ms) | ||
| + | [13:46:31.550] # 7 -> HTTP 401 (1161 ms) | ||
| + | [13:46:32.821] # 8 -> HTTP 401 (1167 ms) | ||
| + | [13:46:34.072] # 9 -> HTTP 401 (1141 ms) | ||
| + | [13:46:35.328] # | ||
| + | [13:46:36.606] # | ||
| + | [13:46:37.876] # | ||
| + | [13:46:39.153] # | ||
| + | [13:46:40.395] # | ||
| + | [13:46:41.684] # | ||
| + | [13:46:42.964] # | ||
| + | [13:46:44.219] # | ||
| + | [13: | ||
| + | [13:46:46.909] # | ||
| + | [13: | ||
| PS C: | PS C: | ||
| Zeile 35: | Zeile 104: | ||
| <code powershell> | <code powershell> | ||
| + | <# | ||
| + | PowerShell 5.1 – EAS Basic-Auth Test (sendet IMMER weiter, auch bei 429) | ||
| + | |||
| + | Optional: | ||
| + | - -IgnoreCertErrors (nur Test!) | ||
| + | - -LogHeaders um X-EAS-FAIL / X-Blocked-By etc. zu sehen, falls du die in HAProxy setzt. | ||
| + | #> | ||
| + | |||
| param( | param( | ||
| [string]$Url = " | [string]$Url = " | ||
| - | [string]$Username = "doesnotexist-testuser", | + | [string]$Username = "D2000\\jango.zarat", |
| - | [string]$Password = "WrongPassword123!", | + | [string]$Password = "Lunikoff0310!", |
| - | [int]$Count = 50, | + | [int]$Count = 20, |
| - | [int]$DelayMs = 200 | + | [int]$DelayMs = 100, |
| + | [int]$TimeoutSec = 10, | ||
| + | [switch]$IgnoreCertErrors, | ||
| + | [switch]$LogHeaders | ||
| ) | ) | ||
| - | + | ||
| - | $pair = "{0}:{1}" -f $Username, $Password | + | # TLS 1.2 erzwingen |
| - | $b64 = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($pair)) | + | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 |
| - | + | ||
| - | $headers = @{ | + | # Optional: Zertifikatsfehler ignorieren |
| - | | + | if ($IgnoreCertErrors) |
| - | " | + | |
| - | " | + | |
| - | # optional aber manchmal hilfreich: | + | |
| - | " | + | |
| } | } | ||
| - | + | ||
| - | Write-Host " | + | function New-BasicAuthValue { |
| - | Write-Host " | + | param([string]$User, |
| - | Write-Host " | + | $pair = " |
| + | $b64 = [Convert]:: | ||
| + | return "Basic $b64" | ||
| + | } | ||
| + | |||
| + | $auth = New-BasicAuthValue -User $Username -Pass $Password | ||
| + | |||
| + | Write-Host | ||
| + | Write-Host | ||
| + | Write-Host | ||
| Write-Host "" | Write-Host "" | ||
| + | |||
| for ($i=1; $i -le $Count; $i++) { | for ($i=1; $i -le $Count; $i++) { | ||
| - | $sw = [System.Diagnostics.Stopwatch]:: | + | $sw = [Diagnostics.Stopwatch]:: |
| + | $code = -1 | ||
| + | $err = $null | ||
| + | $h = @{} | ||
| + | |||
| try { | try { | ||
| - | $resp = Invoke-WebRequest ` | + | $req = [System.Net.HttpWebRequest]:: |
| - | -Uri $Url -Method | + | $req.Method |
| - | | + | |
| - | | + | |
| - | -SkipHttpErrorCheck ` | + | |
| - | -TimeoutSec 10 | + | |
| + | | ||
| + | $req.Headers.Add(" | ||
| + | |||
| + | $resp = $req.GetResponse() | ||
| $code = [int]$resp.StatusCode | $code = [int]$resp.StatusCode | ||
| - | $blockedBy | + | |
| + | foreach ($k in $resp.Headers.AllKeys) { $h[$k] | ||
| + | } | ||
| + | $resp.Close() | ||
| + | } | ||
| + | catch [System.Net.WebException] { | ||
| + | if ($_.Exception.Response) { | ||
| + | $resp = $_.Exception.Response | ||
| + | $code = [int]$resp.StatusCode | ||
| + | if ($LogHeaders) { | ||
| + | foreach ($k in $resp.Headers.AllKeys) { $h[$k] = $resp.Headers[$k] } | ||
| + | } | ||
| + | $resp.Close() | ||
| + | } else { | ||
| + | $err = $_.Exception.Message | ||
| + | } | ||
| } | } | ||
| catch { | catch { | ||
| - | $code = -1 | + | $err = $_.Exception.Message |
| - | $blockedBy = $null | + | |
| - | $msg = $_.Exception.Message | + | |
| } | } | ||
| + | |||
| $sw.Stop() | $sw.Stop() | ||
| - | |||
| $ts = (Get-Date).ToString(" | $ts = (Get-Date).ToString(" | ||
| + | |||
| if ($code -eq -1) { | if ($code -eq -1) { | ||
| - | Write-Host (" | + | Write-Host (" |
| } else { | } else { | ||
| - | if ($blockedBy) { | + | if ($LogHeaders) { |
| - | Write-Host (" | + | $xFail = $h[" |
| + | $xBlk = $h[" | ||
| + | $extra = @() | ||
| + | if ($xFail) { $extra += (" | ||
| + | if ($xBlk) | ||
| + | $suffix = "" | ||
| + | if ($extra.Count -gt 0) { $suffix = " | ||
| + | Write-Host (" | ||
| } else { | } else { | ||
| - | Write-Host (" | + | Write-Host (" |
| } | } | ||
| } | } | ||
| - | + | ||
| - | | + | |
| Start-Sleep -Milliseconds $DelayMs | Start-Sleep -Milliseconds $DelayMs | ||
| } | } | ||
| - | |||
| </ | </ | ||