public void AddCon(ProgramSet prog, Priv10Engine.FwEventArgs args) { if (this.ConNotify.Add(prog, args)) { ShowTab(this.conTab); } }
public void AddCon(ProgramSet prog, Priv10Engine.FwEventArgs args) { this.conTab.IsEnabled = true; tabs.SelectedItem = this.conTab; tabItems[this.conTab].state = STab.EState.eNew; //tabItems[this.conTab].state = tabs.SelectedItem != this.conTab ? STab.EState.eNew : STab.EState.eFilled; if (this.ConNotify.Add(prog, args)) { ShowWnd(); } }
public bool OnActivity(ProgramSet prog, Program program, Priv10Engine.FwEventArgs args) { ProgramControl item = null; if (!ProgramList.Items.TryGetValue(args.guid.ToString(), out item)) { if (FirewallPage.DoFilter(CurFilter, prog)) { return(false); } item = ProgramList.AddItem(prog); args.update = false; } //Note: windows firewall doesn't block localhost acces so we ignore it //if (args.entry.State == Program.LogEntry.States.RuleError // && args.entry.FwEvent.Action == FirewallRule.Actions.Allow // && !NetFunc.IsLocalHost(args.entry.FwEvent.RemoteAddress)) // item.SetError(true); if ((chkNoLocal.IsChecked != true || (args.entry.Realm != Program.LogEntry.Realms.LocalHost && args.entry.Realm != Program.LogEntry.Realms.MultiCast)) && (chkNoLan.IsChecked != true || args.entry.Realm != Program.LogEntry.Realms.LocalArea) && args.entry.FwEvent.ProcessId != ProcFunc.CurID) // Note: When DNS proxy is nabled we are always very active, so ignore it { switch (args.entry.FwEvent.Action) { case FirewallRule.Actions.Allow: item.Flash(Colors.LightGreen); break; case FirewallRule.Actions.Block: item.Flash(Colors.LightPink); break; } } item.DoUpdate(prog); return(SortBy == Sorts.LastActivity); }
/*private bool TestEntry(ProgramSet prog, Program.LogEntry entry) * { * switch (mConTypes) * { * case ConTypes.Allowed: if (entry.FwEvent.Action != FirewallRule.Actions.Allow) return false; break; * case ConTypes.Blocked: if (entry.FwEvent.Action != FirewallRule.Actions.Block) return false; break; * } * * if (chkNoLocal.IsChecked == true && (NetFunc.IsLocalHost(entry.FwEvent.RemoteAddress) || NetFunc.IsMultiCast(entry.FwEvent.RemoteAddress))) * return false; * * if (chkNoLAN.IsChecked == true && FirewallRule.MatchAddress(entry.FwEvent.RemoteAddress, "LocalSubnet")) * return false; * * if (FirewallPage.DoFilter(mConFilter, prog.config.Name, new List<ProgramID>() { entry.ProgID })) * return false; * * return true; * }*/ public void AddEntry(ProgramSet prog, Program program, Priv10Engine.FwEventArgs args) { //if (!TestEntry(prog, args.entry)) // return; if (args.update) { foreach (LogItem Item in LogList) { if (Item.entry.guid.Equals(args.entry.guid)) { Item.Update(args.entry); return; } } } LogList.Insert(0, new LogItem(args.entry, program != null ? program.Description : null)); while (LogList.Count > logLimit) { LogList.RemoveAt(logLimit); } }
public bool Add(ProgramSet progs, Priv10Engine.FwEventArgs args) { ProgramID id = args.entry.ProgID; Program prog = null; if (!progs.Programs.TryGetValue(id, out prog)) { return(false); } Tuple <Program, List <Priv10Engine.FwEventArgs> > list; if (!mEvents.TryGetValue(id, out list)) { if (args.update) { return(false); } list = new Tuple <Program, List <Priv10Engine.FwEventArgs> >(prog, new List <Priv10Engine.FwEventArgs>()); mEvents.Add(id, list); mEventList.Add(id); } if (args.update) { foreach (var oldEntry in list.Item2) { if (oldEntry.entry.guid.Equals(args.entry.guid)) { oldEntry.entry.Update(args.entry); break; } } } else { list.Item2.Add(args); } int oldIndex = curIndex; if (curIndex < 0) { curIndex = 0; } else if (curIndex >= mEventList.Count) { curIndex = mEventList.Count - 1; } UpdateIndex(); // don't update if the event is for a different entry int index = mEventList.FindIndex((x) => { return(id.CompareTo(x) == 0); }); if (curIndex == index) { LoadCurrent(oldIndex == curIndex); } return(true); }