Exemplo n.º 1
0
 // Holy crap that looks awful, this needs reworked later on
 #region Impersonate button
 private void toolStripSplitButton1_ButtonClick(object sender, EventArgs e)
 {
     if (userCredentials.Key != null && userCredentials.Value != null)
     {
         isImpersonating = !isImpersonating;
         try
         {
             if (isImpersonating)
             {
                 impersonatedUser = new Impersonator(userCredentials.Key.ToString(), userCredentials.Value.ToString());
                 impersonatedUser.Impersonate();
                 toolStripSplitButton1.BackColor = Color.LightGreen;
                 statusMessage.Text = "Impersonating user: "******"Ended impersonation of user: "******"Invalid username or password"; }
     }
     else
     {
         ShowImpersonateDialog();
     }
 }
Exemplo n.º 2
0
        private void permissionsButton_Click(object sender, EventArgs e)
        {
            // Impersonates the specific user and reports back with permissions
            // If left blank then it uses the current user
            var test = new AdminShareTest();

            try
            {
                if (textBox1.Text != String.Empty && textBox2.Text != String.Empty)
                {
                    Impersonator user = new Impersonator(textBox1.Text, textBox2.Text);
                    user.Impersonate();
                    test.DiscoverPermissions(comboBox1.Text);
                    user.EndImpersonating();
                }
                else
                {
                    test.DiscoverPermissions(comboBox1.Text);
                }
                permissions.Text = test.report;
            }
            catch { permissions.Text = "Incorrect username or password"; }
        }
Exemplo n.º 3
0
        private void toolStripSplitButton1_ButtonClick(object sender, EventArgs e)
        {
            if (userCredentials.Key != null && userCredentials.Value != null)
            {
                isImpersonating = !isImpersonating;
                try
                {
                    if (isImpersonating)
                    {

                        impersonatedUser = new Impersonator(userCredentials.Key.ToString(), userCredentials.Value.ToString());
                        impersonatedUser.Impersonate();
                        toolStripSplitButton1.BackColor = Color.LightGreen;
                        statusMessage.Text = "Impersonating user: "******"Ended impersonation of user: "******"Invalid username or password"; }
            }
            else
            {
                ShowImpersonateDialog();
            }
        }
Exemplo n.º 4
0
        private void permissionsButton_Click(object sender, EventArgs e)
        {
            // Impersonates the specific user and reports back with permissions
            // If left blank then it uses the current user
            var test = new AdminShareTest();

            try
            {
                if (textBox1.Text != String.Empty && textBox2.Text != String.Empty)
                {
                    Impersonator user = new Impersonator(textBox1.Text, textBox2.Text);
                    user.Impersonate();
                    test.DiscoverPermissions(comboBox1.Text);
                    user.EndImpersonating();
                }
                else
                {
                    test.DiscoverPermissions(comboBox1.Text);
                }
                permissions.Text = test.report;
            }
            catch { permissions.Text = "Incorrect username or password"; }
        }