コード例 #1
0
 private static void RemoveAllCertificates()
 {
     try
     {
         bool flag = false;
         if (CertMaker.rootCertIsMachineTrusted())
         {
             var rootCertificate = CertMaker.GetRootCertificate();
             if (rootCertificate != null)
             {
                 var subject = rootCertificate.Subject;
                 if (!String.IsNullOrEmpty(subject))
                 {
                     flag = Utilities.RunExecutableAndWait(CONFIG.GetPath("App") + "TrustCert.exe", String.Format("-u \"{0}\"", subject));
                 }
             }
         }
         if (CertMaker.removeFiddlerGeneratedCerts() || flag)
         {
             //FiddlerApplication.DoNotifyUser(this, string.Format("Fiddler-generated certificates have been removed from {0}", flag ? "both User and Machine Root storage." : "the Current User storage."), "Success", MessageBoxIcon.Asterisk);
         }
     }
     catch (Exception exception)
     {
         FiddlerApplication.ReportException(exception, "");
     }
 }
コード例 #2
0
        private static byte[] PNGDistill(byte[] arrIn)
        {
            string sTempFile = CONFIG.GetPath("Root") + "tmpToCompress" + Guid.NewGuid();

            File.WriteAllBytes(sTempFile, arrIn);

            int iResult;

            Utilities.GetExecutableOutput(sPNGDistillPath, "\"" + sTempFile + "\"" + " REPLACE", out iResult);

            byte[] arrNew = File.ReadAllBytes(sTempFile);

            #region DeleteTempFile
            try
            {
                File.Delete(sTempFile);
                FiddlerApplication.LogLeakedFile(sTempFile);
            }
            catch
            {
                Debug.Assert(false, "Could not delete Temp Input file");
            }
            #endregion DeleteTempFile
            return(arrNew);
        }
コード例 #3
0
        public static bool downloadUpdate(string version)
        {
            string locapath = CONFIG.GetPath("Scripts");
            string url      = download_url + "update.php?v=" + version;

            return(DownloadFile(url, locapath));
        }
コード例 #4
0
 private void btnCtrl_Click(object sender, EventArgs e)
 {
     this.ckAutoResponderExt = (CheckBox)this.epage.Controls["ckAutoResponderExt"];
     if (!this.ckAutoResponderExt.Checked)
     {
         MessageBox.Show("Check the EnableAutoResponderExt checkbox and then click the button", "AutoResponderExtension");
     }
     else if (FiddlerApplication.oAutoResponder.IsEnabled)
     {
         this.path = CONFIG.GetPath("MyDocs") + @"\Fiddler2\AutoResponderExt.xml";
         FiddlerApplication.oAutoResponder.SaveRules(this.path);
         this.LoadRules(this.path, true);
     }
 }
コード例 #5
0
        public FiddlerScriptCSharpExtension()
        {
            var scriptPath = CONFIG.GetPath("Scripts");

            _roslynScriptRepositories = new List <FiddlerScriptRepository> {
                new FiddlerScriptRepository(new CSharpScriptEngine(), scriptPath),
                new FiddlerScriptRepository(new VisualBasicScriptEngine(), scriptPath)
            };
            FiddlerApplication.FiddlerBoot           += () => _roslynScriptRepositories.ForEach(r => r.ExecuteAllOnBoot());
            FiddlerApplication.FiddlerShutdown       += () => _roslynScriptRepositories.ForEach(r => r.ExecuteAllOnShutdown());
            FiddlerApplication.BeforeFiddlerShutdown += (_, cancel) => cancel.Cancel = !_roslynScriptRepositories.Aggregate(true, (v, r) => v & r.ExecuteAllOnBeforeShutdown());
            FiddlerApplication.FiddlerAttach         += () => _roslynScriptRepositories.ForEach(r => r.ExecuteAllOnAttach());
            FiddlerApplication.FiddlerDetach         += () => _roslynScriptRepositories.ForEach(r => r.ExecuteAllOnDetach());
            FiddlerApplication.AfterSessionComplete  += session => _roslynScriptRepositories.ForEach(r => r.ExecuteAllOnDone(session));
            FiddlerApplication.OnWebSocketMessage    += (_, args) => _roslynScriptRepositories.ForEach(r => r.ExecuteAllOnWebSocketMessage(args.oWSM));
        }
コード例 #6
0
        private static byte[] BrotliCompress(byte[] arrIn, out uint iMS)
        {
            string sTempFile = CONFIG.GetPath("Root") + "tmpToCompress" + Guid.NewGuid();
            string sOutFile  = String.Concat(sTempFile, ".br");

            File.WriteAllBytes(sTempFile, arrIn);
            string sParams = String.Format("--in \"{0}\" --out \"{1}\" {2}",
                                           sTempFile,
                                           sOutFile,
                                           FiddlerApplication.Prefs.GetStringPref("extensions.compressibility.Brotli.Args", String.Empty));

            int       iExitCode = 0;
            Stopwatch oSW       = Stopwatch.StartNew();

            Utilities.GetExecutableOutput(sBrotliPath, sParams, out iExitCode);
            iMS = (uint)oSW.ElapsedMilliseconds;
            if (0 != iExitCode)
            {
                throw new Exception("Brotli conversion failed");
            }

            byte[] arrOut = File.ReadAllBytes(sOutFile);

            #region DeleteTempFiles
            try
            {
                File.Delete(sTempFile);
                FiddlerApplication.LogLeakedFile(sTempFile);
            }
            catch
            {
                Debug.Assert(false, "Could not delete Temp Input file");
            }

            try
            {
                File.Delete(sOutFile);
            }
            catch
            {
                FiddlerApplication.LogLeakedFile(sOutFile);
                Debug.Assert(false, "Could not delete Temp Output file");
            }
            #endregion DeleteTempFiles
            return(arrOut);
        }
コード例 #7
0
 private static void DecryptHttps()
 {
     CertMaker.EnsureReady();
     if ((CertMaker.rootCertExists() || CertMaker.createRootCert()) && !CertMaker.rootCertIsTrusted())
     {
         var flag = CertMaker.trustRootCert();
         if (!flag)
         {
             //FiddlerApplication.DoNotifyUser(this, "Unable to configure Windows to Trust the Fiddler Root certificate.\n\nThe LOG tab may contain more information.", "Certificate Trust", MessageBoxIcon.Exclamation);
         }
         if (flag && FiddlerApplication.Prefs.GetBoolPref("fiddler.CertMaker.OfferMachineTrust", ((Environment.OSVersion.Version.Major > 6) || ((Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor > 1)))))
         {
             var subject = CertMaker.GetRootCertificate().Subject;
             Utilities.RunExecutable(CONFIG.GetPath("App") + "TrustCert.exe", String.Format("\"{0}\"", subject));
         }
     }
 }
コード例 #8
0
        public void Initialize()
        {
            var options = ScriptOptions.Default
                          .WithIsInteractive(false)
                          .AddSearchPaths(CONFIG.GetPath("App"), CONFIG.GetPath("Scripts"))
                          .AddReferences("mscorlib.dll", "System.dll", "System.Core.dll", "Microsoft.CSharp.dll", "Fiddler.exe")
                          .AddNamespaces("Fiddler");
            string text;

            using (var fs = new FileStream(_path, FileMode.Open, FileAccess.Read))
            {
                using (var reader = new StreamReader(fs))
                {
                    text = reader.ReadToEnd();
                }
            }

            ScriptState script;

            try
            {
                script = ExecuteScript(text, options);
            }
            catch (Exception e)
            {
                FiddlerApplication.Log.LogString(e.ToString());
                return;
            }
            script.CreateDelegate <Action>("Main")?.Invoke();
            AutoTamperRequestBeforeDelegate  = script.CreateDelegate <Action <Session> >("OnBeforeRequest") ?? script.CreateDelegate <Action <Session> >(nameof(IAutoTamper3.AutoTamperRequestBefore));
            AutoTamperRequestAfterDelegate   = script.CreateDelegate <Action <Session> >("OnAfterRequest") ?? script.CreateDelegate <Action <Session> >(nameof(IAutoTamper3.AutoTamperRequestAfter));
            AutoTamperResponseBeforeDelegate = script.CreateDelegate <Action <Session> >("OnBeforeResponse") ?? script.CreateDelegate <Action <Session> >(nameof(IAutoTamper3.AutoTamperResponseBefore));
            AutoTamperResponseAfterDelegate  = script.CreateDelegate <Action <Session> >("OnAfterResponse") ?? script.CreateDelegate <Action <Session> >(nameof(IAutoTamper3.AutoTamperResponseAfter));
            OnBeforeReturningErrorDelegate   = script.CreateDelegate <Action <Session> >("OnReturningError") ?? script.CreateDelegate <Action <Session> >(nameof(IAutoTamper3.OnBeforeReturningError));
            OnPeekAtRequestHeadersDelegate   = script.CreateDelegate <Action <Session> >(nameof(IAutoTamper3.OnPeekAtRequestHeaders));
            OnPeekAtResponseHeadersDelegate  = script.CreateDelegate <Action <Session> >(nameof(IAutoTamper3.OnPeekAtResponseHeaders));
            OnFiddlerAttachDelegate          = script.CreateDelegate <Action>("OnAttach");
            OnFiddlerDetachDelegate          = script.CreateDelegate <Action>("OnDetach");
            OnFiddlerBeforeShutdownDelegate  = script.CreateDelegate <Func <bool> >("OnBeforeShutdown");
            OnFiddlerBootDelegate            = script.CreateDelegate <Action>("OnBoot");
            OnFiddlerShutdownDelegate        = script.CreateDelegate <Action>("OnShutdown");
            OnDoneDelegate             = script.CreateDelegate <Action <Session> >("OnDone");
            OnWebSocketMessageDelegate = script.CreateDelegate <Action <WebSocketMessage> >("OnWebSocketMessage");
        }
コード例 #9
0
        private static byte[] ToWebP(bool bLossless, byte[] arrIn, out uint iMS)
        {
            string sTempFile = CONFIG.GetPath("Root") + "tmpToCompress" + Guid.NewGuid();
            string sOutFile  = CONFIG.GetPath("Root") + Guid.NewGuid() + ".webp";

            File.WriteAllBytes(sTempFile, arrIn);

            int iResult;

            string sArgs = bLossless ?
                           FiddlerApplication.Prefs.GetStringPref("extensions.compressibility.WebPLossless.Args", "-m 6") :
                           FiddlerApplication.Prefs.GetStringPref("extensions.compressibility.WebPLossy.Args", "-m 6");

            Stopwatch oSW = Stopwatch.StartNew();
            string    s   = Utilities.GetExecutableOutput(sCWebPPath, ((bLossless) ? "-lossless " : "") +
                                                          " " + sArgs + " \"" + sTempFile + "\" -o \"" + sOutFile + "\"", out iResult);

            iMS = (uint)oSW.ElapsedMilliseconds;

            byte[] arrNew = File.ReadAllBytes(sOutFile);

            #region DeleteTempFiles
            try
            {
                File.Delete(sTempFile);
                FiddlerApplication.LogLeakedFile(sTempFile);
            }
            catch
            {
                Debug.Assert(false, "Could not delete Temp Input file");
            }
            try
            {
                File.Delete(sOutFile);
            }
            catch
            {
                FiddlerApplication.LogLeakedFile(sOutFile);
                Debug.Assert(false, "Could not delete Temp Output file");
            }
            #endregion DeleteTempFiles
            return(arrNew);
        }
コード例 #10
0
        private void InitializeComponent()
        {
            Debug.Log("Rosin running...");

            // 初始化相关文件路径
            if (!Directory.Exists(Config.FiddlerPath.RosinDir))
            {
                Directory.CreateDirectory(Config.FiddlerPath.RosinDir);
            }
            if (!Directory.Exists(Config.FiddlerPath.RosinLogDir))
            {
                Directory.CreateDirectory(Config.FiddlerPath.RosinLogDir);
            }

            if (!File.Exists(CONFIG.GetPath("Responses")))
            {
                string header = "HTTP/1.1 200 OK\r\nContent-Type: application/x-javascript\r\nConnection: close\r\nContent-Length: 0\r\n";
                header += "Access-Control-Allow-Credentials: true\r\nAccess-Control-Allow-Methods: GET,POST,OPTIONS\r\nAccess-Control-Allow-Origin:*\r\n\r\n";

                byte[] arrHeaders = System.Text.Encoding.ASCII.GetBytes(header);

                FileStream oFS = File.Create(CONFIG.GetPath("Responses") + "rosinpost.dat");
                oFS.Write(arrHeaders, 0, arrHeaders.Length);
                oFS.Close();

                // 模拟https的443接口响应,但是不能生效,改变实现策略,暂时注释掉
                // string httpsHeader = "HTTP/1.1 200 Connection Established\r\nFiddlerGateway: Direct\r\nStartTime: 19:25:13.898\r\nConnection: close\r\n\r\n";
                // byte[] arrHttpsHeaders = System.Text.Encoding.ASCII.GetBytes(httpsHeader);

                // FileStream oFSHttps = File.Create(CONFIG.GetPath("Responses") + "rosinhttps.dat");
                // oFSHttps.Write(arrHttpsHeaders, 0, arrHttpsHeaders.Length);
                // oFSHttps.Close();
            }

            this.iInjection   = new Injection();   // 实例化注入模块
            this.iInterceptor = new Interceptor(); // 实例化拦截模块
            this.iLocalData   = new LocalData();   // 实例化本地日志存储模块

            this.oConfigControl = new ConfigControl(iInjection, iInterceptor, iLocalData);
        }
コード例 #11
0
        public void OnLoad()
        {
            // load servant.dll
            var fiddlerUserPath = CONFIG.GetPath("AutoFiddlers_User");
            var asm             = Assembly.UnsafeLoadFrom(Path.Combine(fiddlerUserPath, BishopDllName));

            if (asm == null)
            {
                throw new InvalidOperationException("Bishop not found.");
            }
            var t = asm.GetType("LowLevelDesign.Diagnostics.Bishop.FiddlerPlugin");

            if (t == null)
            {
                throw new InvalidOperationException("Bishop.dll is not valid - does not contain the plugin class.");
            }
            var s = (IAutoTamper)Activator.CreateInstance(t);

            s.OnLoad();

            bishop = s;
        }
コード例 #12
0
    /// <summary>
    /// Ensures a 1x1 Transparent GIF file is in the \Responses\ subfolder.
    /// This image will be returned by Fiddler for certain blocked content.
    /// </summary>
    private void EnsureTransGif()
    {
        if (!File.Exists(CONFIG.GetPath("Responses") + "1pxtrans.dat"))
        {
            try
            {
                byte[] arrHeaders = Encoding.UTF8.GetBytes("HTTP/1.1 404 Blocked\r\nContentBlock: True\r\nDate: Wed, 31 Oct 2012 16:41:35 GMT\r\nContent-Type: image/gif\r\nConnection: close\r\nContent-Length: 49\r\n\r\n");
                byte[] arrBody    = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x91, 0xFF, 0x00,
                                      0xFF,    0xFF, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x21,
                                      0xF9,    0x04, 0x01, 0x00, 0x00, 0x02, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x01,
                                      0x00,    0x01, 0x00, 0x00, 0x02, 0x02, 0x54, 0x01, 0x00, 0x3B };

                FileStream oFS = File.Create(CONFIG.GetPath("Responses") + "1pxtrans.dat");
                oFS.Write(arrHeaders, 0, arrHeaders.Length);
                oFS.Write(arrBody, 0, arrBody.Length);
                oFS.Close();
            }
            catch (Exception eX)
            {
                MessageBox.Show(eX.ToString(), "Failed to create transparent gif...");
            }
        }
    }
コード例 #13
0
ファイル: AppCacheExport.cs プロジェクト: wnstjr93/pcap2saz
        public bool ExportSessions(string sFormat, Session[] oSessions, Dictionary <string, object> dictOptions, EventHandler <ProgressCallbackEventArgs> evtProgressNotifications)
        {
            if (sFormat != "HTML5 AppCache Manifest")
            {
                return(false);
            }
            bool   result = false;
            string text   = null;

            if (string.IsNullOrEmpty(text))
            {
                AppCacheOptions appCacheOptions = new AppCacheOptions();
                List <string>   list            = new List <string>();
                appCacheOptions.lvItems.BeginUpdate();
                for (int i = 0; i < oSessions.Length; i++)
                {
                    Session session = oSessions[i];
                    if (!session.HTTPMethodIs("CONNECT") && session.get_responseCode() >= 200 && session.get_responseCode() <= 399 && !list.Contains(session.get_fullUrl()))
                    {
                        list.Add(session.get_fullUrl());
                        string       text2        = (session.oResponse.get_headers() != null) ? Utilities.TrimAfter(session.oResponse.get_headers().get_Item("Content-Type"), ";") : string.Empty;
                        ListViewItem listViewItem = appCacheOptions.lvItems.Items.Add(session.get_fullUrl());
                        listViewItem.SubItems.Add((session.responseBodyBytes != null) ? session.responseBodyBytes.Length.ToString() : "0");
                        listViewItem.SubItems.Add(text2);
                        if (session.HTTPMethodIs("POST"))
                        {
                            listViewItem.Checked = true;
                        }
                        if (text2.IndexOf("script", StringComparison.OrdinalIgnoreCase) > -1)
                        {
                            listViewItem.Group = appCacheOptions.lvItems.Groups["lvgScript"];
                        }
                        else
                        {
                            if (text2.IndexOf("image/", StringComparison.OrdinalIgnoreCase) > -1)
                            {
                                listViewItem.Group = appCacheOptions.lvItems.Groups["lvgImages"];
                            }
                            else
                            {
                                if (text2.IndexOf("html", StringComparison.OrdinalIgnoreCase) > -1)
                                {
                                    listViewItem.Group = appCacheOptions.lvItems.Groups["lvgMarkup"];
                                }
                                else
                                {
                                    if (text2.IndexOf("css", StringComparison.OrdinalIgnoreCase) > -1)
                                    {
                                        listViewItem.Group = appCacheOptions.lvItems.Groups["lvgCSS"];
                                    }
                                    else
                                    {
                                        listViewItem.Group = appCacheOptions.lvItems.Groups["lvgOther"];
                                    }
                                }
                            }
                        }
                        listViewItem.Tag = session;
                    }
                }
                appCacheOptions.lvItems.EndUpdate();
                if (appCacheOptions.lvItems.Items.Count > 0)
                {
                    appCacheOptions.lvItems.FocusedItem = appCacheOptions.lvItems.Items[0];
                }
                if (DialogResult.OK == appCacheOptions.ShowDialog(FiddlerApplication.get_UI()))
                {
                    text = Utilities.ObtainSaveFilename("Export As " + sFormat, "AppCache Manifest (*.appcache)|*.appcache");
                    if (!string.IsNullOrEmpty(text))
                    {
                        try
                        {
                            List <string> list2 = new List <string>();
                            List <string> list3 = new List <string>();
                            string        text3 = appCacheOptions.txtBase.Text.Trim();
                            if (text3.Length == 0)
                            {
                                text3 = null;
                            }
                            for (int j = 0; j < appCacheOptions.lvItems.Items.Count; j++)
                            {
                                string text4 = appCacheOptions.lvItems.Items[j].Text;
                                if (text3 != null && text4.Length > text3.Length && text4.StartsWith(text3))
                                {
                                    text4 = text4.Substring(text3.Length);
                                }
                                if (appCacheOptions.lvItems.Items[j].Checked)
                                {
                                    list3.Add(text4);
                                }
                                else
                                {
                                    list2.Add(text4);
                                }
                            }
                            StringBuilder stringBuilder = new StringBuilder();
                            stringBuilder.AppendFormat("CACHE MANIFEST\r\n# Generated: {0}\r\n\r\n", DateTime.Now.ToString());
                            if (text3 != null)
                            {
                                stringBuilder.AppendFormat("# Deploy so that URLs are relative to: {0}\r\n\r\n", text3);
                            }
                            if (list2.Count > 0)
                            {
                                stringBuilder.Append("CACHE:\r\n");
                                stringBuilder.Append(string.Join("\r\n", list2.ToArray()));
                                stringBuilder.Append("\r\n");
                            }
                            if (appCacheOptions.cbNetworkFallback.Checked || list3.Count > 0)
                            {
                                stringBuilder.Append("\r\nNETWORK:\r\n");
                                if (appCacheOptions.cbNetworkFallback.Checked)
                                {
                                    stringBuilder.Append("*\r\n");
                                }
                                stringBuilder.Append(string.Join("\r\n", list3.ToArray()));
                            }
                            File.WriteAllText(text, stringBuilder.ToString());
                            Process.Start(CONFIG.GetPath("TextEditor"), text);
                            bool result2 = true;
                            return(result2);
                        }
                        catch (Exception ex)
                        {
                            FiddlerApplication.ReportException(ex, "Failed to save MeddlerScript");
                            bool result2 = false;
                            return(result2);
                        }
                    }
                    appCacheOptions.Dispose();
                }
            }
            return(result);
        }
コード例 #14
0
        public static bool downloadFiles(string URL, string path, string name)
        {
            string locapath = CONFIG.GetPath(path) + name;

            return(DownloadFile(URL, locapath));
        }
コード例 #15
0
        public bool ExportSessions(string sFormat, Session[] oSessions, Dictionary <string, object> dictOptions, EventHandler <ProgressCallbackEventArgs> evtProgressNotifications)
        {
            bool flag;

            if (sFormat != "OpPlan 4 Visual Studio WebTest")
            {
                return(false);
            }
            bool   bResult   = false;
            string sFilename = null;

            if (dictOptions != null && dictOptions.ContainsKey("Filename"))
            {
                sFilename = dictOptions["Filename"] as string;
            }
            if (string.IsNullOrEmpty(sFilename))
            {
                sFilename = Utilities.ObtainSaveFilename(string.Concat("Export As ", sFormat), "OpPlan 4 SAML parameterized token Visual Studio WebTest (*.webtest)|*.webtest");
            }
            if (string.IsNullOrEmpty(sFilename))
            {
                return(bResult);
            }
            this.EnsureVSTSAddons();
            bool bPromptForPlugins             = true;
            bool bIncludeAutoGeneratedComments = true;

            if (dictOptions != null)
            {
                if (dictOptions.ContainsKey("PluginPrompt") && ((string)dictOptions["PluginPrompt"]).ToLower() == "false")
                {
                    bPromptForPlugins = false;
                }
                if (dictOptions != null && dictOptions.ContainsKey("IncludeAutoGeneratedComments") && ((string)dictOptions["IncludeAutoGeneratedComments"]).ToLower() == "false")
                {
                    bIncludeAutoGeneratedComments = false;
                }
            }
            try
            {
                List <PluginClassReference> plugins = (new AssemblyHelper(FiddlerApplication.Prefs.GetStringPref("fiddler.config.path.webtestexport.plugins", string.Concat(CONFIG.GetPath("Transcoders_User"), "VSWebTestPlugins")))).FindAvailablePlugins();
                FiddlerWebTest webTest = new FiddlerWebTest(oSessions);
                if (bPromptForPlugins)
                {
                    frmSelectPlugins frmPlugins = new frmSelectPlugins(plugins);
                    frmPlugins.cbAllowAutoComments.Checked = bIncludeAutoGeneratedComments;
                    if (DialogResult.OK != frmPlugins.ShowDialog())
                    {
                        frmPlugins.Dispose();
                        flag = false;
                        return(flag);
                    }
                    else
                    {
                        webTest.LoadPlugins(frmPlugins.SelectedPlugins);
                        webTest.Save(sFilename, evtProgressNotifications, frmPlugins.cbAllowAutoComments.Checked,
                                     frmPlugins);
                        frmPlugins.Dispose();
                    }
                }
                else
                {
                    webTest.LoadPlugins(plugins);
                    webTest.Save(sFilename, evtProgressNotifications, bIncludeAutoGeneratedComments, new frmSelectPlugins(new List <PluginClassReference>()));
                }
                flag = true;
            }
            catch (Exception exception)
            {
                FiddlerApplication.ReportException(exception, "Failed to save test");
                flag = false;
            }
            return(flag);
        }
コード例 #16
0
        public FiddlerPlugin()
        {
            try
            {
                Version installedVer = new Version(0, 0, 0, 0);
                Version currentVer;
                string  updateFileHash, updateFileUrl;

                // try loading the Castle url
                var diagnosticsCastleUrl = ExtractDiagnosticsCastleUrl();
                if (diagnosticsCastleUrl == null)
                {
                    return;
                }
                var req = WebRequest.Create(diagnosticsCastleUrl + "/about-bishop");
                req.Timeout = DefaultRequestTimeoutInMilliseconds;
                using (var s = new StreamReader(req.GetResponse().GetResponseStream()))
                {
                    var updateInfo = s.ReadToEnd().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    if (updateInfo.Length != 3)
                    {
                        return;
                    }
                    currentVer     = new Version(updateInfo[0]);
                    updateFileHash = updateInfo[1];
                    updateFileUrl  = updateInfo[2];
                }

                var fiddlerUserPath = CONFIG.GetPath("AutoFiddlers_User");
                var asmpath         = Path.Combine(fiddlerUserPath, BishopDllName);
                if (File.Exists(asmpath))
                {
                    installedVer = AssemblyName.GetAssemblyName(asmpath).Version;
                }

                if (currentVer > installedVer)
                {
                    if (MessageBox.Show(string.Format("New Bishop version available: {0}. Update?", currentVer), "Bishop update",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        var tempPath = Path.Combine(Path.GetTempPath(), "Bishop.zip");
                        using (var wc = new WebClient())
                        {
                            wc.DownloadFile(updateFileUrl, tempPath);
                            if (!IsFileUnaltered(tempPath, updateFileHash))
                            {
                                File.Delete(tempPath);
                                throw new InvalidOperationException(
                                          "There was a problem in the update download - the hash does not match.");
                            }
                        }
                        FileUtils.ExtractZipToDirectoryAndOverrideExistingFiles(tempPath, fiddlerUserPath);
                        File.Delete(tempPath);
                    }
                }
            }
            catch (Exception ex)
            {
                // this is cruel but what can we do? :)
                Trace.Write("Error when trying to check the update version", "Exception: " + ex);
            }
        }