private void bt_LERC_online_Click(object sender, EventArgs e) { bool server = false; if (cb_AgentType.SelectedIndex == 1) { server = true; } var commandLine = @"\\" + Computername + @"\admin$\System32\msiexec.exe -i \\" + Computername + @"\c$\tmp\lercSetup.msi /qn /l lerc_install.log company=2 reconnectdelay=60 chunksize=2048 serverurls=https://control.integraldefense.com/"; bt_LERC_online.Enabled = false; if (BEFunctions.copyCB(Computername, server)) { tb_Display.AppendText("LERC Package copied."); tb_Display.AppendText(Environment.NewLine); } var returnval = BEFunctions.installCB(Computername, commandLine); if (returnval != -1) { tb_Display.AppendText(String.Format("CB Package installer started, Process ID {0}.", returnval)); tb_Display.AppendText(Environment.NewLine); } }
private void bt_Execute_Click(object sender, EventArgs e) { bt_Execute.Enabled = false; foreach (DataGridViewRow row in dataGridView1.Rows) { Task resultTask = Task.Factory.StartNew(() => { try { if (row.Cells[2].Value.ToString() == "True") { bool server = false; if (cb_AgentType.SelectedIndex == 1) { server = true; } row.Cells[4].Value = "Copying"; BEFunctions.copyCB((row.Cells[0].Value.ToString()), server); row.Cells[4].Value = "Unzipping"; BEFunctions.unZipCB((row.Cells[0].Value.ToString())); row.Cells[4].Value = "Installing"; var commandLine = @"\\" + row.Cells[0].Value.ToString() + @"\admin$\System32\msiexec.exe -i \\" + row.Cells[0].Value.ToString() + @"\c$\tmp\cbsetup.msi /qn"; BEFunctions.installCB((row.Cells[0].Value.ToString()), commandLine); } } catch { } }); } }
private void bt_Install_Click(object sender, EventArgs e) { bool server = false; if (cb_AgentType.SelectedIndex == 1) { server = true; } var commandLine = @"\\" + Computername + @"\admin$\System32\msiexec.exe -i \\" + Computername + @"\c$\tmp\cbsetup.msi /qn /L*v \\" + Computername + @"\c$\tmp\cbsetup.log"; bt_Install.Enabled = false; if (BEFunctions.copyCB(Computername, server)) { tb_Display.AppendText("CB Package copied."); tb_Display.AppendText(Environment.NewLine); Thread.Sleep(500); } if (BEFunctions.unZipCB(Computername)) { tb_Display.AppendText("CB Package unzipped."); tb_Display.AppendText(Environment.NewLine); Thread.Sleep(500); } var returnval = BEFunctions.installCB(Computername, commandLine); if (returnval != -1) { tb_Display.AppendText(String.Format("CB Package installer started, Process ID {0}.", returnval)); tb_Display.AppendText(Environment.NewLine); } }
private void bt_Check_Click(object sender, EventArgs e) { bt_Check.Enabled = false; //Task resultTask = new; foreach (DataGridViewRow row in dataGridView1.Rows) { Task resultTask = Task.Factory.StartNew(() => { try { if (BEFunctions.MachineOnline(row.Cells[0].Value.ToString())) { row.Cells[1].Value = "True"; // lbl_Check_Count.Text = totalchecked.ToString(); } else { row.Cells[1].Value = "False"; totalchecked++; // lbl_Check_Count.Text = totalchecked.ToString(); } if (row.Cells[1].Value.ToString() == "True") { if (BEFunctions.canReachPath(row.Cells[0].Value.ToString())) { row.Cells[2].Value = "True"; } else { row.Cells[2].Value = "False"; totalchecked++; } if (row.Cells[2].Value.ToString() == "True") { if (BEFunctions.isCBInstalled(row.Cells[0].Value.ToString())) { row.Cells[3].Value = "True"; totalchecked++; } else { row.Cells[3].Value = "False"; totalchecked++; } } } lbl_Check_Count.Text = totalchecked.ToString(); } catch { } }); } if (totalcount == totalchecked) { bt_Execute.Enabled = true; } }
public frm_LRInstall(string Hostname) { InitializeComponent(); ComputerName = Hostname; lbl_CN.Text = ComputerName; sensorID = BEFunctions.GetSensorIdForHost(ComputerName); lbl_SensorID.Text = sensorID.ToString(); lbl_LR_Status.Text = "Disconnected"; }
private void bt_Lerc_Offline_Click(object sender, EventArgs e) { bt_Lerc_Offline.Enabled = false; Computername = textBox1.Text; if (BEFunctions.CreateTask(Computername)) { tb_Display.AppendText("LERC Package install task scheduled."); tb_Display.AppendText(Environment.NewLine); } }
private void bt_Uninstall_Click(object sender, EventArgs e) { var returnval = BEFunctions.uninstallCB(Computername); if (returnval != -1) { tb_Display.AppendText(String.Format("CB Package uninstaller started, Process ID {0}.", returnval)); tb_Display.AppendText(Environment.NewLine); } }
private async void bt_Load_Click(object sender, EventArgs e) { try { var sensorId = BEFunctions.GetSensorIdForHost(ComputerName); if (sensorId == -1) { MessageBox.Show(String.Format("A matching sensor could not be found for the Sensor Hostname: '{0}'", ComputerName)); return; } using (cancelSource = new CancellationTokenSource()) { var resultCount = 0; var totalCount = 0; do { resultCount = await cb.UpdateFilesBatch(filesystem, sensorId, totalCount, 500, cancelSource.Token); if (resultCount < 0) { return; } totalCount += resultCount; lbl_Counts.Text = totalCount.ToString(); }while (resultCount > 0); lbl_Counts.Text = totalCount.ToString(); } MessageBox.Show("Done."); PopulateTree(tv_Files, filesystem); } catch (Exception ex) { MessageBox.Show(String.Format("An error occured: {0}", ex.ToString())); } }
public void GetInfoBox() { bool Isonline; Computername = textBox1.Text; //Machine preflight checks is it online? Isonline = BEFunctions.MachineOnline(Computername); if (Isonline == true) { tb_Display.AppendText("Machine is online"); tb_Display.AppendText(Environment.NewLine); if (BEFunctions.canReachPath(Computername)) { tb_Display.AppendText("Admin share is accessible"); tb_Display.AppendText(Environment.NewLine); rb_Online.Checked = true; bt_Install.Enabled = true; } else { tb_Display.AppendText("Admin share is inaccessible"); tb_Display.AppendText(Environment.NewLine); rb_Offline.Checked = true; } //IS CB Installed? if (rb_Online.Checked) { if (BEFunctions.isCBInstalled(Computername)) { tb_Display.AppendText("Carbon Black local install found"); tb_Display.AppendText(Environment.NewLine); bt_Uninstall.Enabled = true; } else { tb_Display.AppendText("Carbon Black local install NOT found"); tb_Display.AppendText(Environment.NewLine); } } CBSensor cbSensor = BEFunctions.getCBSensorInfo(Computername); if (!(cbSensor.id == 0)) { tb_Display.AppendText("Carbon Black sensor found on server: " + cbSensor.id); tb_Display.AppendText(Environment.NewLine); tb_Display.AppendText("Carbon Black sensor version: " + cbSensor.build_version_string); tb_Display.AppendText(Environment.NewLine); tb_Display.AppendText("CB Last check-in: " + cbSensor.last_checkin_time); tb_Display.AppendText(Environment.NewLine); tb_Display.AppendText("CB Client OS: " + cbSensor.os_environment_display_string); tb_Display.AppendText(Environment.NewLine); bt_ViewFiles.Enabled = true; bt_LR_Install.Enabled = true; } else { tb_Display.AppendText("Carbon Black sensor instance not found."); tb_Display.AppendText(Environment.NewLine); } } else { tb_Display.AppendText("Machine hostname is offline."); tb_Display.AppendText(Environment.NewLine); rb_Offline.Checked = true; bt_Install_Sched.Enabled = true; CBSensor cbSensor = BEFunctions.getCBSensorInfo(Computername); if (!(cbSensor.id == 0)) { tb_Display.AppendText("Carbon Black sensor found on server: " + cbSensor.id); tb_Display.AppendText(Environment.NewLine); tb_Display.AppendText("Carbon Black sensor version: " + cbSensor.build_version_string); tb_Display.AppendText(Environment.NewLine); tb_Display.AppendText("CB Last check-in: " + cbSensor.last_checkin_time); tb_Display.AppendText(Environment.NewLine); tb_Display.AppendText("CB Client OS: " + cbSensor.os_environment_display_string); tb_Display.AppendText(Environment.NewLine); //bt_ViewFiles.Enabled = true; bt_LR_Install.Enabled = true; } else { tb_Display.AppendText("Carbon Black sensor instance not found."); tb_Display.AppendText(Environment.NewLine); } } }