From 98f1a1e9cc37fb4ee0ea731b67ef748dd7f60dcd Mon Sep 17 00:00:00 2001 From: Limour <93720049+Limour-dev@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:44:52 +0800 Subject: [PATCH] Add files via upload --- httpd.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 httpd.ps1 diff --git a/httpd.ps1 b/httpd.ps1 new file mode 100644 index 0000000..453eaf0 --- /dev/null +++ b/httpd.ps1 @@ -0,0 +1,18 @@ +$listener = New-Object System.Net.HttpListener +$listener.Prefixes.Add("http://+:80/") +$listener.Start() +Write-Host "Listening..." + +while ($listener.IsListening) { + $context = $listener.GetContext() + $request = $context.Request + $response = $context.Response + $response.Headers.Add("Content-Type", "application/octet-stream") + + $file = "$(Get-Location)\client.html" + $buffer = [System.IO.File]::ReadAllBytes($file) + $response.ContentLength64 = $buffer.Length + $output = $response.OutputStream + $output.Write($buffer, 0, $buffer.Length) + $output.Close() +} \ No newline at end of file