fiddlercore 抓包获取cookie的方法
Posted 雪原日暮
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了fiddlercore 抓包获取cookie的方法相关的知识,希望对你有一定的参考价值。
public partial class form1 : Form { public form1() { string cookies = ""; InitializeComponent(); #region AttachEventListeners Fiddler.FiddlerApplication.OnNotification += delegate (object sender, NotificationEventArgs oNEA) { Console.WriteLine("** NotifyUser: " + oNEA.NotifyString); }; Fiddler.FiddlerApplication.Log.OnLogString += delegate (object sender, LogEventArgs oLEA) { Console.WriteLine("** LogString: " + oLEA.LogString); }; Fiddler.FiddlerApplication.BeforeRequest += delegate (Fiddler.Session oS) { //Console.WriteLine("Before request for:\t" + oS.fullUrl); }; Fiddler.FiddlerApplication.BeforeResponse += delegate (Fiddler.Session oS) { if (oS.fullUrl.Contains("survey/upload.do")&& !oS.fullUrl.Contains("?key=AvImageUpload")) { cookies = oS.RequestHeaders["Cookie"]; if (InvokeRequired) { this.Invoke(new MethodInvoker(delegate { textBox1.Text = cookies; })); return; } // Console.WriteLine(oS.fullUrl); //oS.utilDecodeResponse(); //oS.SaveResponseBody(Environment.CurrentDirectory + "\\Captcha.jpg"); } }; Fiddler.FiddlerApplication.AfterSessionComplete += delegate (Fiddler.Session oS) { //Console.WriteLine("Finished session:\t" + oS.fullUrl); }; Console.CancelKeyPress += new ConsoleCancelEventHandler(btn_Close_Click); #endregion AttachEventListeners // Console.WriteLine("Starting FiddlerCore..."); Fiddler.FiddlerApplication.Startup(8877, true, true); //Console.WriteLine("Hit CTRL+C to end session."); Object forever = new Object(); } private void btn_Copy_Click(object sender, EventArgs e) { textBox1.Focus(); textBox1.SelectAll(); if (textBox1.SelectedText != "") Clipboard.SetDataObject(textBox1.SelectedText); MessageBox.Show("复制成功!"); } private void btn_Close_Click(object sender, EventArgs e) { Fiddler.FiddlerApplication.Shutdown(); System.Threading.Thread.Sleep(750); this.Close(); } }
需要添加fiddlercore 的dll引用
以上是关于fiddlercore 抓包获取cookie的方法的主要内容,如果未能解决你的问题,请参考以下文章