Exemplo n.º 1
0
        public FrmMain()
        {
            InitializeComponent();
            rtbConsole.BackColor = Color.White;

            // Setup all wireshark files
            WiresharkFiles.Add(null);
            WiresharkFiles.Add(null);
            WiresharkFiles.Add(null);
            WiresharkFiles.Add(null);
            WiresharkFiles.Add(null);
            WiresharkFiles.Add(null);

            // Setup textboxes
            TBFiles.Add(tbFile1);
            TBFiles.Add(tbFile2);
            TBFiles.Add(tbFile3);
            TBFiles.Add(tbFile4);
            TBFiles.Add(tbFile5);
            TBFiles.Add(tbFile6);

            TBPacketCounts.Add(tbPacketCount1);
            TBPacketCounts.Add(tbPacketCount2);
            TBPacketCounts.Add(tbPacketCount3);
            TBPacketCounts.Add(tbPacketCount4);
            TBPacketCounts.Add(tbPacketCount5);
            TBPacketCounts.Add(tbPacketCount6);

            // Setup checkboxes
            CKBRuns.Add(ckbNext1);
            CKBRuns.Add(ckbNext2);
            CKBRuns.Add(ckbNext3);
            CKBRuns.Add(ckbNext4);
            CKBRuns.Add(ckbNext5);
            CKBRuns.Add(ckbNext6);

            // Get Network Adapters
            WiresharkFile.UpdateNetworkAdapters();
            WiresharkFile.ConsoleText = rtbConsole;

            // Fill drop down with network adapters
            cbNetworkAdapters.Items.Clear();
            foreach (LivePacketDevice device in WiresharkFile.NetworkAdapters)
            {
                foreach (DeviceAddress address in device.Addresses)
                {
                    if (address.Address.ToString().Contains("Internet6"))
                    {
                        continue;
                    }
                    cbNetworkAdapters.Items.Add(address.Address.ToString());
                }
            }

            if (cbNetworkAdapters.Items.Count > 0)
            {
                cbNetworkAdapters.SelectedIndex = 0;
                WiresharkFile.SetSelectedNetworkAdapter(cbNetworkAdapters.Items[cbNetworkAdapters.SelectedIndex].ToString());
            }

            // Load previous config if possible
            if (!string.IsNullOrEmpty(Properties.Settings.Default.CurrentConfigFile))
            {
                LoadConfig(Properties.Settings.Default.CurrentConfigFile);
            }
        }
Exemplo n.º 2
0
 private void cbNetworkAdapters_SelectedIndexChanged(object sender, EventArgs e)
 {
     WiresharkFile.SetSelectedNetworkAdapter(cbNetworkAdapters.Items[cbNetworkAdapters.SelectedIndex].ToString());
 }