/// <summary>
        /// Run only once every 5 seconds, since WMI queries are resource hogs
        /// </summary>
        public override void check()
        {
            // Start stopwatch
            if (stopwatch == null || stopwatch.IsRunning == false)
            {
                stopwatch = new Stopwatch();
                stopwatch.Start();
            }

            // If under X amount of milliseconds, don't continue
            if (stopwatch.ElapsedMilliseconds < 5000)
            {
                return;
            }

            Console.WriteLine("Checking BitLocker status...");
            if (WMIController.checkBitLockerStatus())
            {
                this.status = Status.OK;
            }
            else
            {
                this.status = Status.FAIL;
            }

            // Restart stopwatch, so that it doesn't have to be
            // started again
            stopwatch.Restart();
        }
Ejemplo n.º 2
0
        public override Control[] getEditControls()
        {
            List <Control> controls = new List <Control>();

            // ReadFromCSVLabel
            Label ReadFromCSVLabel = new Label();

            ReadFromCSVLabel.Location = new System.Drawing.Point(0, 0);
            ReadFromCSVLabel.Width    = 300;
            ReadFromCSVLabel.Text     = "Read From CSV (Comma delimited):";
            controls.Add(ReadFromCSVLabel);

            // ReadFromCSV
            TextBox readFromCSVCB = new TextBox();

            readFromCSVCB.Location     = new System.Drawing.Point(0, 25);
            readFromCSVCB.Width        = 250;
            readFromCSVCB.Text         = this.readFromCSV;
            readFromCSVCB.TextChanged += new EventHandler(ReadFromCSV_TextChanged);
            controls.Add(readFromCSVCB);

            // ReadFromCSVDescription
            Label ReadFromCSVDescription = new Label();

            ReadFromCSVDescription.Location  = new System.Drawing.Point(0, 50);
            ReadFromCSVDescription.Width     = 450;
            ReadFromCSVDescription.Height    = 250;
            ReadFromCSVDescription.ForeColor = System.Drawing.Color.Gray;
            ReadFromCSVDescription.Text      = "Leave this to empty, to deactivate.\nEnter the file name and insert the file into the same directory with the application's .exe\nThis reads the first column as the key to look for and the second column as the value.";
            controls.Add(ReadFromCSVDescription);

            // KeyLookType
            List <String> options = new List <String>();

            options.Add("Custom");
            options.AddRange(WMIController.getComputerSystemInfoOptions());

            ComboBox KeyLookType = new ComboBox();

            KeyLookType.Location      = new System.Drawing.Point(0, 100);
            KeyLookType.Width         = 450;
            KeyLookType.DropDownStyle = ComboBoxStyle.DropDownList;
            KeyLookType.Items.AddRange(options.ToArray());
            controls.Add(KeyLookType);

            Label RememberToRemoveTPM = new Label();

            RememberToRemoveTPM.Location  = new System.Drawing.Point(0, 120);
            RememberToRemoveTPM.Width     = 450;
            RememberToRemoveTPM.Height    = 250;
            RememberToRemoveTPM.ForeColor = System.Drawing.Color.Gray;
            RememberToRemoveTPM.Text      = "If you want it so that the Bitlocker password will be asked on boot,\nalso add the Remove TPM Success Module.";
            controls.Add(RememberToRemoveTPM);

            return(controls.ToArray());
        }
        public Control[] getEditControls()
        {
            List <Control> controls = new List <Control>();

            // ValueLabel
            Label KeyLabel = new Label();

            KeyLabel.Location = new System.Drawing.Point(0, 0);
            KeyLabel.Height   = 25;
            KeyLabel.Width    = 200;
            KeyLabel.Text     = "Key";
            controls.Add(KeyLabel);

            // KeyTextBox
            ComboBox KeyComboBox = new ComboBox();

            KeyComboBox.Width                 = 200;
            KeyComboBox.Location              = new System.Drawing.Point(0, 25);
            KeyComboBox.SelectedValueChanged += new EventHandler(KeyComboBox_SelectedValueChanged);
            KeyComboBox.Items.AddRange(WMIController.getComputerSystemInfoOptions());
            KeyComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            controls.Add(KeyComboBox);

            // ValueLabel
            Label ValueLabel = new Label();

            ValueLabel.Location = new System.Drawing.Point(0, 50);
            ValueLabel.Height   = 25;
            ValueLabel.Width    = 200;
            ValueLabel.Text     = "Value";
            controls.Add(ValueLabel);

            // ValueTextBox
            TextBox ValueTextBox = new TextBox();

            ValueTextBox.Width        = 200;
            ValueTextBox.Location     = new System.Drawing.Point(0, 75);
            ValueTextBox.TextChanged += new EventHandler(ValueTextBox_TextChanged);
            controls.Add(ValueTextBox);

            // ComputerSystemInfo
            Button computerInfo = new Button();

            computerInfo.Location = new System.Drawing.Point(0, 200);
            computerInfo.Size     = new System.Drawing.Size(90, 23);
            computerInfo.Text     = "Computer info";
            computerInfo.UseVisualStyleBackColor = true;
            computerInfo.Click += new System.EventHandler(computerInfo_Click);
            controls.Add(computerInfo);

            return(controls.ToArray());
        }
 public void init()
 {
     computersystem = WMIController.getComputerSystemInfo();
 }
Ejemplo n.º 5
0
 public override void run()
 {
     WMIController.removeTPM(WMIController.getDeviceID());
 }