Ejemplo n.º 1
0
        private void LoadAtomicRTButton_Click(object sender, EventArgs e)
        {
            // msdn 4054d980-18f4-4857-bb47-0917ccdf4f4d

            atomicRT.AtomicsPath = AtomicRTPathTextbox.Text;
            Properties.Settings.Default.main_AtomicPath = AtomicRTPathTextbox.Text;
            // the following line will parse the "windows-index.md" file in the supplied folder for the atomics
            Dictionary <string, string> keyValues = atomicRT.ParseWindowsIndex();

            if (keyValues != null)
            {
                // if windows-index.md parses without errors, then populate the technique listview.
                TechniqueListView.BeginUpdate();
                TechniqueListView.Clear();
                TechniqueListView.Columns.Add("Technique");
                TechniqueListView.Columns.Add("Description");
                TechniqueListView.View = View.Details;
                int i = 0;
                while (i < keyValues.Count)
                {
                    TechniqueListView.Items.Add(new ListViewItem(new[] { keyValues.Keys.ElementAt(i), keyValues.Values.ElementAt(i) })
                    {
                        Checked = true
                    });
                    i++;
                }
                TechniqueListView.Columns[0].Width = -2;
                TechniqueListView.Columns[1].Width = -2;
                TechniqueListView.EndUpdate();
                LoadCommandsButton.Enabled = true;
            }
        }
Ejemplo n.º 2
0
        private void Main_Load(object sender, EventArgs e)
        {
            // the config from the previous session will be restored if this isn't the first run
            try
            {
                if (Properties.Settings.Default.FirstRun == false)
                {
                    if (Properties.Settings.Default.main_AtomicPath != null && System.IO.Directory.Exists(Properties.Settings.Default.main_AtomicPath))
                    {
                        AtomicRTPathTextbox.Text = Properties.Settings.Default.main_AtomicPath;
                        LoadAtomicRTButton_Click(sender, e);
                    }
                    try
                    {
                        authTabControl.SelectTab(Properties.Settings.Default.authMode);
                    }
                    catch
                    {
                        // do nothing
                    }
                }
                else
                {
                    string paExecFileLocation = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\paexec.exe";
                    if (System.IO.File.Exists(paExecFileLocation))
                    {
                        PAExecEXELocation.Text = paExecFileLocation;
                    }

                    string elevatedAccountFileLocation = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\ElevatedProcess.exe";
                    if (System.IO.File.Exists(elevatedAccountFileLocation))
                    {
                        ElevatedAccountEXELocation.Text = elevatedAccountFileLocation;
                    }
                }
            }
            catch
            {
                Properties.Settings.Default.Reset();
                Properties.Settings.Default.FirstRun = false;
                Properties.Settings.Default.Save();
                TechniqueListView.BeginUpdate();
                TechniqueListView.Items.Clear();
                TechniqueListView.EndUpdate();
            }

            // enable/disable buttons that rely on atomicRT path
            if (!string.IsNullOrEmpty(AtomicRTPathTextbox.Text.ToString()))
            {
                LoadAtomicRTButton.Enabled = true;
                LoadCommandsButton.Enabled = true;
                atomicRT.AtomicsPath       = AtomicRTPathTextbox.Text;
            }

            // enable/disable connect button based on required values
            ConnectButton.Enabled = !string.IsNullOrEmpty(AdminUsername.Text.ToString()) && !string.IsNullOrEmpty(PAExecEXELocation.Text.ToString()) &&
                                    !string.IsNullOrEmpty(TestComputer.Text.ToString()) && !string.IsNullOrEmpty(ElevatedAccountEXELocation.Text.ToString());
        }