码迷,mamicode.com
首页 > 数据库 > 详细

Log Sessions to Local Database

时间:2017-06-05 16:49:42      阅读:361      评论:0      收藏:0      [点我收藏+]

标签:text   32bit   ndt   4.0   mod   doc   values   value   database   

  1. 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();
      }
    }
    }
  2. 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:

Log Sessions to Local Database

标签:text   32bit   ndt   4.0   mod   doc   values   value   database   

原文地址:http://www.cnblogs.com/hushaojun/p/6945467.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!