コード例 #1
0
ファイル: ServerForm.cs プロジェクト: ivanwfr/RTabs-Desktop
        //}}}

        public void ClientServer_set_Firewall_Rule() //{{{
        {
            log("EVENTS", "Adding Firewall  IN-RULE on port " + Settings.Port + " for " + Settings.APP_NAME);


            if (ServerHelper.IsUserAdministrator())
            {
                string result = Netsh.AllowThisProgram("IN");
                if (result.StartsWith("***"))
                {
                    MessageBox.Show(result, Settings.APP_NAME + " Firewall RULE", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show(result, Settings.APP_NAME + " Firewall RULE", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show(""
                                + "This program should be started with administrator "
                                + " rights in order to add a new FIREWALL RULE."
                                , Settings.APP_TITLE
                                , MessageBoxButtons.OK
                                , MessageBoxIcon.Error
                                );
            }
        }
        public void runWizard()
        {
            var o2Wizard = new O2Wizard("Enable/Disable Network Adapters", 500, 500);

            if (false == Netsh.isAvailable())
            {
                o2Wizard.Steps.add_Message("Error onEnable/Disable Network Adapters", "no NetSh found on this system");
            }
            else
            {
                // step 1
                var step1Message = string.Format("This wizard will allow the enable or disable the following Windows Network adapters: \r\n {0}\r\n{1}",
                                                 Netsh.interfaces_getDetails(),
                                                 Netsh.interfaces_getIPConfig());
                o2Wizard.Steps.add_Message("Current Network Adapter details", step1Message);
                // step 2
                o2Wizard.Steps.add_Action("Disabling Network Adapters", disableNetworkAdapters);
                // step 3
                o2Wizard.Steps.add_Action("Ping www.google.com", (step) => pingAddress(step, "www.google.com"));
                // step 4
                o2Wizard.Steps.add_Action("Enabling Network Adapters", enableNetworkAdapters);
                // step 5
                o2Wizard.Steps.add_Action("Ping www.google.com", (step) => pingAddress(step, "www.google.com"));
                // step 6
                o2Wizard.Steps.add_Action("All Done", endOfWizard);
            }
            o2Wizard.start();
        }
 public void networkAdapterAction(IStep step, string actionName, Func <string, string> methodToExecute)
 {
     O2Thread.mtaThread(
         () => {
         step.allowNext(false);
         step.append_Line(actionName + " Network Adapter(s)", true /*extraLineAfter */, true /*extraLineBefore */);
         var networkAdapters = Netsh.interfaces_getNames();
         foreach (var networkAdapter in networkAdapters)
         {
             var result = methodToExecute(networkAdapter).Trim();
             if (result == "")
             {
                 step.append_Line(" - " + networkAdapter);
             }
         }
         step.append_Line("step completed", false /*extraLineAfter */, true /*extraLineBefore */);
         step.allowNext(true);
     });
 }
コード例 #4
0
        public static void HandleWLANCommand()
        {
            Console.Clear();
            WriteARES("Scanning for near wifis...");
            List <WLANInformation> Wlans = Netsh.GetVisibleNetworks();

            WriteSlow("Finished scanning. This is what I found:");
            Console.WriteLine();
            Console.ForegroundColor = ConsoleColor.Yellow;
            if (Wlans != null && Wlans.Count > 0)
            {
                foreach (WLANInformation wlan in Wlans)
                {
                    Console.WriteLine(wlan.Name);
                }
            }
            else
            {
                Console.WriteLine("---Nothing---");
            }
            SetARESColor();
            Console.ReadKey();
        }
コード例 #5
0
        static void Main(string[] args)
        {
            WhiteList.Load();
            new Config();
            Console.Title = "Protection UDP3 - API";
            DateTime started = DateTime.Now;

            Printf.danger("....................................", false);
            Printf.danger("                 [PROTECTION SERVER]", false);
            Printf.sucess("   PointBlank Private API - Firewall", false);
            Printf.sucess("                       _luisfeliperm", false);
            Printf.sucess("....................................", false);
            Printf.info(" +Date " + started, false);
            Printf.info(" - - - - - - - - - - - - - - - - - - ", false);

            Netsh.Reset();
            FwSyncNet.Start();


            Monitoring.Load();
            Memory.updateRAM();

            Process.GetCurrentProcess().WaitForExit();
        }