/// <summary> /// Close the stream /// </summary> public override void Close() { //At this point the stream is closed and we can do Intrusion Detection //So call the attached events //Do IDS IDS ids = new IDS(this); ids.UTF7Decode = UTF7Decode; ids.JSDecode = JSDecode; ids.Run(); this.Report = ids.Report; //Call event if (OnPageReady != null) { OnPageReady(this); } //Finish page if not done by events if (!_continued) { _continued = true; throw new ApplicationException("When using a PageOutput filter you MUST call either WriteResponse() or WriteResponse(string)."); } }
/// <summary> /// Initialise the IDS to scan cookies using the same filters as an already existing IDS object /// </summary> /// <param name="cookies">The cookie collection to detect intrusions within</param> /// <param name="ids">The IDS containing the preloaded filters</param> public IDS(System.Web.HttpCookieCollection cookies, IDS ids) { _store = ids._store; _cookies = cookies; _report = new Report(RequestType.Cookie); IsCookie = true; }
/// <summary> /// Initialise the IDS to scan a GET, POST or other request using the same filters as an already existing IDS object /// </summary> /// <param name="request">The Name-Value collection to detect intrusions within</param> /// <param name="ids">The IDS containing the preloaded filters</param> /// <param name="requestType">Indicates What type of request this is and therefore whether to exclude certain parameters.</param> public IDS(NameValueCollection request, IDS ids, RequestType requestType) { _store = ids._store; _request = request; _report = new Report(requestType); switch (requestType) { case RequestType.Cookie: IsCookie = true; break; case RequestType.Post: IsForm = true; break; case RequestType.Header: IsHeader = true; break; } }
/// <summary> /// Initialise the IDS to scan a GET request using the same filters as an already existing IDS object /// </summary> /// <param name="request">The Name-Value collection to detect intrusions within</param> /// <param name="ids">The IDS containing the preloaded filters</param> public IDS(NameValueCollection request, IDS ids) { _store = ids._store; _request = request; _report = new Report(RequestType.Get); }
/// <summary> /// Construct an Output Filter object using the same filters as an already existing IDS object /// </summary> /// <param name="baseStream">The underlying stream to filter</param> /// <param name="page">The page this request is based on</param> /// <param name="encoder">An encoding object</param> /// <param name="ids">The IDS containing the preloaded filters</param> public OutputFilter(Stream baseStream, System.Web.UI.Page page, Encoding encoder, IDS ids) { _baseStream = baseStream; _enc = encoder; _page = page; _store = ids._store; }
/// <summary> /// Close the stream /// </summary> public override void Close() { //At this point the stream is closed and we can do Intrusion Detection //So call the attached events //Do IDS IDS ids = new IDS(this); ids.UTF7Decode = UTF7Decode; ids.JSDecode = JSDecode; ids.Run(); this.Report = ids.Report; //Call event if (OnPageReady != null) OnPageReady(this); //Finish page if not done by events if (!_continued) { _continued = true; throw new ApplicationException("When using a PageOutput filter you MUST call either WriteResponse() or WriteResponse(string)."); } }