public void checkEPRuleTest() { areTrue(FilterPolicy.checkEPRuleMatch(new EPPolicy() { Type = AllowEPType.STARTWITH, EpFormat = "/r/collect" }, "/r/coLleCt")); areTrue(FilterPolicy.checkEPRuleMatch(new EPPolicy() { Type = AllowEPType.CONTAIN, EpFormat = "&safe=1" }, "/searcH?q=anyword&safe=1")); areTrue(FilterPolicy.checkEPRuleMatch(new EPPolicy() { Type = AllowEPType.REGEX, EpFormat = "\\/search\\?q=.*&safe=1" }, "/searCh?q=anyword&safe=1")); areFalse(FilterPolicy.checkEPRuleMatch(new EPPolicy() { Type = AllowEPType.REGEX, EpFormat = "\\/search\\?q=.*&safe=1" }, "/search?q=anyword")); areFalse(FilterPolicy.checkEPRuleMatch(new EPPolicy() { Type = AllowEPType.REGEX, EpFormat = "\\/search\\?q=.*&safe=1" }, "")); }
public void getWordSurroundingTest() { string testResult = ""; string Content = "this are very tight text"; string word = "this"; testResult += FilterPolicy.getWordSurrounding(Content, Content.IndexOf(word), word.Length) + '\n'; word = "are"; testResult += FilterPolicy.getWordSurrounding(Content, Content.IndexOf(word), word.Length) + '\n'; word = "ver"; testResult += FilterPolicy.getWordSurrounding(Content, Content.IndexOf(word), word.Length) + '\n'; word = "text"; testResult += FilterPolicy.getWordSurrounding(Content, Content.IndexOf(word), word.Length) + '\n'; Content = "long long long long long long this are very tight text long long long long long long"; word = "this"; testResult += FilterPolicy.getWordSurrounding(Content, Content.IndexOf(word), word.Length) + '\n'; word = "are"; testResult += FilterPolicy.getWordSurrounding(Content, Content.IndexOf(word), word.Length) + '\n'; word = "ver"; testResult += FilterPolicy.getWordSurrounding(Content, Content.IndexOf(word), word.Length) + '\n'; word = "text"; testResult += FilterPolicy.getWordSurrounding(Content, Content.IndexOf(word), word.Length); Console.Write(testResult); }
IList<Slice> tmp_keys_; // policy_->CreateFilter() argument #endregion Fields #region Constructors public FilterBlockBuilder(FilterPolicy policy) { start_ = new List<int>(); tmp_keys_ = new List<Slice>(); filter_offsets_ = new List<uint>(); policy_ = policy; }
public void MitmEndpointsFeatures() { FilterPolicy filter = new FilterPolicy() { BlockedPhrases = new List <PhraseFilter>() { }, AllowedDomains = new List <DomainPolicy>() { new DomainPolicy() { DomainBlocked = true, DomainFormat = "aaa.maariv.co.il", Type = AllowDomainType.EXACT }, new DomainPolicy() { DomainBlocked = false, DomainFormat = ".maariv.co.il", Type = AllowDomainType.SUBDOMAINS }, new DomainPolicy() { DomainBlocked = true, DomainFormat = "tmi.maariv.co.il", Type = AllowDomainType.EXACT }, } }; string newDomain1 = "add.com"; string newDomain2 = ".addmore.com"; string newDomain3 = "extra.com"; // Add whitelist Assert.IsFalse(filter.isWhitelistedHost(newDomain1)); filter.addWhitelistDomain(newDomain1); Assert.IsTrue(filter.isWhitelistedHost(newDomain1)); Assert.IsTrue(filter.isWhitelistedURL(newDomain1, "/anyEp", out _)); // Add whitelist sub+domain Assert.IsFalse(filter.isWhitelistedHost(newDomain2)); filter.addWhitelistDomain(newDomain2); Assert.IsTrue(filter.isWhitelistedHost("sub" + newDomain2)); Assert.IsTrue(filter.isWhitelistedURL("sub2" + newDomain2, "/anyEp", out _)); // Block domain by find filter.findAllowedDomain(newDomain1).DomainBlocked = true; Assert.IsFalse(filter.isWhitelistedURL(newDomain1, "/anyEp", out _)); // Add EP (allow \\ block) filter.addWhitelistDomain(newDomain3); filter.findAllowedDomain(newDomain3).AddEndpoint(true, "/ok", AllowEPType.STARTWITH); Assert.IsFalse(filter.isWhitelistedURL(newDomain3, "/", out _)); Assert.IsTrue(filter.isWhitelistedURL(newDomain3, "/ok_1", out _)); Assert.IsFalse(filter.isWhitelistedURL(newDomain3, "/not-ok_1", out _)); filter.findAllowedDomain(newDomain3).AddEndpoint(false, "bad", AllowEPType.CONTAIN); Assert.IsFalse(filter.isWhitelistedURL(newDomain3, "/ok_1_but_bad", out _)); }
public HtmlFilter(FilterPolicy policy) { if (policy == null) { throw new Exception(); } Policy = policy; }
public CssFilter(FilterPolicy policy) { if (policy == null) { throw new Exception(); } Policy = policy; EmbedStyleSheets = policy.Directive<bool>("embedStyleSheets"); }
public void checkPhraseFoundWordTest() { string context = "", allContexts = ""; string BodyContent = "This text has baDword and \"2wronGword\" and nonOword3 wroNgworK"; List <string> words = FilterPolicy.getWords(BodyContent); areFalse(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "text", Type = BlockPhraseType.CONTAIN // Not supported in checkPhraseFoundWord }, out context)); allContexts += context + '\n'; areFalse(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "", Type = BlockPhraseType.WORDCONTAINING }, out context)); allContexts += context + '\n'; areFalse(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "", Type = BlockPhraseType.EXACTWORD }, out context)); allContexts += context + '\n'; areFalse(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "notfound", Type = BlockPhraseType.WORDCONTAINING }, out context)); allContexts += context + '\n'; areTrue(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "badword", Type = BlockPhraseType.EXACTWORD }, out context)); allContexts += context + '\n'; areTrue(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "wrongword", Type = BlockPhraseType.EXACTWORD }, out context)); allContexts += context + '\n'; areTrue(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "nonoword", Type = BlockPhraseType.EXACTWORD }, out context)); allContexts += context + '\n'; areTrue(FilterPolicy.checkPhraseFoundWord(words, new PhraseFilter() { Phrase = "rongwor", Type = BlockPhraseType.WORDCONTAINING }, out context)); allContexts += context + '\n'; //Console.Write(allContexts); }
public void checkPhraseFoundSimpleTest() { string BodyContent = "This text has baDword and \"2wronGword\" and nonOword3 wroNgworK"; string context = "", allContexts = ""; areFalse(FilterPolicy.checkPhraseFoundSimple(BodyContent, new PhraseFilter() { Phrase = "text", Type = BlockPhraseType.EXACTWORD // Not supported in checkPhraseFoundSimple }, out context)); allContexts += context + '\n'; areFalse(FilterPolicy.checkPhraseFoundSimple("", new PhraseFilter() { Phrase = "notfound", Type = BlockPhraseType.CONTAIN }, out context)); allContexts += context + '\n'; areFalse(FilterPolicy.checkPhraseFoundSimple("", new PhraseFilter() { Phrase = "notfound", Type = BlockPhraseType.REGEX }, out context)); allContexts += context + '\n'; areFalse(FilterPolicy.checkPhraseFoundSimple(BodyContent, new PhraseFilter() { Phrase = "notfound", Type = BlockPhraseType.CONTAIN }, out context)); allContexts += context + '\n'; areTrue(FilterPolicy.checkPhraseFoundSimple(BodyContent, new PhraseFilter() { Phrase = "badword", Type = BlockPhraseType.CONTAIN }, out context)); allContexts += context + '\n'; areTrue(FilterPolicy.checkPhraseFoundSimple(BodyContent, new PhraseFilter() { Phrase = "wrongword", Type = BlockPhraseType.CONTAIN }, out context)); allContexts += context + '\n'; areTrue(FilterPolicy.checkPhraseFoundSimple(BodyContent, new PhraseFilter() { Phrase = "nonoword", Type = BlockPhraseType.CONTAIN }, out context)); allContexts += context + '\n'; areTrue(FilterPolicy.checkPhraseFoundSimple(BodyContent, new PhraseFilter() { Phrase = "wrongwor[tk]", Type = BlockPhraseType.REGEX }, out context)); allContexts += context + '\n'; //Console.Write(allContexts); }
public void blockSubdomainAfterDomain() { FilterPolicy filter = new FilterPolicy() { BlockedPhrases = new List <PhraseFilter>() { }, AllowedDomains = new List <DomainPolicy>() { new DomainPolicy() { DomainBlocked = true, DomainFormat = "aaa.maariv.co.il", Type = AllowDomainType.EXACT }, new DomainPolicy() { DomainBlocked = false, DomainFormat = ".maariv.co.il", Type = AllowDomainType.SUBDOMAINS }, new DomainPolicy() { DomainBlocked = true, DomainFormat = "tmi.maariv.co.il", Type = AllowDomainType.EXACT }, } }; string reason = ""; areFalse(filter.isWhitelistedURL(new Uri( "https://aaa.maariv.co.il/sss?a=b&c=d") , out reason)); areTrue(filter.isWhitelistedURL(new Uri( "https://www.maariv.co.il/sss?a=b&c=d") , out reason)); areTrue(filter.isWhitelistedURL(new Uri( "https://maariv.co.il/sss?a=b&c=d") , out reason)); areTrue(filter.isWhitelistedURL(new Uri( "https://abc.maariv.co.il/sss?a=b&c=d") , out reason)); areFalse(filter.isWhitelistedURL(new Uri( "https://tmi.maariv.co.il/sss?a=b&c=d") , out reason)); Console.WriteLine(reason); }
public void checkEPRuleMatchTest_LowerText() { areTrue(FilterPolicy.checkEPRuleMatch(new EPPolicy() { EpFormat = "/LOWER", Type = AllowEPType.STARTWITH }, "/lower")); areTrue(FilterPolicy.checkEPRuleMatch(new EPPolicy() { EpFormat = "LOWER", Type = AllowEPType.CONTAIN }, "/lower-some")); }
public void URLTest() { string reason_throwaway = ""; FilterPolicy filter = new FilterPolicy() { BlockedPhrases = new List <PhraseFilter>() { new PhraseFilter() { Type = BlockPhraseType.WORDCONTAINING, Phrase = "bad", Scope = BlockPhraseScope.URL }, new PhraseFilter() { Type = BlockPhraseType.REGEX, Phrase = "wor[dk]", Scope = BlockPhraseScope.URL } } }; filter.AllowedDomains = new List <DomainPolicy>() { new DomainPolicy() { DomainBlocked = false, DomainFormat = "go.com", Type = AllowDomainType.SUBDOMAINS, AllowEP = new List <EPPolicy>() { new EPPolicy() { Type = AllowEPType.STARTWITH, EpFormat = "/i-am-whitelisted" } } } }; string ep1 = "/search?q=verybadword"; string ep2 = "/i-am-whitelisted"; string ep3 = "/i-am-whitelisted/badword"; areTrue(filter.isWhitelistedHost("g.go.com")); areTrue(filter.isWhitelistedURL("go.com", ep2, out reason_throwaway)); areFalse(filter.isWhitelistedURL("go.com", "/not-ok", out reason_throwaway)); areFalse(filter.isWhitelistedURL("go-go.com", ep2, out reason_throwaway)); areTrue(filter.isWhitelistedHost("go.com")); areFalse(filter.isWhitelistedURL("g.go.com", ep2 + "/work", out reason_throwaway)); }
public void nullAtInit() { IHTTPFilter filter = new FilterPolicy(); try { filter.isWhitelistedHost("try.com"); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public MutableFilter([NotNull] IObservable <IChangeSet <T> > source, [NotNull] IObservable <Func <T, bool> > predicates, FilterPolicy filterPolicy = FilterPolicy.ClearAndReplace) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (predicates == null) { throw new ArgumentNullException(nameof(predicates)); } _source = source; _predicates = predicates; _filterPolicy = filterPolicy; }
public void getWordsTest() { string text = "<input value=\"gogo\"></input>"; Assert.AreEqual(true, FilterPolicy.getWords(text).Contains("gogo")); text = "go home \"gogo\" g"; Assert.AreEqual(true, FilterPolicy.getWords(text).Contains("gogo")); text = "first second thidr122"; var words = FilterPolicy.getWords(text); areTrue(words.Contains("first")); areTrue(words.Contains("second")); areTrue(words.Contains("thidr")); areFalse(words.Contains("thidr122")); }
// REQUIRES: "contents" and *policy must stay live while *this is live. public FilterBlockReader(FilterPolicy policy, Slice contents) { policy_ = policy; data_ = ByteArrayPointer.Null; offset_ = ByteArrayPointer.Null; num_ = 0; base_lg_ = 0; int n = contents.Size; if (n < 5) return; // 1 byte for base_lg_ and 4 for start of offset array base_lg_ = contents[n - 1]; UInt32 last_word = Coding.DecodeFixed32(contents.Data + n - 5); if (last_word > n - 5) return; data_ = contents.Data; offset_ = data_ + (int)last_word; num_ = (int)((n - 5 - last_word) / 4); }
public void trustedDomains() { FilterPolicy filter = new FilterPolicy() { BlockedPhrases = new List <PhraseFilter>() { }, AllowedDomains = new List <DomainPolicy>() { new DomainPolicy() { DomainBlocked = true, DomainFormat = "www.shalom.co.il", Type = AllowDomainType.EXACT, Trusted = true, }, new DomainPolicy() { DomainBlocked = false, DomainFormat = ".maariv.co.il", Type = AllowDomainType.SUBDOMAINS, Trusted = true, }, new DomainPolicy() { DomainBlocked = false, DomainFormat = ".ynet.co.il", Type = AllowDomainType.SUBDOMAINS }, } }; Assert.IsTrue(filter.isTrustedHost("www.shalom.co.il")); Assert.IsFalse(filter.isTrustedHost("wwshalom.co.il")); Assert.IsTrue(filter.isTrustedHost("maariv.co.il")); Assert.IsFalse(filter.isTrustedHost("submaariv.co.il")); Assert.IsTrue(filter.isTrustedHost("sub.maariv.co.il")); Assert.IsFalse(filter.isTrustedHost("ynet.co.il")); Assert.IsFalse(filter.isTrustedHost("sub.ynet.co.il")); }
public void regexContext() { FilterPolicy filter = new FilterPolicy() { BlockedPhrases = new List <PhraseFilter>() { new PhraseFilter() { Type = BlockPhraseType.REGEX, Phrase = "la[tp]ex", Scope = BlockPhraseScope.ANY // just block it - Very bad term! }, new PhraseFilter() { Type = BlockPhraseType.REGEX, Phrase = "^(?=.*search)(?!.*google\\.com).*\\/search.*[\\?&]q\\=", Scope = BlockPhraseScope.URL, } }, AllowedDomains = new List <DomainPolicy>() { new DomainPolicy() { DomainBlocked = false, DomainFormat = ".google.com", Type = AllowDomainType.SUBDOMAINS } } }; string reason = ""; areFalse(filter.isContentAllowed("translateX: -50%", BlockPhraseScope.BODY, out reason)); areTrue(filter.isWhitelistedURL(new Uri( "https://www.google.com/search?q=normal%20search&oq=normal%20search&aqs=chrome..69i57.2865j0j1&sourceid=chrome&ie=UTF-8&safe=active") , out reason)); Console.Write(reason); }
public static FilterPolicy[] getFilterPolicies() { List <FilterPolicy> ret = new List <FilterPolicy>(); string result = exec("show policy all format=table"); if (result.Contains("IPsec[05072]")) { return(new FilterPolicy[0]); } string[] parts = result.Replace("\r", "").Split('\n'); for (int i = 4; i < parts.Length - 5; i++) { string part = parts[i]; string[] cells = part.Split('\t'); FilterPolicy filterPolicy = new FilterPolicy(); filterPolicy.name = cells[0].Trim(); filterPolicy.rules = int.Parse(cells[1].Trim()); filterPolicy.assigned = true; //f**k windows nl ret.Add(filterPolicy); } return(ret.ToArray()); }
public void emptyContent() { FilterPolicy filter = new FilterPolicy() { BlockedPhrases = new List <PhraseFilter>() { new PhraseFilter() { Type = BlockPhraseType.WORDCONTAINING, Phrase = "bad" }, new PhraseFilter() { Type = BlockPhraseType.REGEX, Phrase = "wor[dk]" } } }; Assert.AreEqual(null, filter.findBlockingPhrase("", BlockPhraseScope.ANY, out _)); }
public void MitmEndpointsGetPhrases() { FilterPolicy filter = new FilterPolicy() { BlockedPhrases = new List <PhraseFilter>() { new PhraseFilter() { Type = BlockPhraseType.REGEX, Phrase = "la[tp]ex", Scope = BlockPhraseScope.ANY // just block it - Very bad term! }, new PhraseFilter() { Type = BlockPhraseType.REGEX, Phrase = "^(?=.*search)(?!.*google\\.com).*\\/search.*[\\?&]q\\=", Scope = BlockPhraseScope.URL, } }, AllowedDomains = new List <DomainPolicy>() { new DomainPolicy() { DomainBlocked = false, DomainFormat = ".google.com", Type = AllowDomainType.SUBDOMAINS } } }; var expectedJson = "[{\"Scope\":2,\"Type\":3,\"Phrase\":\"la[tp]ex\"},{\"Scope\":0,\"Type\":3,\"Phrase\":\"^(?=.*search)(?!.*google\\\\.com).*\\\\/search.*[\\\\?&]q\\\\=\"}]"; //Console.WriteLine(filter.getPhrasesJson()); (Copy value from quick watch) Assert.IsTrue(filter.getPhrasesJson() == expectedJson); }
public PolicyHtmlAttribute(FilterPolicy policy, string name, PolicyHtmlTag tag = null) : base(policy,name) { Tag = tag; }
public static FilterPolicy[] getFilterPolicies() { List<FilterPolicy> ret = new List<FilterPolicy>(); string result = exec("show policy all format=table"); if (result.Contains("IPsec[05072]")) return new FilterPolicy[0]; string[] parts = result.Replace("\r", "").Split('\n'); for (int i = 4; i < parts.Length - 5; i++) { string part = parts[i]; string[] cells = part.Split('\t'); FilterPolicy filterPolicy = new FilterPolicy(); filterPolicy.name = cells[0].Trim(); filterPolicy.rules = int.Parse(cells[1].Trim()); filterPolicy.assigned = true; //f**k windows nl ret.Add(filterPolicy); } return ret.ToArray(); }
public static void addFilterRule(string name, FilterPolicy policy, FilterList list, FilterAction action) { string s = exec("add rule name=\"" + name + "\" policy=\"" + policy.name + "\" filterlist=\"" + list.name + "\" filteraction=\"" + action.name + "\""); }
/// <summary> /// 实例化一个富文本对象 /// </summary> /// <param name="text">未被过滤的源文本</param> /// <param name="policy">过滤的安全策略,如果不提供将启用默认的安全策略</param> public RichText(string text, FilterPolicy policy = null) { this.text = text; this.policy = policy; }
private void clearPolicyToolStripMenuItem_Click(object sender, EventArgs e) { mainPolicy = new FilterPolicy(); refreshDomains(); refreshPhrases(); }
public PolicyAttribute(FilterPolicy policy, string name) { Name = name; Policy = policy; }
public void isWhitelistedEPTest() { string reason_throwaway = ""; IHTTPFilter filter = new FilterPolicy() { BlockedPhrases = new List <PhraseFilter>() { new PhraseFilter() { Type = BlockPhraseType.WORDCONTAINING, Phrase = "bad", Scope = BlockPhraseScope.ANY }, new PhraseFilter() { Type = BlockPhraseType.REGEX, Phrase = "wor[dk]", Scope = BlockPhraseScope.ANY } } , AllowedDomains = new List <DomainPolicy>() { new DomainPolicy() { DomainBlocked = false, DomainFormat = "e.com", Type = AllowDomainType.EXACT, AllowEP = new List <EPPolicy>() { new EPPolicy() { Type = AllowEPType.STARTWITH, EpFormat = "/i-am-whitelisted" } } } } }; string ep1 = "/search?q=verybadword"; string ep2 = "/i-am-whitelisted"; string ep3 = "/i-am-whitelisted/badword"; // any ep except bad phrases: areTrue(filter.isWhitelistedEP(new DomainPolicy() { DomainBlocked = false, DomainFormat = "", Type = AllowDomainType.EXACT, AllowEP = new List <EPPolicy>() }, ep1, out reason_throwaway)); areFalse(filter.isContentAllowed(ep1, BlockPhraseScope.URL, out reason_throwaway)); // only ep that are whitelisted var domain1 = ((FilterPolicy)filter).AllowedDomains[0]; areTrue(filter.isWhitelistedEP(domain1, ep2, out reason_throwaway)); areFalse(filter.isWhitelistedEP(domain1, "/not-whitelisted", out reason_throwaway)); areTrue(filter.isWhitelistedEP(domain1, ep2 + "/work", out reason_throwaway)); areFalse(filter.isContentAllowed(ep2 + "/work", BlockPhraseScope.URL, out reason_throwaway)); areFalse(filter.isWhitelistedURL(new Uri("http://e.com" + ep2 + "/work"), out reason_throwaway)); // does both checks areFalse(filter.isContentAllowed(ep3, BlockPhraseScope.URL, out reason_throwaway)); areFalse(filter.isWhitelistedURL(new Uri("http://e.com" + ep3), out reason_throwaway)); // does both checks areFalse(filter.isWhitelistedEP(null, "", out reason_throwaway)); }
public void PhraseBug() { string url = "https://www.youtube.com/results?search_query=fetish&pbj=1"; areTrue(FilterPolicy.getWords(url).Contains("fetish")); }
public PolicyCssProperty(FilterPolicy policy, string name) : base(policy, name) { }
public void newBlockFeatures() { var epAllowList = new List <EPPolicy>(); FilterPolicy filter = new FilterPolicy() { BlockedPhrases = new List <PhraseFilter>() { new PhraseFilter() { Type = BlockPhraseType.WORDCONTAINING, Phrase = "ssearch", Scope = BlockPhraseScope.URL // only search url will blocked }, new PhraseFilter() { Type = BlockPhraseType.EXACTWORD, Phrase = "veryHTMLTerm", Scope = BlockPhraseScope.BODY // like html }, new PhraseFilter() { Type = BlockPhraseType.WORDCONTAINING, Phrase = "veryBadTerm", Scope = BlockPhraseScope.ANY // just block it - Very bad term! }, }, AllowedDomains = new List <DomainPolicy>() { new DomainPolicy() { DomainBlocked = true, DomainFormat = "777.com", Type = AllowDomainType.SUBDOMAINS }, new DomainPolicy() { DomainBlocked = false, DomainFormat = "666.com", Type = AllowDomainType.SUBDOMAINS, AllowEP = epAllowList, BlockEP = new List <EPPolicy>() { new EPPolicy() { EpFormat = "\\/search(\\/{0,1})", Type = AllowEPType.REGEX } } } } }; string totalReason = ""; string reason = ""; // blocked by url\any but not body scope areFalse(filter.isWhitelistedURL("a.666.com", "/ssearch", out reason)); totalReason += reason + '\n'; areFalse(filter.isWhitelistedURL("a.666.com", "/ok?q=veryBadTerm", out reason)); totalReason += reason + '\n'; areTrue(filter.isWhitelistedURL("a.666.com", "/ok?q=veryHTMLTerm", out reason)); totalReason += "<Allowed>\n"; areFalse(filter.isContentAllowed("<veryHTMLTerm>", BlockPhraseScope.BODY, out reason)); totalReason += reason + '\n'; areTrue(filter.isContentAllowed("<ssearch>", BlockPhraseScope.BODY, out reason)); totalReason += "<Allowed>\n"; areFalse(filter.isContentAllowed("<veryBadTerm>", BlockPhraseScope.BODY, out reason)); totalReason += reason + '\n'; areTrue(filter.isContentAllowed("<veryHTMLTerm>", BlockPhraseScope.URL, out reason)); totalReason += "<Allowed>\n"; areFalse(filter.isContentAllowed("<ssearch>", BlockPhraseScope.URL, out reason)); totalReason += reason + '\n'; areFalse(filter.isContentAllowed("<veryBadTerm>", BlockPhraseScope.URL, out reason)); totalReason += reason + '\n'; areFalse(filter.isContentAllowed("<veryHTMLTerm>", BlockPhraseScope.ANY, out reason)); totalReason += reason + '\n'; areFalse(filter.isContentAllowed("<ssearch>", BlockPhraseScope.ANY, out reason)); totalReason += reason + '\n'; areFalse(filter.isContentAllowed("<veryBadTerm>", BlockPhraseScope.ANY, out reason)); totalReason += reason + '\n'; // Blocked 777 by "DomainBlocked" areFalse(filter.isWhitelistedURL("a.777.com", "/some-ep", out reason)); totalReason += reason + '\n'; // Allowed EP in 666 by default areTrue(filter.isWhitelistedURL("a.666.com", "/some-ep", out reason)); totalReason += "<Allowed>\n"; // Blocked EP in 666 by blocke EP areFalse(filter.isWhitelistedURL("a.666.com", "/some-ep/search/", out reason)); totalReason += reason + '\n'; areFalse(filter.isWhitelistedURL("a.666.com", "/some-ep/search", out reason)); totalReason += reason + '\n'; areFalse(filter.isWhitelistedURL("a.666.com", "/search/gggg", out reason)); totalReason += reason + '\n'; epAllowList.Add(new EPPolicy() { EpFormat = "/img", Type = AllowEPType.STARTWITH }); // Blocked EP in 66 when not default - no t in whitelist areFalse(filter.isWhitelistedURL("a.666.com", "/some-ep", out reason)); totalReason += reason + '\n'; // Allowed EP in 66 when w.l. and not blocked by ep areTrue(filter.isWhitelistedURL("a.666.com", "/img?a=b&b=c", out reason)); totalReason += "<Allowed>\n"; // Blocked EP in 66 when w.l. and blocked by ep areFalse(filter.isWhitelistedURL("a.666.com", "/img/search?a=b&b=c", out reason)); totalReason += reason; Console.Write(totalReason); }