Beispiel #1
0
        //Used to run various command line prompts for techs.
        public void Cmdline(string command, string mod)
        {
            ResultForm outputf = new ResultForm();

            outputf.Show();
            ProcessStartInfo psi = new ProcessStartInfo(command, mod);

            psi.Verb                   = "runas";
            psi.UseShellExecute        = false;
            psi.RedirectStandardOutput = true;
            psi.CreateNoWindow         = true;
            var    proc = Process.Start(psi);
            string s    = proc.StandardOutput.ReadToEnd();

            outputf.resbox.Text = s;
        }
Beispiel #2
0
        /* Used to ping the current network for occupied IP addresses and get their Hostname back if possible
         * Some equipment will not provide a hostname back, typically networking equipment and VoIP phones.
         * As the network scanner is being used to show available IPs and Machines these values will be added to a seperate
         * dictionary to be printed after.
         */
        public void Scanner()
        {
            //init this thread as main
            MainThread = SynchronizationContext.Current;
            if (MainThread == null)
            {
                MainThread = new SynchronizationContext();
            }

            // create new instance of loading screen

            ProgressForm running = new ProgressForm();

            running.Show();

            //Runs scanLoop to fill dictionaries and bags
            scanLoop();

            //When scanLoop ends the loading screen is closed
            running.Close();

            //create new instance of resultform for host/ip pairs to display
            ResultForm pingsweep = new ResultForm();

            pingsweep.Show();

            pingsweep.resbox.Text = "Found the following hosts:" + nl + nl;
            foreach (var iterHost in found.OrderBy(x => x.Key).Select(x => x.Value))
            {
                pingsweep.resbox.AppendText(iterHost + nl);
            }

            pingsweep.resbox.AppendText
                (Environment.NewLine + "Found the following Occupied IP's:" + nl + nl);
            foreach (var takenIP in occupied.OrderBy(x => x))
            {
                pingsweep.resbox.AppendText(takenIP + nl);
            }
            ;

            found    = new ConcurrentDictionary <string, string>();
            occupied = new ConcurrentBag <string>();
        }