Exemplo n.º 1
0
        private static void OnExportSessions(object sender, EventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog
            {
                Filter       = "HTTPArchive (*.har)|*.har",
                DefaultExt   = "har",
                AddExtension = true
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Logger.WriteLine("Exporting Sessions...");

                Session[] sessions = Proxy.GetSessions();
                FiddlerApplication.oTranscoders.ImportTranscoders(Assembly.Load("BasicFormatsForCore"));

                var options = new Dictionary <string, object>
                {
                    { "Filename", dialog.FileName },
                    { "MaxTextBodyLength", 10 * 1024 * 1024 },
                    { "MaxBinaryBodyLength", 10 * 1024 * 1024 }
                };
                FiddlerApplication.DoExport("HTTPArchive v1.2", sessions, options, null);

                MessageBox.Show("Session export successful.", "Session export", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 2
0
        public void SaveSessionsToFile()
        {
            bool   bSuccess  = false;
            string sFilename = GetSazFilePath();

            try
            {
                try
                {
                    Monitor.Enter(oAllSessions);
                    TranscoderTuple oExporter = FiddlerApplication.oTranscoders.GetExporter("SAZ");

                    if (null != oExporter)
                    {
                        var dictOptions = new Dictionary <string, object>();
                        dictOptions.Add("Filename", sFilename);
                        bSuccess = FiddlerApplication.DoExport("SAZ", oAllSessions.ToArray(), dictOptions, null);
                    }
                    else
                    {
                        WriteCommandResponse("Save failed because the SAZ Format Exporter was not available.");
                    }
                }
                finally
                {
                    Monitor.Exit(oAllSessions);
                }

                WriteCommandResponse(bSuccess ? ("Wrote: " + sFilename) : ("Failed to save: " + sFilename));
            }
            catch (Exception eX)
            {
                WriteCommandResponse("Save failed: " + eX.Message);
            }
        }
Exemplo n.º 3
0
        private static void SaveSessionsToDesktop(List <Fiddler.Session> oAllSessions)
        {
            bool   bSuccess  = false;
            string sFilename = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
                               + @"\" + DateTime.Now.ToString("hh-mm-ss") + ".saz";

            try
            {
                try
                {
                    Monitor.Enter(oAllSessions);
                    TranscoderTuple oExporter = FiddlerApplication.oTranscoders.GetExporter("SAZ");

                    if (null != oExporter)
                    {
                        Dictionary <string, object> dictOptions = new Dictionary <string, object>();
                        dictOptions.Add("Filename", sFilename);
                        // dictOptions.Add("Password", "pencil");

                        bSuccess = FiddlerApplication.DoExport("SAZ", oAllSessions.ToArray(), dictOptions, null);
                    }
                }
                finally
                {
                    Monitor.Exit(oAllSessions);
                }

                WriteCommandResponse(bSuccess ? ("Wrote: " + sFilename) : ("Failed to save: " + sFilename));
            }
            catch (Exception eX)
            {
                Console.WriteLine("Save failed: " + eX.Message);
            }
        }
Exemplo n.º 4
0
        private void SaveSessionsToDumpFolder(List <Fiddler.Session> Sessions, bool FullSession = false)
        {
            bool bSuccess = false;


            if (!Directory.Exists("proxydumps"))
            {
                try
                {
                    Directory.CreateDirectory("proxydumps");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("[ERROR] ExportSessions: " + ex.ToString());
                }
            }

            string sFilename = @"proxydumps\" + DateTime.Now.ToString("hh-mm-ss-fff") + "_dump_SPLIT.saz";

            if (FullSession)
            {
                sFilename = @"proxydumps\" + DateTime.Now.ToString("hh-mm-ss-fff") + "_dump_FULL.saz";
            }
            try
            {
                try
                {
                    Monitor.Enter(Sessions);
                    TranscoderTuple oExporter = FiddlerApplication.oTranscoders.GetExporter("SAZ");

                    if (null != oExporter)
                    {
                        Dictionary <string, object> dictOptions = new Dictionary <string, object>();
                        dictOptions.Add("Filename", sFilename);
                        // dictOptions.Add("Password", "pencil");

                        bSuccess = FiddlerApplication.DoExport("SAZ", Sessions.ToArray(), dictOptions, null);
                    }
                    else
                    {
                        Console.WriteLine("Save failed because the SAZ Format Exporter was not available.");
                    }
                }
                finally
                {
                    Monitor.Exit(Sessions);
                }

                WriteCommandResponse(bSuccess ? ("Wrote: " + sFilename) : ("Failed to save: " + sFilename));
            }
            catch (Exception eX)
            {
                Console.WriteLine("Save failed: " + eX.Message);
            }
        }
Exemplo n.º 5
0
        public void SaveSessionsToDesktop()
        {
            bool   bSuccess  = false;
            string sFilename = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
                               + Path.DirectorySeparatorChar + DateTime.Now.ToString("hh-mm-ss") + ".saz";

            try
            {
                try
                {
                    Monitor.Enter(oAllSessions);
                    TranscoderTuple oExporter = FiddlerApplication.oTranscoders.GetExporter("SAZ");

                    if (null != oExporter)
                    {
                        var dictOptions = new Dictionary <string, object>();
                        dictOptions.Add("Filename", sFilename);
                        // dictOptions.Add("Password", "pencil");

                        bSuccess = FiddlerApplication.DoExport("SAZ", oAllSessions.ToArray(), dictOptions, null);
                    }
                    else
                    {
                        WriteCommandResponse("Save failed because the SAZ Format Exporter was not available.");
                    }
                }
                finally
                {
                    Monitor.Exit(oAllSessions);
                }

                WriteCommandResponse(bSuccess ? ("Wrote: " + sFilename) : ("Failed to save: " + sFilename));
            }
            catch (Exception eX)
            {
                WriteCommandResponse("Save failed: " + eX.Message);
            }
        }