Пример #1
0
        private void ParseTemplate(int delayMillSeconds = 100, bool forceExecute = false)
        {
            TaskHelper.Delay("MainWindow+ParseTemplate", () =>
            {
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    LicenseHelper.Instance.Validation();

                    if (ResultTextEditor.AutoCalculate || forceExecute)
                    {
                        var whereText = TextBoxWhere.Text;
                        var template  = TemplateTextEditor.textEditor.Text;

                        var appendNewLine = ResultTextEditor.AppendNewLine;
                        var expandos      = InputTextEditor.GetExpandoObjects(InputTextEditor.EditorMode);

                        ResultTextEditor.AddMessage("Info", "Processing...");

                        // run a task to execute code.
                        Task.Factory.StartNew(() =>
                        {
                            var codeRunner = new CodeRunner();
                            return(codeRunner.ApplyTemplate(expandos, whereText, template, appendNewLine));
                        }).ContinueWith(tt =>
                        {
                            var result = tt.Result;

                            Dispatcher.BeginInvoke(new Action(() =>
                            {
                                ResultTextEditor.textEditor.Text = result.Message;
                                ResultTextEditor.AddMessage("Error", result.Error);
                            }));
                        });
                    }
                }));
            }, delayMillSeconds);
        }
Пример #2
0
        private void bgWorker_req_maker_DoWork(object sender, DoWorkEventArgs e)
        {
            if (AbdalControler.unauthorized_process == true)
            {
                MessageBox.Show("This domain is unauthorized !");
                Application.Exit();
            }
            else
            {
                try
                {
                    if (ExtractRichTextBox.Lines.Length <= 1)
                    {
                        MessageBox.Show("Crawled links must be greater than one ! ");
                    }
                    else
                    {
                        BackgroundWorker worker = sender as BackgroundWorker;

                        Chilkat.Http http = new Chilkat.Http();
                        http.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.9 Safari/537.36";

                        int number_of_attack_req = Convert.ToInt32(textBox_number_of_views.Value) * (Convert.ToInt32(ExtractRichTextBox.Lines.Length) - 1);
                        radProgressBar1.Maximum = number_of_attack_req;
                        radProgressBar1.Minimum = 0;

                        radialGaugeArc2.RangeStart = 0;
                        radialGaugeArc2.RangeEnd   = number_of_attack_req;
                        radialGaugeArc1.RangeStart = 0;
                        radialGaugeArc1.RangeEnd   = number_of_attack_req;
                        radRadialGauge1.RangeEnd   = number_of_attack_req;

                        //Sound Alert For Start Attack
                        using (var soundPlayer = new SoundPlayer(@"start.wav"))
                        {
                            soundPlayer.PlaySync(); // can also use soundPlayer.Play()
                        }



                        int trafficSizebyte = 0;
                        int traffic_counter = 0;
                        for (int i = 1; i <= textBox_number_of_views.Value; i++)
                        {
                            if (worker.CancellationPending == true)
                            {
                                e.Cancel = true;
                                break;
                            }
                            else
                            {
                                string[] RichTextBoxLines = ExtractRichTextBox.Lines;
                                foreach (string line_url_addr in RichTextBoxLines)
                                {
                                    if (line_url_addr != "")
                                    {
                                        traffic_counter++;
                                        radRadialGauge1.Value  = traffic_counter;
                                        radProgressBar1.Value2 = traffic_counter;

                                        //randString = RandomString(rnd.Next(15, 30));
                                        // Send the HTTP GET and return the content in a string.
                                        http.ReadTimeout     = 20;
                                        http.ConnectTimeout  = 20;
                                        http.FollowRedirects = true;
                                        if (spoofUrlTextBox.Text != "")
                                        {
                                            http.Referer = spoofUrlTextBox.Text;
                                        }



                                        string reponse_http = http.QuickGetStr(line_url_addr);

                                        trafficSizebyte           += System.Text.ASCIIEncoding.Unicode.GetByteCount(reponse_http);
                                        trafficSizebyte_Label.Text = (trafficSizebyte / 1024).ToString() + " KB";

                                        //Add AttackLog in Result Box
                                        ResultTextEditor.AppendText(line_url_addr + Environment.NewLine);
                                        ResultTextEditor.SelectionStart = ResultTextEditor.Text.Length;
                                        ResultTextEditor.ScrollToCaret();

                                        // Perform a time consuming operation and report progress.
                                        if (FastTrafficGenToggleSwitch.Value == false)
                                        {
                                            System.Threading.Thread.Sleep(500);
                                        }

                                        worker.ReportProgress(i);
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            } // End else
        }