public override TokenStreamComponents CreateComponents(string fieldName, TextReader reader) { UAX29URLEmailTokenizer tokenizer = new UAX29URLEmailTokenizer(TEST_VERSION_CURRENT, reader); tokenizer.MaxTokenLength = int.MaxValue; // Tokenize arbitrary length URLs TokenFilter filter = new URLFilter(tokenizer); return(new TokenStreamComponents(tokenizer, filter)); }
private void FiddlerApplicationAfterSessionComplete(Session oSession) { if (string.IsNullOrEmpty(URLFilter) == false) { URLFilter = URLFilter.Replace("http://", ""); if (URLFilter.Split(' ').Any(item => oSession.url.Contains(item) == false)) { return; } } var httpitem = new HttpItem { Parameters = oSession.oRequest.headers.ToString() }; if ((oSession.BitFlags & SessionFlags.IsHTTPS) != 0) { httpitem.URL = "https://" + oSession.url; } else { httpitem.URL = "http://" + oSession.url; } httpitem.Postdata = Encoding.Default.GetString(oSession.RequestBody); if (string.IsNullOrEmpty(httpitem.Postdata) == false) { httpitem.Method = MethodType.POST; ControlExtended.UIInvoke(() => Documents.Add(httpitem)); } if (string.IsNullOrEmpty(ContentFilter) == false) { if (ContentFilter.Split(' ').Any(item => oSession.GetResponseBodyAsString().Contains(item) == false)) { return; } } httpitem.DictCopyTo(Http); XLogSys.Print.Info("已经成功获取嗅探字段" + oSession.url); }
/// <summary> /// Posts a message to the editor of an article that it has been submitted to a review forum /// </summary> /// <param name="submitterID"></param> /// <param name="editorID"></param> /// <param name="userName"></param> /// <param name="H2G2ID"></param> /// <param name="siteID"></param> /// <param name="reviewForumID"></param> /// <param name="forumID"></param> /// <param name="threadID"></param> /// <param name="postID"></param> /// <param name="subject"></param> /// <param name="comments"></param> public void NotifyAuthorOnPersonalSpace(int submitterID, int editorID, string userName, int H2G2ID, int siteID, int reviewForumID, int forumID, int threadID, int postID, string subject, string comments) { XmlElement submitReviewForum = AddElementTag(RootElement, "SUBMIT-REVIEW-FORUM"); int userForumID = 0; using (IDnaDataReader dataReader = InputContext.CreateDnaDataReader("fetchpersonalspaceforum")) { dataReader.AddParameter("userid", editorID); dataReader.AddParameter("siteid", siteID); dataReader.Execute(); // Check to see if we found anything if (dataReader.HasRows && dataReader.Read()) { userForumID = dataReader.GetInt32NullAsZero("ForumID"); } } if (userForumID == 0) { throw new DnaException("No Personal Space Forum - Failed to send message to Personal Space"); } if (submitterID == 0) { AddErrorXml("NO-USER","Failed to get User details", submitReviewForum); } User submitter = new User(InputContext); submitter.CreateUser(submitterID); string submitterName = submitter.UserName; ReviewForum reviewForum = new ReviewForum(InputContext); reviewForum.InitialiseViaReviewForumID(reviewForumID, false); string generatedSubject = "Your entry has been submitted to '" + reviewForum.ReviewForumName + "'"; string generatedBody = "Entry: " + subject + " - A" + H2G2ID + " \n"; generatedBody += "Author: " + userName + " - U" + editorID + " \n"; generatedBody += "Submitter: " + submitterName + " - U" + submitterID + "\n\n"; generatedBody += "This is an automated message.\n\n"; generatedBody += "Your entry above has been submitted to the Review Forum '" + reviewForum.ReviewForumName + "'" + " by the Researcher named above. For more information about what happens next check out <./>ReviewForums-Next</.>.\n\n"; generatedBody += "You can see the discussion about your entry at " + "F" + forumID + "?thread=" + threadID + "\n\n"; generatedBody += "If you'd rather your entry wasn't in this Review Forum then you can remove it by visiting " + "<./>" + reviewForum.UrlFriendlyName + "</.> and clicking on the relevant 'Remove' link." + " To prevent it being put into a Review Forum in the future, please click on the 'Edit Entry' button and tick the 'Not for Review' box.\n\n"; if (forumID > 0) { // Check the user input for profanities! //ProfanityFilter profanityFilter = new ProfanityFilter(InputContext); string matchingProfanity = String.Empty; List<Term> terms = null; ProfanityFilter.FilterState filterState = ProfanityFilter.CheckForProfanities(InputContext.CurrentSite.ModClassID, generatedSubject + " " + generatedBody, out matchingProfanity, out terms, forumID); bool forceModeration = false; if (filterState == ProfanityFilter.FilterState.FailBlock) { AddErrorXml("profanityblocked", matchingProfanity, submitReviewForum); return; } else if (filterState == ProfanityFilter.FilterState.FailRefer) { forceModeration = true; } if(InputContext.GetSiteOptionValueBool("General", "IsURLFiltered") && !(InputContext.ViewingUser.IsEditor || InputContext.ViewingUser.IsNotable)) { URLFilter URLFilter = new URLFilter(InputContext); List<string> nonAllowedURLs = new List<string>(); URLFilter.FilterState URLFilterState = URLFilter.CheckForURLs(generatedSubject + " " + generatedBody, nonAllowedURLs); if (URLFilterState == URLFilter.FilterState.Fail) { //return immediately - these don't get submitted AddErrorXml("nonAllowedURLsFound", "For example " + nonAllowedURLs[0], submitReviewForum); return; } } //Filter for email addresses. if (InputContext.GetSiteOptionValueBool("Forum", "EmailAddressFilter") && !(InputContext.ViewingUser.IsEditor || InputContext.ViewingUser.IsNotable)) { if (EmailAddressFilter.CheckForEmailAddresses(generatedSubject + " " + generatedBody)) { //return immediately - these don't get submitted AddErrorXml("EmailAddressFilter", "Email Address Found.", submitReviewForum); return; } } string hash = String.Empty; string hashString = generatedSubject + "<:>" + generatedBody + "<:>" + submitterID + "<:>" + userForumID + "<:>0"; // Setup the stored procedure object using (IDnaDataReader reader = InputContext.CreateDnaDataReader("posttoforum")) { reader.AddParameter("userID", submitterID); reader.AddParameter("forumid", userForumID); reader.AddParameter("inreplyto", DBNull.Value); reader.AddParameter("threadid", DBNull.Value); reader.AddParameter("subject", generatedSubject); reader.AddParameter("content", generatedBody); reader.AddParameter("poststyle", 2); reader.AddParameter("Hash", DnaHasher.GenerateHash(hashString)); reader.AddParameter("forcemoderation", forceModeration); // Now call the procedure reader.Execute(); } } }
public override TokenStreamComponents CreateComponents(string fieldName, TextReader reader) { UAX29URLEmailTokenizer tokenizer = new UAX29URLEmailTokenizer(TEST_VERSION_CURRENT, reader); tokenizer.MaxTokenLength = int.MaxValue; // Tokenize arbitrary length URLs TokenFilter filter = new URLFilter(tokenizer); return new TokenStreamComponents(tokenizer, filter); }
// GET: AuditLogs public ActionResult Index(string currentURLFilter, string URLFilter, string currentIPAddressFilter, string IPAddressFilter, string currentUserFilter, string UserFilter, int?page) { if (UserFilter != null) { page = 1; } else { UserFilter = currentUserFilter; } if (IPAddressFilter != null) { page = 1; } else { IPAddressFilter = currentIPAddressFilter; } if (URLFilter != null) { page = 1; } else { URLFilter = currentURLFilter; } ViewBag.CurrentUserFilter = UserFilter; ViewBag.CurrentIPAddressFilter = IPAddressFilter; ViewBag.CurrentURLFilter = URLFilter; List <AuditLog> AuditRecords = db.AuditRecords.OrderByDescending(x => x.TimeAccessed).ToList(); if (!String.IsNullOrEmpty(UserFilter)) { AuditRecords = AuditRecords.Where(s => s.UserName.ToLower().Contains(UserFilter.ToLower())).ToList(); } if (!String.IsNullOrEmpty(IPAddressFilter)) { AuditRecords = AuditRecords.Where(s => s.IPAddress.ToLower().Contains(IPAddressFilter.ToLower())).ToList(); } if (!String.IsNullOrEmpty(URLFilter)) { AuditRecords = AuditRecords.Where(s => (s.URLAccessed ?? "").ToLower().Contains(URLFilter.ToLower())).ToList(); } int pageSize = 100; int pageNumber = (page ?? 1); return(View(AuditRecords.ToPagedList(pageNumber, pageSize))); }