Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Limour-dev authored Nov 5, 2024
1 parent 3fe38dc commit 98f1a1e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions httpd.ps1
Original file line number Diff line number Diff line change
@@ -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()
}

0 comments on commit 98f1a1e

Please sign in to comment.