Created
August 26, 2015 21:10
-
-
Save viovanov/40205cb1658b84c3c38d to your computer and use it in GitHub Desktop.
one liner for a powershell server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$l = New-Object System.Net.HttpListener ; $l.Prefixes.Add("http://+:8080/"); $l.Start(); while ($l.IsListening) { $c = $l.GetContext() ; $q = $c.Request; Write-Output (date); $r = $c.Response ; $m = [System.Text.ASCIIEncoding]::ASCII.GetBytes(((gci -path env:*) | Out-String)); $r.ContentLength64 = $m.Length ; $r.OutputStream.Write($m, 0, $m.Length) ; $r.OutputStream.Dispose(); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment