Beispiel #1
0
        public void PluginSettingsTest()
        {
            var expectedSettings = PluginSettings.Load(configFilePath);

            Assert.NotNull(expectedSettings);
            Assert.Null(expectedSettings.DiagnosticsUrl);
            Assert.NotNull(expectedSettings.UserDefinedTransformations);
            Assert.NotNull(expectedSettings.HttpsRedirects);
            Assert.Equal(0, expectedSettings.UserDefinedTransformations.Count());
            Assert.Equal(0, expectedSettings.HttpsRedirects.Count());

            expectedSettings.DiagnosticsUrl = new Uri("http://diagnostics.test.com/test");
            expectedSettings.UserName       = "******";
            var expectedPassword = "******";

            expectedSettings.SetPassword(expectedPassword);
            expectedSettings.UserDefinedTransformations = new RequestTransformation[] {
                new RequestTransformation {
                    DestinationHostHeader           = "testheader1",
                    DestinationPathAndQuery         = "http://testurl1",
                    RegexToMatchAgainstPathAndQuery = ".*"
                },
                new RequestTransformation {
                    DestinationHostHeader           = "testheader2",
                    DestinationPathAndQuery         = "http://testurl2",
                    RegexToMatchAgainstPathAndQuery = ".*"
                },
            };
            expectedSettings.HttpsRedirects = new[] {
                new HttpsLocalRedirect {
                    LocalHttpPort   = 2000,
                    RemoteHttpsPort = 444
                },
                new HttpsLocalRedirect {
                    LocalHttpPort   = 2001,
                    RemoteHttpsPort = 445
                }
            };
            expectedSettings.Save(configFilePath);

            output.WriteLine(File.ReadAllText(configFilePath));

            var actualSettings = PluginSettings.Load(configFilePath);

            Assert.Equal(expectedSettings.DiagnosticsUrl, actualSettings.DiagnosticsUrl);
            Assert.Equal(expectedSettings.UserName, actualSettings.UserName);
            Assert.Equal(expectedPassword, actualSettings.GetPassword());
            Assert.Equal(expectedSettings.UserDefinedTransformations, actualSettings.UserDefinedTransformations,
                         new RequestTransformationEqualityComparer());
            Assert.Equal(expectedSettings.HttpsRedirects, actualSettings.HttpsRedirects,
                         new HttpsRedirectEqualityComparer());
        }
        public void OnLoad()
        {
            try {
                ReloadSettings(PluginSettings.Load(configurationFilePath));

                pluginMenu = new PluginMenu(this);
                FiddlerApplication.UI.Menu.MenuItems.Add(pluginMenu.BishopMenu);
                isLoaded = true;
            } catch (Exception ex) {
                MessageBox.Show("There was a problem while loading the Bishop plugin. Please check the Fiddler log for details",
                                "Bishop is dead.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                LogFormat("Bishop error: {0}", ex);
            }
        }
Beispiel #3
0
        public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
        {
            Settings = new PluginSettings(this);

            DiscordService = new DiscordService();

            ACTTabControl          = new ACTTabControl(this);
            pluginScreenSpace.Text = "Kikisen Talk";
            pluginScreenSpace.Controls.Add(ACTTabControl);

            Settings.Load();
            ClearParamMessages();
            ClearBatchMessage();
            ActGlobals.oFormActMain.OnLogLineRead += OnLogLineRead;
        }
Beispiel #4
0
        public TamperingOptionsForm(string pluginSettingsFilePath)
        {
            InitializeComponent();

            this.pluginSettingsFilePath = pluginSettingsFilePath;
            pluginSettings = PluginSettings.Load(pluginSettingsFilePath);

            transformations = new Dictionary <string, RequestTransformation>(StringComparer.InvariantCultureIgnoreCase);
            foreach (var rt in pluginSettings.UserDefinedTransformations)
            {
                lbTamperingRules.Items.Add(rt.Name);
                transformations.Add(rt.Name, rt);
            }

            txtLocalHttpsRedirects.Text = string.Join(", ", pluginSettings.HttpsRedirects.Select(
                                                          r => string.Format("{0}:{1}", r.RemoteHttpsPort, r.LocalHttpPort)));
        }
        private void CastleConnection_Click(object sender, EventArgs e)
        {
            using (var dlg = new DiagnosticsCastleForm())
            {
                var settings = PluginSettings.Load(plugin.PluginConfigurationFilePath);
                dlg.TxtCastleUrl.Text      = settings.DiagnosticsUrl != null ? settings.DiagnosticsUrl.AbsoluteUri : string.Empty;
                dlg.TxtCastleUsername.Text = settings.UserName;
                dlg.TxtCastlePassword.Text = settings.GetPassword();
                if (dlg.ShowDialog(FiddlerApplication.UI) == DialogResult.OK)
                {
                    settings.DiagnosticsUrl = new Uri(dlg.TxtCastleUrl.Text);
                    settings.UserName       = dlg.TxtCastleUsername.Text;
                    settings.SetPassword(dlg.TxtCastlePassword.Text);
                    settings.Save(plugin.PluginConfigurationFilePath);

                    plugin.ReloadSettings(settings);

                    PrepareServerMenu();
                }
            }
        }
Beispiel #6
0
 public void Load()
 {
     settings.Load();
 }