Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
|
start [2025/12/06 09:49] jango |
start [2026/02/19 22:31] (aktuell) jango |
||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| < | < | ||
| - | # | + | param( |
| - | # | + | [string]$Url = "https:// |
| - | # | + | |
| - | #include " | + | |
| + | | ||
| + | ) | ||
| - | // Keyboard I/O | + | [Net.ServicePointManager]:: |
| - | #define KBD_DATA | + | if ($IgnoreCertErrors) { [System.Net.ServicePointManager]:: |
| - | #define KBD_STATUS 0x64 | + | |
| - | // Cursor ports | + | function New-BasicAuthValue([string]$User,[string]$Pass){ |
| - | #define VGA_CRTC_INDEX 0x3D4 | + | |
| - | #define VGA_CRTC_DATA | + | "Basic " |
| - | + | ||
| - | #define VGA_W 80 | + | |
| - | #define VGA_H (BUFSIZE / VGA_W) | + | |
| - | + | ||
| - | uint32 vga_index; | + | |
| - | static uint32 next_line_index = 1; | + | |
| - | uint8 g_fore_color = WHITE, g_back_color = BLUE; | + | |
| - | + | ||
| - | char str[128] = {0}; | + | |
| - | int strc = 0; | + | |
| - | + | ||
| - | uint8 inb(uint16 port) | + | |
| - | { | + | |
| - | | + | |
| - | asm volatile("inb %1, %0" : " | + | |
| - | return ret; | + | |
| } | } | ||
| - | void outb(uint16 port, uint8 data) | + | $req = [System.Net.HttpWebRequest]::Create($Url) |
| - | { | + | $req.Method = "GET" |
| - | asm volatile(" | + | $req.AllowAutoRedirect = $false |
| - | } | + | $req.Headers.Add("Authorization", (New-BasicAuthValue $Username $Password)) |
| - | static inline void outb(uint16 port, uint8 val) | + | $req.UserAgent = " |
| - | { | + | |
| - | asm volatile | + | |
| - | } | + | |
| - | static inline uint8 kbd_has_data(void) | + | try { $resp = $req.GetResponse() } |
| - | { | + | catch [System.Net.WebException] |
| - | return (inb(KBD_STATUS) & 0x01); | + | |
| - | } | + | |
| - | static inline uint8 kbd_read_data(void) | + | if ($resp) { |
| - | { | + | " |
| - | | + | " |
| + | " | ||
| + | | ||
| } | } | ||
| + | </ | ||
| - | // ---- tiny I/O wait (optional but useful) ---- | + | < |
| - | static inline void io_wait(void) | + | param( |
| - | { | + | |
| - | // klassischer "I/O wait" port | + | |
| - | | + | ) |
| - | | + | |
| - | | + | |
| - | } | + | |
| - | // --- repeat filter state --- | + | [Net.ServicePointManager]:: |
| - | static uint8 key_down[128] = {0}; | + | if ($IgnoreCertErrors) { [System.Net.ServicePointManager]:: |
| - | static uint8 e0_prefix = 0; | + | |
| - | // returns 1 if a NEW key press (make) should be processed, else 0 | + | $req = [System.Net.HttpWebRequest]: |
| - | int get_keycode_once(uint8 *out_scancode) | + | $req.Method |
| - | { | + | $req.AllowAutoRedirect |
| - | if (!kbd_has_data()) return 0; | + | |
| - | + | ||
| - | uint8 sc = kbd_read_data(); | + | |
| - | + | ||
| - | // Extended prefix | + | |
| - | if (sc == 0xE0) { e0_prefix = 1; return 0; } | + | |
| - | + | ||
| - | // If we currently don't support E0 keys: discard next byte cleanly | + | |
| - | if (e0_prefix) { e0_prefix = 0; return 0; } | + | |
| - | + | ||
| - | // Break (release) | + | |
| - | if (sc & 0x80) { | + | |
| - | uint8 make = sc & 0x7F; | + | |
| - | if (make < 128) key_down[make] | + | |
| - | return 0; | + | |
| - | } | + | |
| - | + | ||
| - | // Make (press) - suppress repeats | + | |
| - | if (sc < 128) { | + | |
| - | if (key_down[sc]) return 0; // typematic repeat ignore | + | |
| - | key_down[sc] = 1; | + | |
| - | } | + | |
| - | *out_scancode | + | try { |
| - | | + | $resp = $req.GetResponse() |
| + | } catch [System.Net.WebException] { | ||
| + | | ||
| } | } | ||
| - | static inline void vga_set_cursor(uint16 pos) | + | if ($resp) { |
| - | { | + | |
| - | | + | |
| - | | + | $resp.Headers.GetValues(" |
| - | | + | |
| - | | + | } else { |
| + | | ||
| } | } | ||
| + | </ | ||
| - | uint16 vga_entry(unsigned char ch, uint8 fore_color, uint8 back_color) | + | < |
| - | { | + | PS C: |
| - | | + | Target: https:// |
| - | uint8 attr = (back_color << 4) | (fore_color & 0x0F); | + | User: |
| - | | + | Count: |
| - | return ax; | + | |
| - | } | + | |
| - | void clear_vga_buffer(uint16 **buffer, uint8 fore_color, uint8 back_color) | + | [13: |
| - | { | + | [13: |
| - | | + | [13: |
| - | (*buffer)[i] = vga_entry(' ', fore_color, back_color); | + | [13: |
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| + | [13: | ||
| - | next_line_index = 1; | + | PS C: |
| - | | + | </ |
| - | | + | Hallo Besucher! Willkommen in diesem kleinen Wiki rund um IT. Vieles ist noch **unvollständig, |
| - | } | + | |
| - | void init_vga(uint8 fore_color, uint8 back_color) | + | Du kannst Artikel gerne [[todo|ergänzen oder verbessern]]. Gerne mit so vielen Links wie nötig. Bitte keine Werbelinks und nur selbst verfasste oder lizenzfreie Texte! Copyright beachten! |
| - | { | + | |
| - | vga_buffer = (uint16*)VGA_ADDRESS; | + | |
| - | clear_vga_buffer(& | + | |
| - | g_fore_color = fore_color; | + | |
| - | g_back_color = back_color; | + | |
| - | } | + | |
| - | // ---- SCROLL statt komplettes Löschen ---- | ||
| - | static void vga_scroll_if_needed(void) | ||
| - | { | ||
| - | if (vga_index < BUFSIZE) return; | ||
| - | // scroll um 1 Zeile nach oben | + | =====Fehlende Verlinkungen===== |
| - | for (uint32 i = 0; i < (VGA_H - 1) * VGA_W; i++) | + | |
| - | vga_buffer[i] | + | |
| - | // letzte Zeile leeren | + | Eine Liste von Seiten die noch erstellt werden müssen. |
| - | for (uint32 i = (VGA_H - 1) * VGA_W; i < VGA_H * VGA_W; i++) | + | |
| - | vga_buffer[i] = vga_entry(' | + | |
| - | vga_index = (VGA_H - 1) * VGA_W; | + | ~~ORPHANSWANTED: |
| - | } | + | |
| - | void print_new_line(void) | ||
| - | { | ||
| - | // auf Zeilenanfang springen | ||
| - | vga_index += VGA_W - (vga_index % VGA_W); | ||
| - | vga_scroll_if_needed(); | ||
| - | vga_set_cursor((uint16)vga_index); | ||
| - | // next_line_index ist jetzt eigentlich optional, aber falls du ihn weiter nutzt: | ||
| - | next_line_index = (vga_index / VGA_W) + 1; | ||
| - | } | ||
| - | void print_char(char ch) | + | <code powershell> |
| - | { | + | <# |
| - | | + | PowerShell 5.1 – EAS Basic-Auth Test (sendet IMMER weiter, auch bei 429) |
| - | + | ||
| - | | + | Optional: |
| - | | + | - -IgnoreCertErrors |
| - | + | - -LogHeaders um X-EAS-FAIL / X-Blocked-By etc. zu sehen, falls du die in HAProxy setzt. | |
| - | | + | #> |
| - | | + | |
| + | param( | ||
| + | [string]$Url | ||
| + | [string]$Username | ||
| + | | ||
| + | [int]$Count | ||
| + | [int]$DelayMs = 100, | ||
| + | | ||
| + | | ||
| + | | ||
| + | ) | ||
| + | |||
| + | # TLS 1.2 erzwingen | ||
| + | [Net.ServicePointManager]:: | ||
| + | |||
| + | # Optional: Zertifikatsfehler ignorieren | ||
| + | if ($IgnoreCertErrors) { | ||
| + | [System.Net.ServicePointManager]:: | ||
| } | } | ||
| - | + | ||
| - | void print_string(char *s) | + | function New-BasicAuthValue { |
| - | { | + | param([string]$User, |
| - | | + | $pair = "{0}: |
| - | print_char(s[i]); | + | |
| + | return "Basic $b64" | ||
| } | } | ||
| - | + | ||
| - | // ---- FIX: wait_for_io Underflow bug ---- | + | $auth = New-BasicAuthValue |
| - | void wait_for_io(uint32 timer_count) | + | |
| - | { | + | Write-Host (" |
| - | | + | Write-Host (" |
| - | | + | Write-Host (" |
| + | Write-Host "" | ||
| + | |||
| + | for ($i=1; $i -le $Count; $i++) { | ||
| + | $sw = [Diagnostics.Stopwatch]:: | ||
| + | $code = -1 | ||
| + | $err = $null | ||
| + | $h = @{} | ||
| + | |||
| + | | ||
| + | $req = [System.Net.HttpWebRequest]:: | ||
| + | $req.Method = " | ||
| + | $req.AllowAutoRedirect = $false | ||
| + | $req.Timeout = $TimeoutSec * 1000 | ||
| + | $req.ReadWriteTimeout = $TimeoutSec * 1000 | ||
| + | $req.UserAgent = "EAS-Test/ | ||
| + | $req.Headers.Add(" | ||
| + | | ||
| + | |||
| + | $resp = $req.GetResponse() | ||
| + | $code = [int]$resp.StatusCode | ||
| + | if ($LogHeaders) { | ||
| + | foreach ($k in $resp.Headers.AllKeys) { $h[$k] = $resp.Headers[$k] } | ||
| + | } | ||
| + | $resp.Close() | ||
| } | } | ||
| - | } | + | catch [System.Net.WebException] { |
| - | + | if ($_.Exception.Response) { | |
| - | void sleep(uint32 timer_count) | + | |
| - | { | + | |
| - | wait_for_io(timer_count); | + | if ($LogHeaders) { |
| - | } | + | |
| - | + | ||
| - | // ---- kleiner case-insensitive Vergleich ---- | + | |
| - | static int streq_ci(const char *a, const char *b) | + | |
| - | { | + | |
| - | while (*a && *b) { | + | |
| - | char ca = *a, cb = *b; | + | |
| - | if (ca >= ' | + | |
| - | if (cb >= ' | + | |
| - | if (ca != cb) return 0; | + | |
| - | a++; b++; | + | |
| - | } | + | |
| - | return (*a == 0 && *b == 0); | + | |
| - | } | + | |
| - | + | ||
| - | static void reset_input_line(void) | + | |
| - | { | + | |
| - | strc = 0; | + | |
| - | str[0] = 0; | + | |
| - | } | + | |
| - | + | ||
| - | static void append_char(char ch) | + | |
| - | { | + | |
| - | if (strc >= (int)sizeof(str) - 1) return; // bounds check | + | |
| - | str[strc++] = ch; | + | |
| - | str[strc] = 0; | + | |
| - | print_char(ch); | + | |
| - | } | + | |
| - | + | ||
| - | void loop(void) | + | |
| - | { | + | |
| - | uint8 keycode; | + | |
| - | + | ||
| - | while (1) { | + | |
| - | + | ||
| - | if (!get_keycode_once(& | + | |
| - | | + | |
| - | // Achtung: hlt braucht Interrupts; falls die bei dir noch nicht an sind, | + | |
| - | // kannst du statt hlt ein kleines wait_for_io() nutzen. | + | |
| - | | + | |
| - | continue; | + | |
| - | } | + | |
| - | + | ||
| - | if (keycode | + | |
| - | print_new_line(); | + | |
| - | + | ||
| - | // Command ausführen | + | |
| - | if (strc > 0) { | + | |
| - | | + | |
| - | print_string(" | + | |
| - | print_new_line(); | + | |
| - | print_string(" | + | |
| - | print_new_line(); | + | |
| - | | + | |
| - | // hier später weitere Commands... | + | |
| } | } | ||
| - | + | $resp.Close() | |
| - | // neues Prompt | + | } else { |
| - | print_string("> "); | + | |
| - | | + | |
| - | | + | |
| } | } | ||
| - | + | } | |
| - | | + | catch { |
| - | // nur löschen, wenn wir nach dem Prompt sind und auch was im Buffer ist | + | |
| - | if (strc > 0 && vga_index | + | } |
| - | // optional: Schutz, dass du nicht ins Prompt reinlöschst | + | |
| - | | + | $sw.Stop() |
| - | if (vga_index > prompt_start) { | + | $ts = (Get-Date).ToString(" |
| - | vga_index--; | + | |
| - | strc--; | + | if ($code -eq -1) { |
| - | str[strc] | + | Write-Host ("[{0}] #{1,4} -> HTTP -1 ({2} ms) ERROR={3}" -f $ts, $i, $sw.ElapsedMilliseconds, |
| - | | + | } else { |
| - | | + | if ($LogHeaders) { |
| - | } | + | $xFail = $h["X-EAS-FAIL"] |
| - | } | + | $xBlk |
| - | continue; | + | |
| + | | ||
| + | if ($xBlk) | ||
| + | | ||
| + | if ($extra.Count -gt 0) { $suffix = " | ||
| + | | ||
| + | } else { | ||
| + | | ||
| } | } | ||
| - | |||
| - | if (keycode == KEY_SPACE) { | ||
| - | append_char(' | ||
| - | continue; | ||
| - | } | ||
| - | |||
| - | char ch = get_ascii_char(keycode); | ||
| - | |||
| - | // Erlaubte Zeichen: A-Z, 0-9, ' | ||
| - | if (ch == ' | ||
| - | (ch >= ' | ||
| - | (ch >= ' | ||
| - | append_char(ch); | ||
| - | } | ||
| - | |||
| - | // kein riesiger busy-sleep mehr nötig | ||
| - | io_wait(); | ||
| } | } | ||
| - | } | + | |
| - | + | | |
| - | void kernel_entry(void) | + | |
| - | { | + | |
| - | | + | |
| - | | + | |
| - | print_new_line(); | + | |
| - | print_string(" | + | |
| - | print_new_line(); | + | |
| - | print_string(" | + | |
| - | print_new_line(); | + | |
| - | print_string("> | + | |
| - | reset_input_line(); | + | |
| - | loop(); | + | |
| } | } | ||
| </ | </ | ||
| - | |||
| - | Hallo Besucher! Willkommen in diesem kleinen Wiki rund um IT. Vieles ist noch **unvollständig, | ||
| - | |||
| - | Du kannst Artikel gerne [[todo|ergänzen oder verbessern]]. Gerne mit so vielen Links wie nötig. Bitte keine Werbelinks und nur selbst verfasste oder lizenzfreie Texte! Copyright beachten! | ||
| - | |||
| - | |||
| - | =====Fehlende Verlinkungen===== | ||
| - | |||
| - | Eine Liste von Seiten die noch erstellt werden müssen. | ||
| - | |||
| - | ~~ORPHANSWANTED: | ||
| - | |||
| - | |||