Beispiel #1
0
        public MainPage()
        {
            this.InitializeComponent();

            var nics = NetworkInterface.GetAllNetworkInterfaces();

            foreach (var nic in nics)
            {
                NetworkInterfaceViewModels.Add(new NetworkInterfaceViewModel
                {
                    Id               = nic.Id,
                    MacAddress       = nic.GetPhysicalAddress().ToString(),
                    Name             = nic.Name,
                    NetworkInterface = nic
                });
            }

            var view = ApplicationView.GetForCurrentView();

            view.Consolidated += View_Consolidated;

            _filter = new ShadowFilter(App.RandomAppIdGenerator.Next(), "ShadowDriver Demo");
            _filter.StartFilterWatcher();
            _filter.FilterReady    += Filter_FilterReady;
            _filter.PacketReceived += Filter_PacketReceived;

            _dispatcherTimer = new DispatcherTimer()
            {
                Interval = new TimeSpan(0, 0, 3)
            };
            _dispatcherTimer.Tick += DispatcherTimer_Tick;

            System.Diagnostics.Debug.WriteLine(string.Format("Filter {0} loaded.", _filter.AppId));
        }
        public WelcomePage()
        {
            this.InitializeComponent();

            var nics = NetworkInterface.GetAllNetworkInterfaces();

            foreach (var nic in nics)
            {
                NetworkInterfaceViewModels.Add(new NetworkInterfaceViewModel
                {
                    Id               = nic.GetIPProperties().GetIPv4Properties().Index,
                    MacAddress       = nic.GetPhysicalAddress().ToString(),
                    Name             = nic.Name,
                    NetworkInterface = nic
                });
            }
        }
Beispiel #3
0
        public MainWindow()
        {
            this.InitializeComponent();

            var nics = NetworkInterface.GetAllNetworkInterfaces();

            foreach (var nic in nics)
            {
                NetworkInterfaceViewModels.Add(new NetworkInterfaceViewModel
                {
                    Id               = nic.Id,
                    MacAddress       = nic.GetPhysicalAddress().ToString(),
                    Name             = nic.Name,
                    NetworkInterface = nic
                });
            }

            _filter              = new ShadowFilter(App.RandomAppIdGenerator.Next(), "ShadowDriverWPFDemo");
            _filter.FilterReady += Filter_FilterReady;
            _filter.StartFilterWatcher();

            _filter.PacketReceived += Filter_PacketReceived;

            _dispatcherTimer = new DispatcherTimer()
            {
                Interval = new TimeSpan(0, 0, 3)
            };
            _dispatcherTimer.Tick += DispatcherTimer_Tick;

            MacAddressBox.ItemsSource = NetworkInterfaceViewModels;
            LayerBox.ItemsSource      = Layers;
            PacketsView.ItemsSource   = NetPacketViewModels;
            DirectionBox.ItemsSource  = Directions;
            MatchTypeBox.ItemsSource  = MatchTypes;
            LocationBox.ItemsSource   = Locations;
            System.Diagnostics.Debug.WriteLine(string.Format("Filter {0} loaded.", _filter.AppId));
        }