private void BackgroundWorkerDoWork(object sender, DoWorkEventArgs e) { var worker = sender as BackgroundWorker; for (int i = 0; i < modulesController.Count; i++) { if (worker.CancellationPending) { e.Cancel = true; return; } modulesController.RunNextModule(); TelnetConnector.Instance.Execute("whoami"); // just to ensure we will get all notifys if (LiveCommands.Count > 0) { LiveCommands.RunCommands(); } if (queryEvents.Count > 0) { queryEvents.HandleQueryEvents(); } } Thread.Sleep(100); //ConsoleEx.WriteLine("Users currently online: " + Commands.GetClientsCount() + "/" + Commands.GetMaxClients()); }