private bool AnyValues() { return(BaseUri.Any() || DefaultSrc.Any() || ScriptSrc.Any() || ObjectSrc.Any() || StyleSrc.Any() || ImgSrc.Any() || MediaSrc.Any() || FrameSrc.Any() || ChildSrc.Any() || FrameAncestors.Any() || FontSrc.Any() || ConnectSrc.Any() || ManifestSrc.Any() || FormAction.Any()); }
public MainVM() { ConnectButtonCommand = new RelayCommand(() => { IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(Ip), int.Parse(Port)); UdpClient server = new UdpClient(endPoint); //server.Connect(endPoint); IPEndPoint ipEndPoint = null; var data = server.Receive(ref ipEndPoint); byte[] buffer = new byte[6500]; using (MemoryStream mStream = new MemoryStream(data)) { //Img = Image.FromStream(mStream); var bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.StreamSource = mStream; bitmap.EndInit(); ImgSrc = bitmap as ImageSource; ImageStr = ImgSrc.ToString(); MessageBox.Show(ImgSrc.ToString()); } }); }
public override int GetHashCode() { int hashImgSrc = ImgSrc == null ? 0 : ImgSrc.GetHashCode(); int hashId = Id.GetHashCode(); return(hashImgSrc ^ hashId); }
public bool Equals(ImageIndent other) { if (Object.ReferenceEquals(other, null)) { return(false); } if (Object.ReferenceEquals(this, other)) { return(true); } return(Id.Equals(other.Id) && ImgSrc.Equals(other.ImgSrc)); }
public Tuple <string, string> ToString(ICspNonceService nonceService) { string headerName; if (ReportOnly) { headerName = "Content-Security-Policy-Report-Only"; } else { headerName = "Content-Security-Policy"; } ICollection <string> values = new List <string> { DefaultSrc.ToString(nonceService), ScriptSrc.ToString(nonceService), StyleSrc.ToString(nonceService), ChildSrc.ToString(nonceService), ConnectSrc.ToString(nonceService), FontSrc.ToString(nonceService), FormAction.ToString(nonceService), ImgSrc.ToString(nonceService), MediaSrc.ToString(nonceService), ObjectSrc.ToString(nonceService), FrameAncestors.ToString(), PluginTypes.ToString() }; if (EnableSandbox) { values.Add(Sandbox.ToString()); } if (ReportUri != null) { values.Add("report-uri " + ReportUri); } string headerValue = string.Join(";", values.Where(s => s.Length > 0)); return(new Tuple <string, string>(headerName, headerValue)); }
List <LogAssociation> FindImgSourceAssociations(Session MainLog, List <Session> SessionList, RefererAssociationType RefAssoType) { List <LogAssociation> Associations = new List <LogAssociation>(); if (MainLog.Response == null) { return(Associations); } //Match img urls with absolute match and response content type match foreach (string ImgSrc in MainLog.Response.Html.GetDecodedValues("img", "src")) { try { Request ImgReq = new Request(ImgSrc.Trim()); foreach (Session Sess in SessionList) { if (!Sess.Request.Method.Equals("GET", StringComparison.OrdinalIgnoreCase)) { continue; } if (Sess.Request.FullUrl.Equals(ImgReq.FullUrl) && Sess.Response != null)// && Sess.Response.Code == 304 || Sess.Response.IsBinary) { if (Sess.Response.Code == 304 || Sess.Response.IsBinary) { LogAssociation LogAsso = new LogAssociation(LogAssociationType.ExternalImage, RefAssoType, IronHtml.UrlInHtmlMatch.FullAbsolute, LogAssociationMatchLevel.UrlMatchAndResponseType, MainLog, Sess); Associations.Add(LogAsso); } else { LogAssociation LogAsso = new LogAssociation(LogAssociationType.ExternalImage, RefAssoType, IronHtml.UrlInHtmlMatch.FullAbsolute, LogAssociationMatchLevel.UrlMatchOnly, MainLog, Sess); Associations.Add(LogAsso); } } } } catch { Request ImgReq = new Request(MainLog.Request.RelativeUrlToAbsoluteUrl(ImgSrc.Trim())); foreach (Session Sess in SessionList) { if (!Sess.Request.Method.Equals("GET", StringComparison.OrdinalIgnoreCase)) { continue; } if (Sess.Request.FullUrl.Equals(ImgReq.FullUrl) && Sess.Response != null)// && Sess.Response.Code == 304 || Sess.Response.IsBinary) { if (Sess.Response.Code == 304 || Sess.Response.IsBinary) { LogAssociation LogAsso = new LogAssociation(LogAssociationType.ExternalImage, RefAssoType, IronHtml.UrlInHtmlMatch.FullRelative, LogAssociationMatchLevel.UrlMatchAndResponseType, MainLog, Sess); Associations.Add(LogAsso); } else { LogAssociation LogAsso = new LogAssociation(LogAssociationType.ExternalImage, RefAssoType, IronHtml.UrlInHtmlMatch.FullRelative, LogAssociationMatchLevel.UrlMatchOnly, MainLog, Sess); Associations.Add(LogAsso); } } } } } return(Associations); }