首页 > 代码库 > Log Sessions to Local Database
Log Sessions to Local Database
-
Add Rules to Fiddler to create a new menu item as follows:
// Log the currently selected sessions in the list to a database. // Note: The DB must already exist and you must have permissions to write to it. public static ToolsAction("Log Selected Sessions") function DoLogSessions(oSessions: Fiddler.Session[]){ if (null == oSessions || oSessions.Length < 1){ MessageBox.Show("Please select some sessions first!"); return; } var strMDB = "C:\\log.mdb"; var cnn = null; var sdr = null; var cmd = null; try { cnn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strMDB); cnn.Open(); cmd = new OleDbCommand(); cmd.Connection = cnn; for (var x = 0; x < oSessions.Length; x++){ var strSQL = "INSERT into tblSessions ([ResponseCode],[URL]) Values (" + oSessions[x].responseCode + ", ‘" + oSessions[x].url + "‘)"; cmd.CommandText = strSQL; cmd.ExecuteNonQuery(); } } catch (ex){ MessageBox.Show(ex); } finally { if (cnn != null ){ cnn.Close(); } } }
-
List the new import at the top of your rules script as follows:
import System.Data.OleDb;
-
Note: This example relies upon OLEDB 4.0 which is not available for 64bit processes. Either:
- Select another data provider (for example, SQLServer); or
- Force Fiddler to run in 32bit mode
Log Sessions to Local Database
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。