Example #1
0
        private ProgramList.ID GetIDforEntry(string path, int processId)
        {
            ProgramList.Types type = ProgramList.Types.Global;
            string            name = null;

            if (path.Equals("System", StringComparison.OrdinalIgnoreCase))
            {
                type = ProgramList.Types.System;
            }
            else
            {
                path = MiscFunc.parsePath(path);
                if (path.Length == 0) // fallback
                {
                    path = ProgramList.GetProcessPathById(processId);
                    if (path == null)
                    {
                        return(null);
                    }
                }

                //if (Path.GetFileName(path).Equals("svchost.exe", StringComparison.OrdinalIgnoreCase))
                List <ServiceHelper.ServiceInfo> Services = ServiceHelper.GetServicesByPID(processId);
                if (Services != null)
                {
                    type = ProgramList.Types.Service;
                    if (Services.Count > 1)
                    {
                        // ToDo: handle teh case Services.length > 1 !!!!
                        Console.WriteLine("Non unique service " + Services.Count);
                    }
                    name = Services[0].ServiceName;
                }
                else
                {
                    name = App.engine.appMgr != null?App.engine.appMgr.GetAppPackage(path) : null;

                    if (name != null)
                    {
                        type = ProgramList.Types.App;
                    }
                    else
                    {
                        type = ProgramList.Types.Program;
                    }
                }
            }
            ProgramList.ID id = new ProgramList.ID(type, path, name);
            return(id);
        }
Example #2
0
        static private void ExecOnStart()
        {
            if (int.Parse(IniReadValue("OnStart", "EnableWuAuServ", "0")) != 0)
            {
                Agent.EnableWuAuServ(true);
            }

            string OnStart = IniReadValue("OnStart", "Exec", "");

            if (OnStart.Length > 0)
            {
                DoExec(PrepExec(OnStart, MiscFunc.parseInt(IniReadValue("OnStart", "Silent", "1")) != 0), true);
            }
        }
 static public bool SetRegistryTweak(string path, string name, object value, bool usrLevel = false)
 {
     try
     {
         var subKey = (usrLevel ? Registry.CurrentUser : Registry.LocalMachine).CreateSubKey(path, true);
         SetRegistryValue(subKey, name, value);
         return(true);
     }
     catch (Exception err)
     {
         AppLog.Line("Error in {0}: {1}", MiscFunc.GetCurrentMethod(), err.Message);
     }
     return(false);
 }
Example #4
0
        public NetworkMonitor()
        {
            LastUpdate = MiscFunc.GetTickCount64();

            try
            {
                InitEtw();
                //AppLog.Debug("Successfully initialized NetworkMonitorETW");
            }
            catch
            {
                AppLog.Debug("Failed to initialized NetworkMonitorETW");
            }
        }
Example #5
0
File: GPO.cs Project: zen0bit/wumgr
        static public float GetWinVersion()
        {
            try
            {
                var subKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", false);
                if (subKey == null)
                {
                    return(0.0f);
                }
                //string Majorversion = subKey.GetValue("CurrentMajorVersionNumber", "0").ToString(); // this is 10 on 10 but not present on earlier editions
                string version     = subKey.GetValue("CurrentVersion", "0").ToString();
                float  version_num = float.Parse(version, System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
                //string name = subKey.GetValue("ProductName", "").ToString();

                /*
                 *  Operating system              Version number
                 *  ----------------------------  --------------
                 *  Windows 10                      6.3 WTF why not 10
                 *  Windows Server 2016             6.3 WTF why not 10
                 *  Windows 8.1                     6.3
                 *  Windows Server 2012 R2          6.3
                 *  Windows 8                       6.2
                 *  Windows Server 2012             6.2
                 *  Windows 7                       6.1
                 *  Windows Server 2008 R2          6.1
                 *  Windows Server 2008             6.0
                 *  Windows Vista                   6.0
                 *  Windows Server 2003 R2          5.2
                 *  Windows Server 2003             5.2
                 *  Windows XP 64-Bit Edition       5.2
                 *  Windows XP                      5.1
                 *  Windows 2000                    5.0
                 *  Windows ME                      4.9
                 *  Windows 98                      4.10
                 */

                if (version_num >= 6.3)
                {
                    //!name.Contains("8.1") && !name.Contains("2012 R2");
                    int build = MiscFunc.parseInt(subKey.GetValue("CurrentBuildNumber", "0").ToString());
                    if (build >= 10000) // 1507 RTM release
                    {
                        return(10.0f);
                    }
                }
                return(version_num);
            }
            catch { }
            return(0.0f);
        }
        public static bool MatchAddress(string strIP, string strRanges)
        {
            int        type;
            BigInteger numIP = NetFunc.IpStrToInt(strIP, out type);

            foreach (string range in strRanges.Split(','))
            {
                string[] strTemp = range.Split('-');
                if (strTemp.Length == 1)
                {
                    if (strTemp[0].Contains("/")) // ip/net
                    {
                        string[]   strTemp2 = strTemp[0].Split('/');
                        int        temp;
                        BigInteger num1 = NetFunc.IpStrToInt(strTemp2[0], out temp);
                        int        pow  = MiscFunc.parseInt(strTemp2[1]);
                        BigInteger num2 = num1 + BigInteger.Pow(new BigInteger(2), pow);

                        if (type == temp && num1 <= numIP && numIP <= num2)
                        {
                            return(true);
                        }
                    }
                    else if (FirewallRule.SpecialAddresses.Contains(strTemp[0].Trim(), StringComparer.OrdinalIgnoreCase))
                    {
                        return(MatchAddress(strIP, NetFunc.GetSpecialNet(strTemp[0].Trim())));
                    }
                    else
                    {
                        int        temp;
                        BigInteger num1 = NetFunc.IpStrToInt(strTemp[0], out temp);
                        if (type == temp && num1 == numIP)
                        {
                            return(true);
                        }
                    }
                }
                else if (strTemp.Length == 2)
                {
                    int        temp;
                    BigInteger num1 = NetFunc.IpStrToInt(strTemp[0], out temp);
                    BigInteger num2 = NetFunc.IpStrToInt(strTemp[1], out temp);
                    if (type == temp && num1 <= numIP && numIP <= num2)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Example #7
0
    //////////////////////////////////////////////////////////////////////////////////////////////
    // App resource handling


    public string GetAppResourceStr(string resourcePath)
    {
        // Note: PackageManager requirers admin privilegs

        var AppResource = TextHelpers.Split2(resourcePath.Substring(2, resourcePath.Length - 3), "?");
        var package     = packageManager.FindPackage(AppResource.Item1);

        if (package != null)
        {
            string pathToPri = Path.Combine(package.InstalledLocation.Path, "resources.pri");
            return(MiscFunc.GetResourceStr(pathToPri, AppResource.Item2));
        }

        return(resourcePath);
    }
        // *** GPO ***

        static public bool TestGPOTweak(string path, string name, object value, bool usrLevel = false)
        {
            try
            {
                var gpo    = new ComputerGroupPolicyObject(new GroupPolicyObjectSettings(true, true)); // read only so it does not fail without admin rights
                var key    = gpo.GetRootRegistryKey(usrLevel ? GroupPolicySection.User : GroupPolicySection.Machine);
                var subKey = key.CreateSubKey(path);
                return(CmpRegistryValue(subKey, name, value));
            }
            catch (Exception err)
            {
                AppLog.Line("Error in {0}: {1}", MiscFunc.GetCurrentMethod(), err.Message);
            }
            return(false);
        }
        // *** Services ***

        static public bool IsServiceEnabled(string name)
        {
            bool ret = false;
            ServiceController svc = new ServiceController(name);

            try
            {
                ret = svc.StartType != ServiceStartMode.Disabled;
            }
            catch (Exception err)
            {
                AppLog.Line("Error in {0}: {1}", MiscFunc.GetCurrentMethod(), err.Message);
            }
            svc.Close();
            return(ret);
        }
            public void MakeDisplayName()
            {
                switch (Type)
                {
                case ProgramList.Types.System: DescrStr = Translate.fmt("name_system"); break;

                case ProgramList.Types.Service: DescrStr = ServiceHelper.GetServiceName(Name); break;

                case ProgramList.Types.Program: DescrStr = MiscFunc.GetExeName(Path); break;

                case ProgramList.Types.App: DescrStr = App.engine.appMgr.GetAppName(Name); break;

                default:
                case ProgramList.Types.Global: DescrStr = Translate.fmt("name_global"); break;
                }
            }
Example #11
0
        static private void ExecOnStart()
        {
            string ToolsINI = GetToolsPath() + @"\Tools.ini";

            if (int.Parse(IniReadValue("OnStart", "EnableWuAuServ", "0", ToolsINI)) != 0)
            {
                Agent.EnableWuAuServ(true);
            }

            string OnStart = IniReadValue("OnStart", "Exec", "", ToolsINI);

            if (OnStart.Length > 0)
            {
                DoExec(PrepExec(OnStart, MiscFunc.parseInt(IniReadValue("OnStart", "Silent", "1", ToolsINI)) != 0), true);
            }
        }
Example #12
0
        public string GetDescription()
        {
            string Name = "";
            string Info = null;

            switch (ID.Type)
            {
            case ProgramID.Types.System:
                Name = "Windows NT-Kernel/System";     // Translate.fmt("name_system");
                break;

            case ProgramID.Types.Global:
                Name = "All Processes";     // Translate.fmt("name_global");
                break;

            case ProgramID.Types.Program:
                Name = System.IO.Path.GetFileName(ID.Path);
                Info = MiscFunc.GetExeDescription(ID.Path);
                break;

            case ProgramID.Types.Service:
                Name = ID.GetServiceId();
                Info = ServiceHelper.GetServiceName(Name);
                break;

            case ProgramID.Types.App:
                var SID    = ID.GetPackageSID();
                var AppPkg = App.engine.FirewallManager.GetAppPkgBySid(SID);
                if (AppPkg != null)
                {
                    Name = AppPkg.ID;
                    Info = App.GetResourceStr(AppPkg.Name);
                }
                else
                {
                    Name = SID;
                }
                break;
            }

            if (Info != null && Info.Length > 0)
            {
                return(Info + " (" + Name + ")");
            }
            return(Name);
        }
 static public bool SetGPOTweak(string path, string name, object value, bool usrLevel = false)
 {
     try
     {
         var gpo    = new ComputerGroupPolicyObject();
         var key    = gpo.GetRootRegistryKey(usrLevel ? GroupPolicySection.User : GroupPolicySection.Machine);
         var subKey = key.CreateSubKey(path);
         SetRegistryValue(subKey, name, value);
         gpo.Save();
         return(true);
     }
     catch (Exception err)
     {
         AppLog.Line("Error in {0}: {1}", MiscFunc.GetCurrentMethod(), err.Message);
     }
     return(false);
 }
Example #14
0
        static public string GetResourceStr(string resourcePath)
        {
            if (resourcePath == null)
            {
                return("");
            }
            if (resourcePath.Length == 0 || resourcePath[0] != '@')
            {
                return(resourcePath);
            }

            string resourceStr = null;

            AppResourceStrLock.EnterReadLock();
            AppResourceStrCache.TryGetValue(resourcePath, out resourceStr);
            AppResourceStrLock.ExitReadLock();
            if (resourceStr != null)
            {
                return(resourceStr);
            }

            if (resourcePath.Length > 2 && resourcePath.Substring(0, 2) == "@{")
            {
                if (App.engine != null)
                {
                    resourceStr = App.engine?.PkgMgr?.GetAppResourceStr(resourcePath) ?? resourcePath;
                }
                else
                {
                    resourceStr = App.client.GetAppPkgRes(resourcePath);
                }
            }
            else
            {
                resourceStr = MiscFunc.GetResourceStr(resourcePath);
            }

            AppResourceStrLock.EnterWriteLock();
            if (!AppResourceStrCache.ContainsKey(resourcePath))
            {
                AppResourceStrCache.Add(resourcePath, resourceStr);
            }
            AppResourceStrLock.ExitWriteLock();

            return(resourceStr);
        }
Example #15
0
        public T RemoteExec <T>(string fx, object args, T defRet)
        {
            try
            {
                if (clientPipe == null && !Connect())
                {
                    throw new Exception("Connection Failed");
                }

                return((T)(clientPipe.RemoteExec(fx, args)));
            }
            catch (Exception err)
            {
                AppLog.Line("Error in {0}: {1}", MiscFunc.GetCurrentMethod(), err.Message);
                return(defRet);
            }
        }
Example #16
0
        public Program(ProgramID progID)
        {
            //guid = Guid.NewGuid();

            ID = progID.Duplicate();

            string Name = "";
            string Info = null;

            switch (ID.Type)
            {
            case ProgramID.Types.System:
                Name = Translate.fmt("name_system");
                break;

            case ProgramID.Types.Global:
                Name = Translate.fmt("name_global");
                break;

            case ProgramID.Types.Program:
                Name = System.IO.Path.GetFileName(ID.Path);
                Info = MiscFunc.GetExeDescription(ID.Path);
                break;

            case ProgramID.Types.Service:
                Name = ID.GetServiceId();
                Info = ID.GetServiceName();
                break;

            case ProgramID.Types.App:
                Name = ID.GetPackageName();
                var AppPkg = App.engine.FirewallManager.GetAppPkgBySid(ID.GetPackageSID());
                Info = AppPkg?.Name;
                break;
            }

            if (Info != null && Info.Length > 0)
            {
                Description = Info + " (" + Name + ")";
            }
            else
            {
                Description = Name;
            }
        }
Example #17
0
        void OnUpdates(object sender, WuAgent.UpdatesArgs args)
        {
            UpdateCounts();
            if (args.Found) // if (agent.CurOperation() == WuAgent.AgentOperation.CheckingUpdates)
            {
                SetConfig("LastCheck", DateTime.Now.ToString());
                SwitchList(UpdateLists.PendingUpdates);
            }
            else
            {
                LoadList();

                if (MiscFunc.parseInt(Program.IniReadValue("Options", "Refresh", "0")) == 1 && (agent.CurOperation() == WuAgent.AgentOperation.InstallingUpdates || agent.CurOperation() == WuAgent.AgentOperation.RemoveingUpdtes))
                {
                    doUpdte = true;
                }
            }
        }
        public int Connect(int TimeOut = 10000, bool mNoDouble = false)
        {
            // Note: when we close a IPC host without terminating its process we are left with some still active listeners, so we test communication and reconnect if needed
            for (long endTime = (long)MiscFunc.GetTickCount64() + (long)TimeOut; TimeOut > 0; TimeOut = (int)(endTime - (long)MiscFunc.GetTickCount64()))
            {
                if (!DoConnect(TimeOut))
                {
                    continue;
                }

                IPCSession session = RemoteExec <IPCSession>("InitSession", Process.GetCurrentProcess().SessionId, null);
                if (session != null)
                {
                    return((mNoDouble || session.duplicate == false) ? 1 : -1);
                }
            }
            return(0);
        }
Example #19
0
        public bool Connect(int TimeOut = 10000)
        {
            // Note: when we close a IPC host without terminating its process we are left with some still active listeners, so we test communication and reconnect if needed
            for (long endTime = (long)MiscFunc.GetTickCount64() + (long)TimeOut; TimeOut > 0; TimeOut = (int)(endTime - (long)MiscFunc.GetTickCount64()))
            {
                if (!DoConnect(TimeOut))
                {
                    continue;
                }

                string version = RemoteExec("GetVersion", null, "");
                if (version.Length > 0)
                {
                    return(true);
                }
            }
            return(false);
        }
Example #20
0
        public bool UpdateDomainBlocklist(DomainBlocklist Blocklist)
        {
            ListLock.EnterWriteLock();
            DomainBlocklist KnownBlocklist;

            if (Blocklists.TryGetValue(Blocklist.Url, out KnownBlocklist))
            {
                KnownBlocklist.Enabled = Blocklist.Enabled;
            }
            else
            {
                AddDomainBlocklistImpl(Blocklist);
            }
            ListLock.ExitWriteLock();

            ReloadBlocklists = MiscFunc.GetUTCTimeMs() + 5 * 1000; // schedule reaload
            return(true);
        }
Example #21
0
        public bool LoadSet(XmlNode entryNode)
        {
            if (entryNode.Name != "ProgramSet")
            {
                return(false);
            }

            foreach (XmlNode node in entryNode.ChildNodes)
            {
                if (node.Name == "Program")
                {
                    Program prog = new Program();
                    if (prog.Load(node))
                    {
                        prog.AssignSet(this);
                    }
                }
                else if (node.Name == "Name")
                {
                    config.Name = node.InnerText;
                }
                else if (node.Name == "Category")
                {
                    config.Category = node.InnerText;
                }
                else if (node.Name == "Icon")
                {
                    config.Icon = node.InnerText;
                }
                else if (node.Name == "NetAccess")
                {
                    Enum.TryParse(node.InnerText, out config.NetAccess);
                }
                else if (node.Name == "Notify")
                {
                    config.Notify = MiscFunc.parseBool(node.InnerText, null);
                }
                else
                {
                    AppLog.Debug("Unknown Program Value, '{0}':{1}", node.Name, node.InnerText);
                }
            }
            return(Programs.Count > 0 && config.Name != null);
        }
Example #22
0
    public static void LoadWnd(Window wnd, string name)
    {
        string wndPos = App.GetConfig("GUI", name + "WndPos", null);

        if (wndPos != null)
        {
            var LT = TextHelpers.Split2(wndPos, ":");
            wnd.Left = MiscFunc.parseInt(LT.Item1);
            wnd.Top  = MiscFunc.parseInt(LT.Item2);
        }
        string wndSize = App.GetConfig("GUI", name + "WndSize", null);

        if (wndSize != null)
        {
            var WH = TextHelpers.Split2(wndSize, ":");
            wnd.Width  = MiscFunc.parseInt(WH.Item1);
            wnd.Height = MiscFunc.parseInt(WH.Item2);
        }
    }
Example #23
0
        protected void OnTimerTick(object sender, EventArgs e)
        {
            if (NextTweakCheck <= MiscFunc.GetCurTick())
            {
                NextTweakCheck = MiscFunc.GetCurTick() + (UInt64)App.GetConfigInt("TweakGuard", "CheckInterval", 15 * 60) * 1000;

                if (App.GetConfigInt("TweakGuard", "AutoCheck", 1) != 0)
                {
                    TestTweaks(false, App.GetConfigInt("TweakGuard", "AutoFix", 0) != 0);
                }
            }


            if (MiscFunc.GetTickCount64() - LastSaveTime > 15 * 60 * 1000) // every 15 minutes
            {
                LastSaveTime = MiscFunc.GetTickCount64();
                Store();
            }
        }
Example #24
0
 void UpdateCounts()
 {
     if (agent.mPendingUpdates != null)
     {
         btnWinUpd.Text = MiscFunc.fmt("Windows Update ({0})", agent.mPendingUpdates.Count);
     }
     if (agent.mInstalledUpdates != null)
     {
         btnInstalled.Text = MiscFunc.fmt("Installed Updates ({0})", agent.mInstalledUpdates.Count);
     }
     if (agent.mHiddenUpdates != null)
     {
         btnHidden.Text = MiscFunc.fmt("Hidden Updates ({0})", agent.mHiddenUpdates.Count);
     }
     if (agent.mUpdateHistory != null)
     {
         btnHistory.Text = MiscFunc.fmt("Update History ({0})", agent.mUpdateHistory.Count);
     }
 }
Example #25
0
    public static bool LoadWnd(Window wnd, string name)
    {
        Rectangle rect = new Rectangle();

        string wndPos = App.GetConfig("GUI", name + "WndPos", null);

        if (wndPos == null || wndPos.Length == 0)
        {
            return(false);
        }

        var LT = TextHelpers.Split2(wndPos, ":");

        rect.X = MiscFunc.parseInt(LT.Item1);
        rect.Y = MiscFunc.parseInt(LT.Item2);

        string wndSize = App.GetConfig("GUI", name + "WndSize", null);

        if (wndSize != null || wndSize.Length == 0)
        {
            var WH = TextHelpers.Split2(wndSize, ":");
            rect.Width  = MiscFunc.parseInt(WH.Item1);
            rect.Height = MiscFunc.parseInt(WH.Item2);
        }
        else
        {
            rect.Width  = (int)wnd.Width;
            rect.Height = (int)wnd.Height;
        }

        if (!MiscFunc.IsOnScreen(rect))
        {
            return(false);
        }

        wnd.Left   = rect.Left;
        wnd.Top    = rect.Top;
        wnd.Width  = rect.Width;
        wnd.Height = rect.Height;

        return(true);
    }
Example #26
0
        private void LoadUpdates()
        {
            string INIPath = Program.appPath + @"\updates.ini";

            foreach (string KB in Program.IniEnumSections(INIPath))
            {
                if (KB.Length == 0)
                {
                    continue;
                }

                MsUpdate Update = new MsUpdate();
                Update.KB   = KB;
                Update.UUID = Program.IniReadValue(Update.KB, "UUID", "", INIPath);

                Update.Title       = Program.IniReadValue(Update.KB, "Title", "", INIPath);
                Update.Description = Program.IniReadValue(Update.KB, "Info", "", INIPath);
                Update.Category    = Program.IniReadValue(Update.KB, "Category", "", INIPath);

                try { Update.Date = DateTime.Parse(Program.IniReadValue(Update.KB, "Date", "", INIPath)); } catch { }
                Update.Size = (decimal)MiscFunc.parseInt(Program.IniReadValue(Update.KB, "Size", "0", INIPath));

                Update.SupportUrl = Program.IniReadValue(Update.KB, "SupportUrl", "", INIPath);
                Update.Downloads.AddRange(Program.IniReadValue(Update.KB, "Downloads", "", INIPath).Split('|'));

                Update.State      = (MsUpdate.UpdateState)MiscFunc.parseInt(Program.IniReadValue(Update.KB, "State", "0", INIPath));
                Update.Attributes = MiscFunc.parseInt(Program.IniReadValue(Update.KB, "Attributes", "0", INIPath));
                Update.ResultCode = MiscFunc.parseInt(Program.IniReadValue(Update.KB, "ResultCode", "0", INIPath));
                Update.HResult    = MiscFunc.parseInt(Program.IniReadValue(Update.KB, "HResult", "0", INIPath));

                switch (Update.State)
                {
                case MsUpdate.UpdateState.Pending: mPendingUpdates.Add(Update); break;

                case MsUpdate.UpdateState.Installed: mInstalledUpdates.Add(Update); break;

                case MsUpdate.UpdateState.Hidden: mHiddenUpdates.Add(Update); break;

                case MsUpdate.UpdateState.History: mUpdateHistory.Add(Update); break;
                }
            }
        }
Example #27
0
        static public string GetResourceStr(string resourcePath)
        {
            if (resourcePath == null)
            {
                return("");
            }
            if (resourcePath.Length == 0 || resourcePath[0] != '@')
            {
                return(resourcePath);
            }

            // modern app resource string
            if (resourcePath.Length > 2 && resourcePath.Substring(0, 2) == "@{")
            {
                return(App.engine?.PkgMgr?.GetAppResourceStr(resourcePath) ?? resourcePath);
            }

            // classic win32 resource string
            return(MiscFunc.GetResourceStr(resourcePath));
        }
Example #28
0
        static public string OpenIconPicker(string iconFile)
        {
            IconExtractor.PickerDialog picker = new IconExtractor.PickerDialog();
            var pathIndex = TextHelpers.Split2(iconFile, "|");

            picker.FileName  = pathIndex.Item1;
            picker.IconIndex = MiscFunc.parseInt(pathIndex.Item2);
            if (picker.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return(null);
            }

            IconExtractor extractor = new IconExtractor(picker.FileName);

            if (extractor.Count == 0)
            {
                return(null);
            }

            return(picker.FileName + "|" + picker.IconIndex);
        }
Example #29
0
        public bool Uninstall()
        {
            try
            {
                if (ServiceHelper.ServiceIsInstalled(ServiceName))
                {
                    if (ServiceHelper.GetServiceStatus(ServiceName) == ServiceHelper.ServiceState.Running)
                    {
                        ServiceHelper.StopService(ServiceName);
                    }

                    ServiceHelper.Uninstall(ServiceName);
                }
                return(true);
            }
            catch (Exception err)
            {
                AppLog.Line("Error in {0}: {1}", MiscFunc.GetCurrentMethod(), err.Message);
            }
            return(false);
        }
Example #30
0
        public GroupModel()
        {
            Groups = new ObservableCollection <ContentControl>();

            HashSet <string> knownGroups = new HashSet <string>();
            Dictionary <Guid, List <FirewallRuleEx> > rules = App.client.GetRules();

            foreach (var ruleSet in rules)
            {
                foreach (FirewallRule rule in ruleSet.Value)
                {
                    if (rule.Grouping != null && rule.Grouping.Length > 0)
                    {
                        string temp = rule.Grouping;
                        if (temp.Length > 2 && temp.Substring(0, 2) == "@{" && App.PkgMgr != null)
                        {
                            temp = App.PkgMgr.GetAppResourceStr(temp);
                        }
                        else if (temp.Length > 1 && temp.Substring(0, 1) == "@")
                        {
                            temp = MiscFunc.GetResourceStr(temp);
                        }

                        if (temp.Substring(0, 1) == "@")
                        {
                            continue; // dont list unresolved names
                        }
                        knownGroups.Add(temp);
                    }
                }
            }

            foreach (string group in knownGroups)
            {
                Groups.Add(new ContentControl()
                {
                    Tag = group, Content = group
                });
            }
        }