Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Simple but dirty Powershell web proxy
#simple and dirty proxy
$Up = "http://+:8000/"
$Hso = New-Object Net.HttpListener
$Wco = New-Object Net.Webclient
#ignore self-signed/invalid ssl certs
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$True}
Foreach ($P in $Up) {$Hso.Prefixes.Add($P)}
While ($Hso.IsListening) {
$HC = $Hso.GetContext()
$HReq = $HC.Request
$HRes = $HC.Response
$ProxURL = $HReq.QueryString['URL']
If ($ProxURL) {$Content = $Wco.downloadString("$ProxURL")}
$Buf = [Text.Encoding]::UTF8.GetBytes($Content)
$HRes.ContentLength64 = $Buf.Length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment