Ejemplo n.º 1
0
 private void ResetBlackopsCA(object sender, EventArgs e)
 {
     TrafficViewer.GenerateBlackopsCA();
     MessageBox.Show("New cert generated. Save and re-import in your browser trusted root CA store");
 }
Ejemplo n.º 2
0
        private void OkClick(object sender, EventArgs e)
        {
            if (_checkOptMemory.Checked)
            {
                TrafficViewerOptions.Instance.MemoryBufferSize  = 1;
                TrafficViewerOptions.Instance.EstimatedLineSize = 1024;
            }
            else
            {
                TrafficViewerOptions.Instance.EstimatedLineSize = 10240;
                TrafficViewerOptions.Instance.MemoryBufferSize  = 100;
            }

            TrafficViewerOptions.Instance.TrafficServerIp         = _boxIp.Text;
            TrafficViewerOptions.Instance.TrafficServerPort       = (int)_numProxyPort.Value;
            TrafficViewerOptions.Instance.TrafficServerPortSecure = (int)_numServerSecurePort.Value;

            //re-initialize the variable definitions so we can use the SetMultiValueOption method
            TrafficViewerOptions.Instance.VariableDefinitions = null;
            TrafficViewerOptions.Instance.SetMultiValueOption("VariableDefinitions", _gridVarDefs.GetValues());

            TrafficViewerOptions.Instance.SetDynamicElements(_gridDynElems.GetValues());
            //import at startup
            TrafficViewerOptions.Instance.StartupImport        = _fileAutoLoad.Text;
            TrafficViewerOptions.Instance.StartupImportProfile = _boxStartupProfile.Text;

            TrafficViewerOptions.Instance.ColorTextboxBackground = TVColorConverter.GetARGBString(
                _swatchBackground.Color);
            TrafficViewerOptions.Instance.ColorTextboxText = TVColorConverter.GetARGBString(
                _swatchTextColor.Color);
            TrafficViewerOptions.Instance.ColorDiffText = TVColorConverter.GetARGBString(
                _swatchDiffColor.Color);
            TrafficViewerOptions.Instance.ColorHighlight = TVColorConverter.GetARGBString(
                _swatchHighlightColor.Color);

            TrafficViewerOptions.Instance.SetExtensions(_extensionGrid.GetValues());

            TrafficViewerOptions.Instance.SetResponsePatterns(_gridResponsePatterns.GetValues());
            TrafficViewerOptions.Instance.SetSessionIdRegexes(_gridSessionIds.GetValues());


            if (_checkPrompt.Checked)
            {
                TrafficViewerOptions.Instance.ActionOnClose = (int)ConfirmCloseResult.Unknown;
            }


            TrafficViewerOptions.Instance.StartupParser = _boxStartupParser.SelectedItem as string;

            TrafficViewerOptions.Instance.HttpClientName = _boxHttpClient.SelectedItem as string;

            //http clients
            TrafficViewer.Instance.HttpClientFactory = TrafficViewer.Instance.HttpClientFactoryList[_boxHttpClient.SelectedIndex];


            TrafficViewerOptions.Instance.IgnoreInvalidSslCert = _checkIgnoreInvalidCert.Checked;

            TrafficViewerOptions.Instance.UseProxy = _checkUseProxy.Checked;


            TrafficViewerOptions.Instance.HttpProxyServer = _boxProxyHost.Text;
            TrafficViewerOptions.Instance.ProxyCert       = _proxyCertificate.Text;
            TrafficViewerOptions.Instance.ProxyCertPass   = _boxProxyCertPass.Text;

            TrafficViewerOptions.Instance.HttpProxyPort      = (int)_boxProxyPort.Value;
            TrafficViewerOptions.Instance.HttpRequestTimeout = (int)_boxTimeout.Value;
            TrafficViewerOptions.Instance.RequestDelay       = (int)_numericRequestDelay.Value;
            TrafficViewerOptions.Instance.RequestDelayFilter = _textRequestDelayFilter.Text;

            if (String.IsNullOrEmpty(TrafficViewerOptions.Instance.ForwardingHost) && !String.IsNullOrEmpty(_textForwardingHost.Text))
            {
                if (MessageBox.Show(Resources.WarnForwarding,
                                    Resources.Warning, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.No)
                {
                    _textForwardingHost.Text = String.Empty;
                }
            }

            TrafficViewerOptions.Instance.ForwardingHost = _textForwardingHost.Text;
            TrafficViewerOptions.Instance.ForwardingPort = (int)_numForwardingPort.Value;


            TrafficViewerOptions.Instance.Save();

            //TrafficViewer.Instance.LoadExtensions(); //this causes extensions added dynamically to be deleted

            //WarnRestartNeeded();
            TrafficViewer.InitSdkSettings();

            this.Hide();
        }