Exemple #1
0
        private void button18_Click(object sender, EventArgs e)
        {
            if (this.requestInput == false)
            {
                MessageBox.Show("You need to input REQ number", "error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;

            }
            Button button = sender as Button;
            LogMessageToFileForButtons(String.Format("Button clicked: {0} ({1})", button.Text, button.Parent.Text));
            BootMode mode = SystemInformation.BootMode;
            if (mode == BootMode.Normal)
            {
                //MessageBox.Show("Tron need to be run in Safe Mode. Please use the reboot in Safe Mode button.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                FormRestartConfirmation dlgRestart = new FormRestartConfirmation(60, "Tron need to be run in Safe Mode.\r\nWould you like reboot into safe mode?");
                dlgRestart.ShowDialog();
                if (dlgRestart.ButtonPressed == 1)
                {
                    LogMessage("Restarting the computer");
                    ChangeStatus("Restarting the computer...", 100);
                    this.bootSafeMode();
                }
                else
                {
                    MessageBox.Show("Restart in Safe Mode with networking.");
                    LogMessage("Restart canceled by user");
                }
                return;
            }
            string str = " ";
              string text = this.findFile("Tron.bat");
              //text = text.Replace("\\Tron.bat", "");

              //this.tsFolderBox.Text = text;

              //string text = this.tsFolderBox.Text;
              foreach (Control control in (ArrangedElementCollection) this.panel3.Controls)
              {
            if (control is CheckBox && ((CheckBox) control).Checked)
              str = str + control.Tag.ToString() + " ";
              }
              //text = string.Format("/c \"{0}\"{1}", (object)text, (object)str);
              //      String testing = "";
              try
              {
            if (System.IO.File.Exists(string.Format("{0}", (object) text)))
            {
            Process.Start("cmd.exe", string.Format("/c \"{0}\"{1}", (object)text, (object)str));
            }
            else
            {
              Console.WriteLine("Failed To Launch.");
              this.textBox1.SelectionStart = this.textBox1.Text.Length;
              this.textBox1.ScrollToCaret();
              int num = (int) MessageBox.Show("Failed to launch TronScript | Check that tron.bat has been found.", "Launch Failed", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
              }
              catch (Exception ex)
              {
              if (ex == null)
              {

              }
            Console.WriteLine("Failed To Launch.");
            this.textBox1.SelectionStart = this.textBox1.Text.Length;
            this.textBox1.ScrollToCaret();
            int num = (int) MessageBox.Show("Failed to launch TronScript", "Launch Failed", MessageBoxButtons.OK, MessageBoxIcon.Hand);
              }
              Console.WriteLine(text + "\\" + str);
              Console.WriteLine("-----------------------------------");
              this.textBox1.SelectionStart = this.textBox1.Text.Length;
              this.textBox1.ScrollToCaret();
        }
Exemple #2
0
        private void DoClearARP()
        {
            LogMessage("Clearing ARP cache");
            ChangeStatus("Clearing ARP cache", 50);
            String result;

            // Step 1
            result = RunCommand("netsh", "interface ip delete arpcache");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred deleting ARP cache");
            LogMessage(result);
            };

            LogMessage("Cleared ARP Table cache");
            ChangeStatus("Cleared ARP Table cache", 70);

            // Step 2
            result = RunCommand("netsh", "interface ipv4 delete destinationcache");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred deleting IPv4 DestinationCache");
            LogMessage(result);
            };

            result = RunCommand("netsh", "interface ipv6 delete destinationcache");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred deleting IPv6 DestinationCache");
            LogMessage(result);
            };

            result = RunCommand("netsh", "interface ipv4 delete neighbors");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred deleting IPv4 neighbors");
            LogMessage(result);
            };

            result = RunCommand("netsh", "interface ipv6 delete neighbors");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred deleting IPv6 neighbors");
            LogMessage(result);
            };

            LogMessage("Route tables cleared");
            ChangeStatus("Route tables cleared", 90);

            LogMessage("Clearing the routing tables of all gateway entries");
            result = RunCommand("route.exe", " -f");
            if (result.ToLower().Contains("failed"))
            {
            LogMessage("An error occurred clearing routing tables");
            LogMessage(result);
            };

            LogMessage("Cleared ARP cache, routing tables and IP configuration");

            // Ask for restart confirmation
            FormRestartConfirmation dlgRestart = new FormRestartConfirmation(60);
            dlgRestart.ShowDialog();
            if (dlgRestart.ButtonPressed == 1)
            {
            LogMessage("Restarting the computer");
            ChangeStatus("Restarting the computer...", 100);
            RunCommand("cmd.exe", "/C shutdown /r /t 5");
            }
            else
            {
            MessageBox.Show("You should restart your computer manually.");
            LogMessage("Restart canceled by user");
            }

            ChangeStatus("Ready", 0);
        }
Exemple #3
0
        private void DoServicesDefault()
        {
            bool isChanged = false;
            string[] XP_Auto = {"Browser", "Dhcp", "Dnscache", "LanmanServer", "LanmanWorkstation",
                                "LmHosts", "PlugPlay", "SharedAccess", "W32Time", "wscsvc", "WZCSVC"};
            string[] XP_Manual = { "dot3svc", "EapHost", "Nla", "WinHttpAutoProxySvc" };
            string[] Vista_Auto = {"BFE", "Browser", "Dhcp", "Dnscache", "LanmanServer", "LanmanWorkstation",
                                   "lmhosts", "MpsSvc", "netprofm", "NlaSvc", "nsi", "PlugPlay", "W32Time",
                                   "wscsvc"};
            string[] Vista_Manual = { "dot3svc", "EapHost", "WinHttpAutoProxySvc", "Wlansvc", "WMPNetworkSvc" };
            string[] W7_Auto = {"BFE", "Dhcp", "Dnscache", "LanmanServer", "LanmanWorkstation", "lmhosts",
                                "MpsSvc", "NlaSvc", "nsi", "PlugPlay", "wscsvc"};
            string[] W7_Manual = {"Browser", "dot3svc", "EapHost", "HomeGroupProvider", "netprofm", "W32Time",
                                  "WinHttpAutoProxySvc", "Wlansvc", "WMPNetworkSvc", "WwanSvc"};
            string[] W8_Auto = {"BFE", "Dhcp", "Dnscache", "LanmanServer", "LanmanWorkstation", "lmhosts",
                                "MpsSvc", "NlaSvc", "nsi", "Wcmsvc", "wscsvc"};
            string[] W8_Manual = {"Browser", "dot3svc", "EapHost", "HomeGroupProvider", "NcaSvc", "NcdAutoSetup",
                                  "netprofm", "PlugPlay", "W32Time", "WinHttpAutoProxySvc", "Wlansvc",
                                  "WMPNetworkSvc", "WwanSvc"};

            int VMajor = Environment.OSVersion.Version.Major;
            int VMinor = Environment.OSVersion.Version.Minor;

            LogMessage("Setting Network Windows Services to Default");
            ChangeStatus("Setting Network Windows Services to Default", 50);
            if ((VMajor == 5) && ((VMinor == 1) || (VMinor == 2)))  // Windows XP or XP 64-Bit
            {
            isChanged = isChanged || ProcessServiceList(XP_Auto, "Automatic");
            isChanged = isChanged || ProcessServiceList(XP_Manual, "Manual");

            }
            else if ((VMajor == 6) && (VMinor == 0))
            {            // Windows Vista
            isChanged = isChanged || ProcessServiceList(Vista_Auto, "Automatic");
            isChanged = isChanged || ProcessServiceList(Vista_Manual, "Manual");

            }
            else if ((VMajor == 6) && (VMinor == 1))
            {            // Windows 7
            isChanged = isChanged || ProcessServiceList(W7_Auto, "Automatic");
            isChanged = isChanged || ProcessServiceList(W7_Manual, "Manual");

            }
            else if ((VMajor == 6) && ((VMinor == 2) || (VMinor == 3)))
            {  // Windows 8/8.1
            isChanged = isChanged || ProcessServiceList(W8_Auto, "Automatic");
            isChanged = isChanged || ProcessServiceList(W8_Manual, "Manual");
            }
            else
            {
            LogMessage("Unsupported Windows version; default service settings cannot be determined");
            }
            if (!isChanged)
            {
            LogMessage("All services was already in their default states; no changes were made");
            }
            else
            {
            FormRestartConfirmation dlgRestart = new FormRestartConfirmation(60);
            dlgRestart.ShowDialog();
            if (dlgRestart.ButtonPressed == 1)
            {
                LogMessage("Restarting the computer");
                ChangeStatus("Restarting the computer...", 100);
                RunCommand("cmd.exe", "/C shutdown /r /t 5");
            }
            else
            {
                MessageBox.Show("You should restart your computer manually.");
                LogMessage("Restart canceled by user");
            }
            }
            ChangeStatus("Ready", 0);
        }
Exemple #4
0
        private void buttonRepair_Click(object sender, EventArgs e)
        {
            DialogResult dlg;
            dlg = MessageBox.Show("You are about to run the following:\n"
                            + "\n"
                            + "1. WinSock/TCP IP Repair\n"
                            + "2. Clear all Proxy/VPN Settings\n"
                            + "3. Windows Firewall Repair\n"
                            + "\n"
                            + "Note: Restart required to complete repair\n"
                            + "\n"
                            + "Do you want to continue?",
                              "Information",
                              MessageBoxButtons.OKCancel,
                              MessageBoxIcon.Question);

            // Quit if the user clicks Cancel
            if (dlg == DialogResult.Cancel) return;

            String result;

            // STEP 1: Reset TCP/IP and WinSock using NETSH commands
            LogMessage("Resetting TCP/IP");
            ChangeStatus("Resetting TCP/IP", 25);

            result = RunCommand("ipconfig", "/flushdns");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred flushing DNS cache");
            LogMessage(result);
            };

            result = RunCommand("netsh", "int reset all");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting TCP/IP");
            LogMessage(result);
            };

            result = RunCommand("netsh", "int ipv4 reset");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting TCP/IP");
            LogMessage(result);
            };

            result = RunCommand("netsh", "int ipv6 reset");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting TCP/IP");
            LogMessage(result);
            };

            result = RunCommand("netsh", "int ip reset c:\\resetlog.txt");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting TCP/IP");
            LogMessage(result);
            };

            result = RunCommand("netsh", "int ip reset");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting TCP/IP");
            LogMessage(result);
            };

            result = RunCommand("netsh", "int 6to4 reset all");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting TCP/IP (6to4)");
            LogMessage(result);
            };

            result = RunCommand("netsh", "int httpstunnel reset all");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting HTTPSTunnel");
            LogMessage(result);
            };

            result = RunCommand("netsh", "int isatap reset all");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting ISATAP");
            LogMessage(result);
            };

            result = RunCommand("netsh", "int tcp reset all");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting TCP/IP");
            LogMessage(result);
            };

            result = RunCommand("netsh", "int teredo reset all");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting Teredo");
            LogMessage(result);
            };

            result = RunCommand("netsh", "int portproxy reset all");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting PortProxy");
            LogMessage(result);
            };

            result = RunCommand("netsh", "branchcache reset");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting BranchCache");
            LogMessage(result);
            };

            result = RunCommand("netsh", "winhttp reset");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting WinHTTP");
            LogMessage(result);
            };

            result = RunCommand("netsh", "winsock reset c:\\winsock.log");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting WinSock");
            LogMessage(result);
            };

            result = RunCommand("netsh", "winsock reset");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting WinSock");
            LogMessage(result);
            };

            result = RunCommand("netsh", "winsock reset all");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting WinSock");
            LogMessage(result);
            };

            result = RunCommand("netsh", "winsock reset catalog");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting WinSock");
            LogMessage(result);
            };

            LogMessage("Reset TCP/IP");

            // STEP 2: Clear all Internet Explorer proxy settings by modifying registry
            // See support.microsoft.com/kb/2289942 for details
            LogMessage("Clearing Internet Explorer proxy/VPN settings");
            ChangeStatus("Clearing Internet Explorer proxy/VPN settings", 50);

            // Uncheck "Use a proxy server for LAN" setting
            result = RunCommand("reg", "add \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v ProxyEnable /t REG_DWORD /d 0 /f");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred disabling proxy settings.");
            LogMessage(result);
            };
            LogMessage("Disabled proxy settings.");

            // Delete any proxy servers
            result = RunCommand("reg", "delete \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v ProxyServer /f");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred deleting proxy server");
            LogMessage(result);
            };
            LogMessage("Deleted proxy servers");

            // Uncheck "always dial my default connection" and set to "never dial a connection"
            result = RunCommand("reg", "add \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v EnableAutodial /t REG_DWORD /d 0 /f");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred disabling automatic dialing.");
            LogMessage(result);
            };
            LogMessage("Disabled automatic dialing.");

            // Delete all RAS connections
            string[] sRasList = GetRasNames();
            foreach (var ras in sRasList)
            {
            result = RunCommand("rasphone.exe", "-r \"" + ras + "\"");
            if (result.ToLower().Contains("error "))
            {
                LogMessage("An error occurred deleting RAS connection \"" + ras + "\"");
                LogMessage(result);
            };
            }
            LogMessage("Deleted all RAS connections");

            // Uncheck "Use automatic configuration script"
            result = RunCommand("reg", "delete \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v AutoConfigURL /f");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred deleting automatic configuration settings");
            LogMessage(result);
            };
            LogMessage("Deleted automatic configuration settings");

            // STEP 3: Repair Windows Firewall service
            LogMessage("Repairing Windows Firewall service");
            ChangeStatus("Repairing Windows Firewall service", 75);
            string sINFPath = Environment.GetEnvironmentVariable("windir") + "\\inf\\netrass.inf";
            result = RunCommand("Rundll32.exe", "setupapi,InstallHinfSection Ndi-Steelhead 132 " + sINFPath);
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred registering Windows Firewall. Check log for details");
            LogMessage(result);
            };

            LogMessage("Resetting Windows Firewall service");
            ChangeStatus("Resetting Windows Firewall service", 80);
            result = RunCommand("netsh.exe", "firewall reset");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting Windows Firewall settings");
            LogMessage(result);
            };

            ChangeStatus("Resetting Windows Firewall service", 90);
            result = RunCommand("netsh.exe", "advfirewall reset");
            if (result.ToLower().Contains("error "))
            {
            LogMessage("An error occurred resetting Windows Firewall settings");
            LogMessage(result);
            };

            LogMessage("Repaired Windows Firewall service");

            // Ask for restart confirmation
            FormRestartConfirmation dlgRestart = new FormRestartConfirmation(60);
            dlgRestart.ShowDialog();
            if (dlgRestart.ButtonPressed == 1)
            {
            LogMessage("Restarting the computer");
            ChangeStatus("Restarting the computer...", 100);
            RunCommand("cmd.exe", "/C shutdown /r /t 5");
            }
            else
            {
            MessageBox.Show("You should restart your computer manually.");
            LogMessage("Restart canceled by user");
            }
        }