示例#1
0
文件: Form1.cs 项目: Hydrapepe/test1
        public void Pepegoto()
        {
            DOMAIN_NAME_FULL = textBox32.Text;
            IP_ADDRESS       = textBox33.Text;
            NAME_USER        = textBox34.Text;
            string[] words     = DOMAIN_NAME_FULL.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
            string   WORKGROUP = words[0].ToUpper(new CultureInfo("en-US", false));

            DOMAIN_NAME_FULL = DOMAIN_NAME_FULL.ToUpper(new CultureInfo("en-US", false));
            Hydra            = "#!/bin/bash\nadusername='******'\nip='" + IP_ADDRESS + "'\ndomain='" + words[0] + "'\nworkgroup='" + WORKGROUP + "'\nrealm='" + DOMAIN_NAME_FULL + "'\napt update\napt install net-tools -y\napt install postfix dovecot-dev -y\napt install krb5-user samba winbind -y\nrm -rf /etc/resolv.conf\necho -e \"domain $domain\\nsearch $domain\\nnameserver $ip\" > /etc/resolv.conf\nsed - i 's/WORKGROUP/'$workgroup'/' / etc / samba / smb.conf\nsed -i '/Networking/a realm = '$realm'' /etc/samba/smb.conf\nsed -i 's/standalone server/member server/' /etc/samba/smb.conf\necho '**************************************'\necho 'Vvedite parol ot uchetki Active Directory'\necho '**************************************'\nnet ads join -U $adusername -D $realm\necho ''\necho '**************************************'\necho 'Informaciya o Domene'\necho '**************************************'\nnet ads info";
        }//Bash file internals
示例#2
0
文件: Form1.cs 项目: Hydrapepe/test1
        }//how many user generate

        private void Button2_Click(object sender, EventArgs e)
        {
            Stats("3", Convert.ToInt32(COUNT));
            DOMAIN_NAME_FULL = textBox20.Text;
            NAME_GROUP       = textBox18.Text;
            SERVER_NAME_FULL = textBox19.Text + "." + DOMAIN_NAME_FULL;
            USER_NAME        = textBox17.Text;
            COUNT            = textBox21.Text;
            USER_NAME2       = textBox16.Text;
            USER_NAME3       = textBox15.Text;
            PASSWORD         = textBox14.Text;
            string[] words = DOMAIN_NAME_FULL.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
            try
            {
                words[0]          = "DC=" + words[0];
                SERVER_DOT_SPLIT  = words[0];
                words[1]          = ",DC=" + words[1];
                SERVER_DOT_SPLIT += words[1];
                words[2]          = ",DC=" + words[2];
                SERVER_DOT_SPLIT += words[2];
                words[3]          = ",DC=" + words[3];
                SERVER_DOT_SPLIT += words[3];
                words[4]          = ",DC=" + words[4];
                SERVER_DOT_SPLIT += words[4];
                words[5]          = ",DC=" + words[5];
                SERVER_DOT_SPLIT += words[5];
            }
            catch
            {
                string zaglyshka  = "New-ADOrganizationalUnit -Name:\"" + NAME_GROUP + "\" -Path:\"" + SERVER_DOT_SPLIT + "\" -ProtectedFromAccidentalDeletion:$true -Server:\"" + SERVER_NAME_FULL + "\"\n";
                string zaglyshka1 = NAME_GROUP?.Length == 0
                    ? "$org=\"" + SERVER_DOT_SPLIT + "\";\n$username=\"" + USER_NAME3 + "\";\n$count=1.." + COUNT + ";\nforeach ($i in $count)\n{{New-AdUser -Name \"" + USER_NAME3 + "$i\" -GivenName \"" + USER_NAME3 + "$i\" -Surname \"" + USER_NAME2 + "$i\" -SamAccountName \"" + USER_NAME + "$i\" -UserPrincipalName \"" + USER_NAME + "$i@" + DOMAIN_NAME_FULL + "\" -Path $org -Enabled $True -ChangePasswordAtLogon $true -AccountPassword (ConvertTo-SecureString \"" + PASSWORD + "\" -AsPlainText -force) -passThru }}"
                    : "$org=\"OU=" + NAME_GROUP + "," + SERVER_DOT_SPLIT + "\"" +
                                    "\n$username=\"" + USER_NAME3 + "\"" +
                                    "\n$count=1.." + COUNT +
                                    "\nforeach ($i in $count)\n{New-AdUser -Name \"" + USER_NAME3 + "$i\" -GivenName \"" + USER_NAME3 + "$i\" -Surname \"" + USER_NAME2 + "$i\" -SamAccountName \"" + USER_NAME + "$i\" -UserPrincipalName \"" + USER_NAME + "$i@" + DOMAIN_NAME_FULL + "\" -Path $org -Enabled $True -ChangePasswordAtLogon $true -AccountPassword (ConvertTo-SecureString \"" + PASSWORD + "\" -AsPlainText -force) -passThru }";

                string zaglyshkaqq = zaglyshka + zaglyshka1;

                try
                {
                    using (FileStream fs = File.Create("user.ps1"))
                    {
                        Encoding win1251 = Encoding.GetEncoding(1251);
                        string   info    = UTF8ToWin1251(zaglyshkaqq);
                        using (var sr = new StreamWriter(fs, win1251))
                        {
                            sr.Write(info);
                        }
                    }
                }
                catch {}
            }
        }//generate group user and\or user(one\more)
示例#3
0
文件: Form1.cs 项目: Hydrapepe/test1
        }//checked group

        public void Button11_Click(object sender, EventArgs e)
        {
            DOMAIN_NAME_FULL = textBox28.Text;
            if (!checkBox7.Checked)
            {
                NAME_GROUP = textBox26.Text;
            }
            SERVER_NAME_FULL = textBox27.Text + "." + DOMAIN_NAME_FULL;
            USER_NAME        = textBox25.Text;
            USER_NAME2       = textBox24.Text;
            USER_NAME3       = textBox23.Text;
            PASSWORD         = textBox22.Text;

            string[] words = DOMAIN_NAME_FULL.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
            try
            {
                words[0]          = "DC=" + words[0];
                SERVER_DOT_SPLIT  = words[0];
                words[1]          = ",DC=" + words[1];
                SERVER_DOT_SPLIT += words[1];
                words[2]          = ",DC=" + words[2];
                SERVER_DOT_SPLIT += words[2];
                words[3]          = ",DC=" + words[3];
                SERVER_DOT_SPLIT += words[3];
                words[4]          = ",DC=" + words[4];
                SERVER_DOT_SPLIT += words[4];
                words[5]          = ",DC=" + words[5];
                SERVER_DOT_SPLIT += words[5];
            }
            catch
            {
                if (checkBox4.Checked)
                {
                    zaglyshkaq = zaglyshkaq + "New-ADOrganizationalUnit -Name:\"" + NAME_GROUP + "\" -Path:\"" + SERVER_DOT_SPLIT + "\" -ProtectedFromAccidentalDeletion:$true -Server:\"" + SERVER_NAME_FULL + "\"\n";
                }
                zaglyshka1q = zaglyshkaq?.Length == 0
                    ? zaglyshka1q + "$org=\"" + SERVER_DOT_SPLIT + "\";\n$username=\"" + USER_NAME3 + "\";\n$count=1;\nforeach ($i in $count)\n{New-AdUser -Name \"" + USER_NAME3 + "\" -GivenName \"" + USER_NAME3 + "\" -Surname \"" + USER_NAME2 + "\" -SamAccountName \"" + USER_NAME + "\" -UserPrincipalName \"" + USER_NAME + "@" + DOMAIN_NAME_FULL + "\" -Path $org -Enabled $True -ChangePasswordAtLogon $true -AccountPassword (ConvertTo-SecureString \"" + PASSWORD + "\" -AsPlainText -force) -passThru }"
                    : zaglyshka1q + "$org=\"OU=" + NAME_GROUP + "," + SERVER_DOT_SPLIT + "\"" +
                              "\n$username=\"" + USER_NAME3 + "\"" +
                              "\n$count=1" +
                              "\nforeach ($i in $count)\n{New-AdUser -Name \"" + USER_NAME3 + "\" -GivenName \"" + USER_NAME3 + "\" -Surname \"" + USER_NAME2 + "\" -SamAccountName \"" + USER_NAME + "\" -UserPrincipalName \"" + USER_NAME + "@" + DOMAIN_NAME_FULL + "\" -Path $org -Enabled $True -ChangePasswordAtLogon $true -AccountPassword (ConvertTo-SecureString \"" + PASSWORD + "\" -AsPlainText -force) -passThru }\n";
            }
            textBox28.Text    = textBox26.Text = textBox27.Text = textBox25.Text = textBox24.Text = textBox23.Text = textBox22.Text = PASSWORD = USER_NAME3 = USER_NAME2 = USER_NAME = SERVER_NAME_FULL = DOMAIN_NAME_FULL = "";
            label32.Text      = "Всего сгенерируется пользователей: " + q++;
            checkBox7.Visible = true;
        }//memory user
示例#4
0
文件: Form1.cs 项目: Hydrapepe/test1
        }//group14

        private void Button21_Click(object sender, EventArgs e)
        {
            DOMAIN_NAME_FULL = textBox29.Text;
            NAME_POLISY      = textBox31.Text;
            NAME_GROUP       = textBox30.Text;

            string[] words = DOMAIN_NAME_FULL.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
            try
            {
                words[0]          = "OU=" + NAME_GROUP + ",DC=" + words[0];
                SERVER_DOT_SPLIT  = words[0];
                words[1]          = ",DC=" + words[1];
                SERVER_DOT_SPLIT += words[1];
                words[2]          = ",DC=" + words[2];
                SERVER_DOT_SPLIT += words[2];
                words[3]          = ",DC=" + words[3];
                SERVER_DOT_SPLIT += words[3];
                words[4]          = ",DC=" + words[4];
                SERVER_DOT_SPLIT += words[4];
                words[5]          = ",DC=" + words[5];
                SERVER_DOT_SPLIT += words[5];
            }
            catch
            {
                text = "New-GPO -Name \"" + NAME_POLISY + "\" | New-GPLink -Target \"" + SERVER_DOT_SPLIT + "\"\nSet-GPRegistryValue -Name \"" + NAME_POLISY + "\" -Key \"HKCU\\Software\\Policies\\Microsoft\\Windows\\System\" -ValueName DisableCMD -Type DWord -Value 1\nSet-GPRegistryValue -Name \"" + NAME_POLISY + "\" -Key \"HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" -ValueName NoRun -Type DWord -Value 1\nSet-GPRegistryValue -Name \"" + NAME_POLISY + "\" -Key \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\" -ValueName DisableRegistryTools -Type DWord -Value 1\nSet-GPRegistryValue -Name \"" + NAME_POLISY + "\" -Key \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" -ValueName NoControlPanel -Type DWord -Value 1\nSet-GPRegistryValue -Name \"" + NAME_POLISY + "\" -Key \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\" -ValueName ScreenSaveActive -Type String -Value 0\nSet-GPRegistryValue -Name \"" + NAME_POLISY + "\" -Key \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\ActiveDesktop\" -ValueName NoChangingWallPaper -Type DWord -Value 1\nSet-GPRegistryValue -Name \"" + NAME_POLISY + "\" -Key \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -ValueName EnableFirstLogonAnimation  -Type DWord -Value 0";
                using (FileStream fs = File.Create("polisy.ps1"))
                {
                    Encoding win1251 = Encoding.GetEncoding(1251);
                    string   info    = UTF8ToWin1251(text);
                    using (var sr = new StreamWriter(fs, win1251))
                    {
                        sr.Write(info);
                    }
                }
            }
        }//using all GPO