Beispiel #1
0
            public bool TestFilter(string textFilter)
            {
                string strings = this.Name;

                strings += " " + this.Grouping;
                strings += " " + this.Index;
                strings += " " + this.Enabled;
                strings += " " + this.Profiles;
                strings += " " + this.Action;
                strings += " " + this.Direction;
                strings += " " + this.Protocol;
                strings += " " + this.DestAddress;
                strings += " " + this.DestPorts;
                strings += " " + this.SrcAddress;
                strings += " " + this.SrcPorts;
                strings += " " + this.ICMPOptions;
                strings += " " + this.Interfaces;
                strings += " " + this.EdgeTraversal;
                return(FirewallPage.DoFilter(textFilter, strings, new List <ProgramID>()
                {
                    this.Rule.ProgID
                }));
            }
Beispiel #2
0
        private bool SocksFilter(object obj)
        {
            var item = obj as SocketItem;

            if (socketFilter != FirewallPage.FilterPreset.Socket.Any)
            {
                switch (socketFilter)
                {
                case FirewallPage.FilterPreset.Socket.TCP:
                    if ((item.sock.ProtocolType & (UInt32)IPHelper.AF_PROT.TCP) == 0)
                    {
                        return(false);
                    }
                    break;

                case FirewallPage.FilterPreset.Socket.Client:
                    if ((item.sock.ProtocolType & (UInt32)IPHelper.AF_PROT.TCP) == 0 || item.sock.State == (int)IPHelper.MIB_TCP_STATE.LISTENING)
                    {
                        return(false);
                    }
                    break;

                case FirewallPage.FilterPreset.Socket.Server:
                    if ((item.sock.ProtocolType & (UInt32)IPHelper.AF_PROT.TCP) == 0 || item.sock.State != (int)IPHelper.MIB_TCP_STATE.LISTENING)
                    {
                        return(false);
                    }
                    break;

                case FirewallPage.FilterPreset.Socket.UDP:
                    if ((item.sock.ProtocolType & (UInt32)IPHelper.AF_PROT.UDP) == 0)
                    {
                        return(false);
                    }
                    break;

                case FirewallPage.FilterPreset.Socket.Web:
                    if ((item.sock.ProtocolType & (UInt32)IPHelper.AF_PROT.TCP) == 0 || !(item.sock.RemotePort == 80 || item.sock.RemotePort == 443))
                    {
                        return(false);
                    }
                    break;
                }
            }

            if (item.sock.RemoteAddress != null)
            {
                if (NetFunc.IsLocalHost(item.sock.RemoteAddress))
                {
                    if (chkNoLocal.IsChecked == true)
                    {
                        return(false);
                    }
                }

                /*else if (NetFunc.IsMultiCast(item.sock.RemoteAddress))
                 * {
                 *  if (chkNoMulti.IsChecked == true)
                 *      return false;
                 * }*/
                else if (FirewallRule.MatchAddress(item.sock.RemoteAddress, FirewallRule.AddrKeywordLocalSubnet))
                {
                    if (chkNoLAN.IsChecked == true)
                    {
                        return(false);
                    }
                }
                else if (chkNoINet.IsChecked == true)
                {
                    return(false);
                }
            }

            if (FirewallPage.DoFilter(textFilter, item.name, new List <ProgramID>()
            {
                item.sock.ProgID
            }))
            {
                return(false);
            }
            return(true);
        }
Beispiel #3
0
        public ProgramListControl()
        {
            InitializeComponent();

            ProgramList = new ControlList <ProgramControl, ProgramSet>(this.processScroll, (prog) => { return(new ProgramControl(prog, CatModel)); }, (prog) => prog.guid.ToString(),
                                                                       (list) => { list.Sort(DoSort); }, (item) => { return(CurFilter != null && FirewallPage.DoFilter(CurFilter, item.progSet)); });

            ProgramList.SelectionChanged += (s, e) => { SelectionChanged?.Invoke(this, e); };

            SuspendChange++;

            //this.rbbSort.Header = Translate.fmt("lbl_sort_and");
            this.lblSort.Content = Translate.fmt("lbl_sort");
            //this.chkNoLocal.Content = Translate.fmt("chk_ignore_local");
            //this.chkNoLan.Content = Translate.fmt("chk_ignore_lan");

            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_no"), Sorts.Unsorted);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_name"), Sorts.Name);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_rname"), Sorts.NameRev);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_act"), Sorts.LastActivity);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_rate"), Sorts.DataRate);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_socks"), Sorts.SocketCount);
            WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_count"), Sorts.ModuleCount);
            WpfFunc.CmbSelect(cmbSort, ((Sorts)App.GetConfigInt("GUI", "SortList", 0)).ToString());

            this.chkNoLocal.IsChecked = App.GetConfigInt("GUI", "ActNoLocal", 0) == 1;
            this.chkNoLan.IsChecked   = App.GetConfigInt("GUI", "ActNoLan", 0) == 1;

            SuspendChange--;
        }