Example #1
0
        //This process runs the live host and the nmap scan if the ping was a success.
        private void ScanprocessReturn()
        {
            //Error checking to make sure the IP Address is in the correct format

            if ((LocalNetwork.IsChecked == false) && (CheckValidation.IsValidateIP(IpAddress.Text) != "True"))
            {
                Output.Text = "This IP Address is not in the correct format!  Correct example 127.0.0.1";
            }
            else
            {
                //this variable is called from the nmap scan to run a scan on all 65535 ports
                AllPortCheck = AllPorts.IsChecked.Value;

                //this variable is called from the nmap scan to run a nmap scan on all devices on a class C network
                WholeNetworkCheck = WholeNetwork.IsChecked.Value;
                //this is set to true to show generic progress and not a percentage style
                pbStatus.IsIndeterminate = true;
                //start an async progress bar output
                BackgroundWorker worker = new BackgroundWorker();
                worker.WorkerReportsProgress = true;
                worker.DoWork += worker_DoWork;

                //output the results of the View model and scan and display them in the output text block
                Output.Text = (MPVM.DisplayOutput(IpAddress.Text));


                //if the live host scan was a success then make the progress bar visable

                if (State.SuccessfulPing)
                { //(ASCII ART FOR A BIT OF FUN) the formatting is for the center of the screen as it is a fixed size
                    Output.Text += "\n";
                    Output.Text += "\n                                 ##########################";
                    Output.Text += "\n                                 ### FULL SCAN IN PROGRESS ###";
                    Output.Text += "\n                                 ##########################";
                    Output.Text += "\n";

                    // show status bar when scan is running
                    pbStatus.Visibility = Visibility.Visible;
                }

                MPVM.ScanComplete += ScanCompleteHandler;

                worker.RunWorkerAsync();
            }
        }