Exemplo n.º 1
0
        private void sniffer_loop()
        {
            Sniffer.sniffer_set_inteface(if_name);
            var data   = new SnifferData();
            var result = 5;
            int packet = 0;

            while (true)
            {
                if (sniffer_running)
                {
                    result = Sniffer.sniffer_get(data);
                    if (result != 5)
                    {
                        packet++;
                        AddUpdatePacketNumber(packet);
                    }
                    if (result == 0)
                    {
                        add_connection(data);
                        //AddText("\n" + blabla + "\n");
                    }
                }
                else
                {
                    Thread.Sleep(10);
                }
            }
        }
Exemplo n.º 2
0
 public InterfacesForm()
 {
     InitializeComponent();
     interfaces = Sniffer.get_interfaces();
     foreach (string if_name in interfaces)
     {
         interfaceList.Items.Add(if_name);
         Sniffer.sniffer_set_inteface(if_name);
     }
 }
Exemplo n.º 3
0
        public SnifferForm(object sniffer_interface)
        {
            if_name         = sniffer_interface.ToString();
            sniffer         = new Task(sniffer_loop);
            connections     = new List <Connection>();
            sniffer_running = true;
            sniffer.Start();
            var ret_value = Sniffer.sniffer_set_inteface(sniffer_interface.ToString());

            InitializeComponent();
        }