Beispiel #1
0
        //为系统账户设置安全密码
        void systemUserSafePwd()
        {
            isRunning = true;
            string[] users = Tools.getUsers();

            refreshUI("检查系统中存在的账户:");
            Thread.Sleep(2000);

            refreshUI("已找到" + users.Length + "个账户,分别为\r\n");
            foreach (string user in users)
            {
                refreshUI(user + "\r\n");
            }
            Thread.Sleep(3000);
            refreshUI("当前使用账户名为:" + users[0] + "\r\n");
            Thread.Sleep(3000);
            refreshUI("将其余账户自动设置强密码:");
            for (int i = 1; i < users.Length; i++)
            {
                string command = "net user " + users[i] + "  Hyzx@12306";
                string reStr   = "";
                RunCmd.run(command, out reStr);
            }
            Thread.Sleep(2000);
            refreshUI("设置完毕");
            isRunning = false;
        }
Beispiel #2
0
        /// <summary>
        /// 修改ip地址
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="mask"></param>
        /// <param name="gateway"></param>
        public void setIp(string ip, string mask, string gateway)
        {
            string setIp   = "netsh interface ip set address name=" + this.name + " source=static addr=" + ip + " mask=" + mask + " gateway=" + gateway + " gwmetric=1";
            string command = "echo 正在修改IP配置..&&" + setIp;
            string reStr   = "";

            RunCmd.run(command, out reStr);
        }
Beispiel #3
0
        /// <summary>
        /// 修改dns
        /// </summary>
        /// <param name="dns1">主要dns</param>
        /// <param name="dns2">备用dns</param>
        public void setDns(string dns1, string dns2)
        {
            string setDns1  = "netsh interface ip set dns name=\"" + this.Name + "\" source=static addr=" + dns1 + " register=primary";
            string setDns2  = "netsh interface ip add dns name=\"" + this.Name + "\" " + dns2 + " index=2";
            string command2 = "echo 正在修改DNS.." + " && " + setDns1 + " && " + setDns2;

            string reStr = "";

            RunCmd.run(command2, out reStr);
        }
Beispiel #4
0
        /// <summary>
        /// 根据面板值修改IP
        /// </summary>
        public NetCard changeIp()
        {
            NetCard netcard = readIpPanel();
            if (netcard == null) return null;
            string reStr = "";

            string setIp = "netsh interface ip set address name=" + netcard.Name + " source=static addr=" + netcard.Ip + " mask=" + netcard.Mask + " gateway=" + netcard.Gateway + " gwmetric=1";
            string command1 = "echo 正在修改IP配置..&&" + setIp;
            RunCmd.run(command1, out reStr);
            //MessageBox.Show(reStr);

            string setDns1 = "netsh interface ip set dns name=\"" + netcard.Name + "\" source=static addr=" + netcard.Dns1 + " register=primary";
            string setDns2 = "netsh interface ip add dns name=\"" + netcard.Name + "\" " + netcard.Dns2 + " index=2";
            string command2 = "echo 正在修改DNS.." + " && " + setDns1 + " && " + setDns2;
            reStr = "";
            RunCmd.run(command2, out reStr);
            return netcard;
            //MessageBox.Show(reStr);
        }