private void LoadCommandsButton_click(object sender, EventArgs e) { // populate the CmdQueueListView with executors of the selected techniques var checkedTechniques = TechniqueListView.CheckedItems; CmdQueueListView.BeginUpdate(); CmdQueueListView.Clear(); CmdQueueListView.Columns.Add("Technique"); CmdQueueListView.Columns.Add("Command"); CmdQueueListView.View = View.Details; foreach (ListViewItem item in checkedTechniques) { string technique = item.SubItems[0].Text.ToString(); // e.g. "T1017" var thisAtomic = atomicRT.GetAtomicByTechnique(technique); List <string> executors = atomicRT.BuildWindowsExecutors(thisAtomic); // assembles the commands foreach (string executor in executors) { // add each command to the listview CmdQueueListView.Items.Add(new ListViewItem(new[] { technique, executor }) { Checked = true }); } } CmdQueueListView.Columns[0].Width = -2; CmdQueueListView.Columns[1].Width = -2; CmdQueueListView.EndUpdate(); ExecuteButton.Enabled = KillButton.Enabled; }
private void UpdateTree() { try { var split = AtomicListBox.Items[AtomicListBox.SelectedIndex].ToString().Split(new string[1] { "\t" }, StringSplitOptions.None); SelectedTechnique = split[0]; SelectedTechniqueName = split[1]; AtomicTreeView.BeginUpdate(); AtomicTreeView.Nodes.Clear(); AtomicTreeView.Nodes.AddRange(atomicRT.AtomicToTreeNodes(atomicRT.GetAtomicByTechnique(SelectedTechnique))); AtomicTreeView.ExpandAll(); AtomicTreeView.Nodes[0].EnsureVisible(); AtomicTreeView.SelectedNode = AtomicTreeView.Nodes[0]; AtomicTreeView.EndUpdate(); SaveTreeButton.Text = "Save"; ShouldSaveTree = false; } catch { // nothing } }