基本信息
源码名称:基于SharpPcap数据包捕获工具开发
源码大小:0.34M
文件格式:.zip
开发语言:C#
更新时间:2017-11-21
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

运行于windows平台,使用图形图像界面进行交互,界面风格良好,操作简单快捷。本软件依靠SharpPcap插件,这个是一个.NET 环境下的网络包捕获框架,基于著名的 pcap/WinPcap 库开发。

private void loadDevice()
        {
            try
            {
                // 获取网卡方法
                foreach (var i in CaptureDeviceList.Instance)
                {
                    comDeviceList.Items.Add(i.Description);  //在combox中添加
                }

                if (comDeviceList.Items.Count > 0)
                {
                    comDeviceList.SelectedIndex = 0;//自动选中第一个
                }
                else
                {
                    MessageBox.Show("没有发现网卡!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
        }
        //选择网卡
        private void comDeviceList_SelectedIndexChanged(object sender, EventArgs e)
        {
            device = CaptureDeviceList.Instance[comDeviceList.SelectedIndex];
        }
/// <summary>
        /// 启动网卡
        /// </summary>
        private void Start()
        {
            if (device == null || device.Started)
                return;

            bufferList = new List<RawCapture>();
            Clear();//清理原有的数据
            isStartAnalyzer = true;


            StartAnalyzer();//启动分析线程


            try
            {
                device.OnPacketArrival = new PacketArrivalEventHandler(device_OnPacketArrival);
                //默认使用混杂模式,超时 1000
                device.Open(devMode, readTimeOut);
                device.Filter = comFilter.Text;
                /*****zhaoym*******/
                //string filter = "ip and tcp";
                //device.Filter = filter;
                /*****zhaoym*******/

                device.StartCapture();

                UIConfig(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

                UIConfig(false);
            }

        }