Exemple #1
0
        public void add_data(SnifferData snifferData)
        {
            byte[] payload = Sniffer.get_data_from_snifferdata(snifferData);
            //string blabla = Encoding.ASCII.GetString(payload);
            string blabla = Encoding.UTF8.GetString(payload);

            blabla = Regex.Replace(blabla, @"[^\u0000-\u007F]+", ".");
            conversation.Add(new Tuple <string, bool>(blabla, direction(snifferData)));
        }
 public InterfacesForm()
 {
     InitializeComponent();
     interfaces = Sniffer.get_interfaces();
     foreach (string if_name in interfaces)
     {
         interfaceList.Items.Add(if_name);
         Sniffer.sniffer_set_inteface(if_name);
     }
 }
        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();
        }
Exemple #4
0
        public static List <string> get_interfaces()
        {
            var intefaces = new List <string>();

            var p_if_name = new IntPtr();

            Sniffer.sniffer_get_inteface(ref p_if_name);
            while (p_if_name != IntPtr.Zero)
            {
                intefaces.Add(Marshal.PtrToStringAnsi(p_if_name));
                Sniffer.sniffer_get_inteface(ref p_if_name);
            }
            return(intefaces);
        }
Exemple #5
0
        static void Main()
        {
            try
            {
                Sniffer.sniffer_init();


                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new InterfacesForm());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }