Exemple #1
0
        internal void UpdateUI(Types.XWebSecData domainData)
        {
#if (DEBUG)
            Fiddler.FiddlerApplication.Log.LogString($"[XWebSec] Counts: {domainData.httpDomainList.Count} {domainData.httpsDomainList.Count} {domainData.filteredDomainList.Count}");
#endif
            xamlViewControl.UpdateUI(domainData);
        }
Exemple #2
0
        /// <summary>
        /// Initializes UI and primary data structures.
        /// </summary>
        private void InitializeXWebSecUI()
        {
            try
            {
                domainData = new Types.XWebSecData();
                errorList  = new ObservableCollection <string>();

                tabPage = new TabPage("Xbox Web Security");
                FiddlerApplication.UI.tabsViews.ImageList.Images.Add("xsec", GetTabIcon());
                tabPage.ImageIndex = FiddlerApplication.UI.tabsViews.ImageList.Images.IndexOfKey("xsec");
                viewControl        = new WpfHost();
                viewControl.Dock   = DockStyle.Fill;
                tabPage.Controls.Add(viewControl);

                String path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "excludedDomains.xml");
                ParseExludedDomainsFile(path);

                FiddlerApplication.UI.tabsViews.TabPages.Add(tabPage);
                FiddlerApplication.AfterSessionComplete += XWebSecExtension_SessionComplete;
                FiddlerApplication.OnLoadSAZ            += XWebSecExtension_Load;
            }
            catch (Exception exc)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("XWebSec Fiddler plugin encountered a fatal exception while loading:");
                sb.AppendLine(exc.ToString());
                MessageBox.Show(sb.ToString());
            }
        }
        internal void UpdateUI(Types.XWebSecData domainData)
        {
            Dispatcher.InvokeAsync(new Action(() =>
            {
                lock (updateLock)
                {
                    // update status tab
                    if (domainData.httpDomainCount + domainData.httpsDomainCount + domainData.filteredDomainCount > 0)
                    {
                        if (domainData.httpsDomainList.Count > 0)
                        {
                            StatusText.Content      = "Pass";
                            StatusText.Foreground   = new SolidColorBrush(Colors.Green);
                            HttpsDomains.Foreground = new SolidColorBrush(Colors.Green);
                        }

                        if (domainData.httpDomainList.Count > 0)
                        {
                            StatusText.Content     = "Failure";
                            StatusText.Foreground  = new SolidColorBrush(Colors.Red);
                            HttpDomains.Foreground = new SolidColorBrush(Colors.Red);
                        }
                    }
                    else
                    {
                        StatusText.Content      = "n/a";
                        StatusText.Foreground   = new SolidColorBrush(Colors.Gray);
                        HttpsDomains.Content    = "n/a";
                        HttpsDomains.Foreground = new SolidColorBrush(Colors.Gray);
                        HttpDomains.Content     = "n/a";
                        HttpDomains.Foreground  = new SolidColorBrush(Colors.Gray);
                    }

                    HttpsDomains.Content    = domainData.httpsDomainCount;
                    HttpDomains.Content     = domainData.httpDomainCount;
                    ExcludedDomains.Content = domainData.filteredDomainCount;

                    //Update data for lists
                    FilteredDataGrid.ItemsSource = from row in domainData.filteredDomainList.ToList()
                                                   select new
                    {
                        filterCount      = row.Value,
                        filterHttps      = row.Key.httpsFormatted,
                        filterDomainName = row.Key.domainName,
                        filterWS         = row.Key.webSocketFormatted
                    };

                    HttpsDataGrid.ItemsSource = from row in domainData.httpsDomainList.ToList()
                                                select new
                    {
                        count      = row.Value,
                        domainName = row.Key.domainName,
                        ws         = row.Key.webSocketFormatted
                    };

                    HttpDataGrid.ItemsSource = from row in domainData.httpDomainList.ToList()
                                               select new
                    {
                        count      = row.Value,
                        domainName = row.Key.domainName,
                        ws         = row.Key.webSocketFormatted
                    };

                    //Restore cached selection
                    if (DomainFilterTab.IsSelected)
                    {
                        foreach (int i in selectedFilterRows)
                        {
                            FilteredDataGrid.SelectedItems.Add(FilteredDataGrid.Items.GetItemAt(i));
                        }

                        FilteredDataGrid.Focus();
                    }

                    if (DomainTab.IsSelected)
                    {
                        if (selectedHttpRows.Count > 0)
                        {
                            foreach (int i in selectedHttpRows)
                            {
                                HttpDataGrid.SelectedItems.Add(HttpDataGrid.Items.GetItemAt(i));
                            }
                            HttpDataGrid.Focus();
                        }

                        if (selectedHttpsRows.Count > 0)
                        {
                            foreach (int i in selectedHttpsRows)
                            {
                                HttpsDataGrid.SelectedItems.Add(HttpsDataGrid.Items.GetItemAt(i));
                            }
                            HttpsDataGrid.Focus();
                        }
                    }
                }
            }));
        }