예제 #1
0
        private void FillStationList()
        {
            StationList.Items.Clear();
            Station[] stations = CapManager.GetStations(CapFiles.ToArray());

            if (cbProbeFilter.Checked)
            {
                List <Station> TempStations = new List <Station>();

                foreach (Station station in stations)
                {
                    foreach (ProbePacket probe in station.Probes)
                    {
                        if (!String.IsNullOrEmpty(probe.SSID) && probe.SSID.ToLower().Contains(txtProbeFilter.Text.ToLower()))
                        {
                            TempStations.Add(station);
                            break;
                        }
                    }
                }
                stations = TempStations.ToArray();
            }

            if (cbOnlyKnownDevice.Checked)
            {
                List <Station> TempStations = new List <Station>();

                foreach (Station station in stations)
                {
                    if (station.DeviceTypeStr.Length > 0)
                    {
                        TempStations.Add(station);
                    }
                }
                stations = TempStations.ToArray();
            }

            if (cbStationContainsHTTP.Checked)
            {
                List <Station> TempStations = new List <Station>();

                foreach (Station station in stations)
                {
                    foreach (WiFiSpy.src.Packets.DataFrame frame in station.DataFrames)
                    {
                        if ((frame.isIPv4 && (frame.isTCP || frame.isUDP)) && frame.PortDest == 80 || frame.PortSource == 80)
                        {
                            TempStations.Add(station);
                            break;
                        }
                    }
                }
                stations = TempStations.ToArray();
            }

            List <ListViewItem> ListItems = new List <ListViewItem>();

            foreach (Station station in stations)
            {
                string   IPs         = "";
                string[] IpAddresses = station.LocalIpAddresses;

                for (int i = 0; i < IpAddresses.Length; i++)
                {
                    IPs += IpAddresses[i];

                    if (i + 1 < IpAddresses.Length)
                    {
                        IPs += ", ";
                    }
                }

                ListViewItem item = new ListViewItem(new string[]
                {
                    station.SourceMacAddressStr,
                    station.Manufacturer,
                    station.Probes.Count().ToString(),
                    station.DataFrames.Count().ToString(),
                    station.ProbeNames,
                    station.DeviceTypeStr,
                    station.DeviceVersion,
                    station.LastSeenDate.ToString(DateTimeFormat),
                    IPs
                });
                item.Tag = station;
                //StationList.Items.Add(item);
                ListItems.Add(item);
            }
            StationList.Items.AddRange(ListItems.OrderByDescending(o => (o.Tag as Station).LastSeenDate).ToArray());
        }
예제 #2
0
        private void FillStationWeekOverview()
        {
            WeekStationOverviewChart.Titles.Clear();
            WeekStationOverviewChart.Series.Clear();

            DateTime WeekStartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            WeekStartDate = WeekStartDate.AddDays(DayOfWeek.Monday - WeekStartDate.DayOfWeek);

            SortedList <string, int> DeviceList      = new SortedList <string, int>();
            SortedList <string, int> DeviceListCount = new SortedList <string, int>();

            Series UniqueStationsSerie = WeekStationOverviewChart.Series.Add("Unique Stations");

            UniqueStationsSerie.LegendText = "Unique Stations";

            foreach (Station station in CapManager.GetStations(CapFiles.ToArray()))
            {
                if (station.DeviceTypeStr.Length > 0)
                {
                    if (!DeviceList.ContainsKey(station.DeviceTypeStr))
                    {
                        Series TempSerie = WeekStationOverviewChart.Series.Add(station.DeviceTypeStr);
                        TempSerie.LegendText = station.DeviceTypeStr;

                        DeviceList.Add(station.DeviceTypeStr, 0);
                        DeviceListCount.Add(station.DeviceTypeStr, 0);
                    }
                }
            }

            int TotalStationCount = 0;
            SortedList <DayOfWeek, List <string> > StationMacs = new SortedList <DayOfWeek, List <string> >();

            StationMacs.Add(DayOfWeek.Monday, new List <string>());
            StationMacs.Add(DayOfWeek.Tuesday, new List <string>());
            StationMacs.Add(DayOfWeek.Wednesday, new List <string>());
            StationMacs.Add(DayOfWeek.Thursday, new List <string>());
            StationMacs.Add(DayOfWeek.Friday, new List <string>());
            StationMacs.Add(DayOfWeek.Saturday, new List <string>());
            StationMacs.Add(DayOfWeek.Sunday, new List <string>());

            for (int i = 0; i < StationMacs.Count; i++)
            {
                foreach (CapFile capFile in CapFiles)
                {
                    foreach (Station station in capFile.Stations.Where(o => WeekStartDate.Year == o.TimeStamp.Year &&
                                                                       WeekStartDate.Month == o.TimeStamp.Month &&
                                                                       WeekStartDate.Day == o.TimeStamp.Day))
                    {
                        if (!String.IsNullOrEmpty(station.SourceMacAddressStr))
                        {
                            if (!StationMacs.Values[i].Contains(station.SourceMacAddressStr))
                            {
                                if (DeviceList.ContainsKey(station.DeviceTypeStr))
                                {
                                    DeviceList[station.DeviceTypeStr]++;
                                    DeviceListCount[station.DeviceTypeStr]++;
                                }

                                StationMacs.Values[i].Add(station.SourceMacAddressStr);
                                TotalStationCount++;
                            }
                        }
                    }
                }
                UniqueStationsSerie.Points.AddXY(StationMacs.Keys[i].ToString(), StationMacs.Values[i].Count);

                for (int j = 0; j < DeviceList.Count; j++)
                {
                    WeekStationOverviewChart.Series[DeviceList.Keys[j]].Points.AddXY(DeviceList.Keys[j], DeviceList.Values[j]);
                    DeviceList[DeviceList.Keys[j]] = 0;
                }

                WeekStartDate = WeekStartDate.AddDays(1);
            }

            UniqueStationsSerie.LegendText += " (" + TotalStationCount + ")";
            StationWeekOverviewBox.Text     = "Stations week overview (" + WeekStartDate.ToShortDateString() + " - " + WeekStartDate.AddDays(7).ToShortDateString() + ")";

            for (int i = 0; i < DeviceListCount.Count; i++)
            {
                WeekStationOverviewChart.Series[DeviceListCount.Keys[i]].LegendText += " (" + DeviceListCount.Values[i] + ")";
            }
        }
예제 #3
0
        private void FillExtenderList()
        {
            LvRepeaterNames.Items.Clear();
            LvRepeaterList.Items.Clear();

            SortedList <string, List <AccessPoint> > repeaters = CapManager.GetPossibleExtenders(CapFiles.ToArray());

            for (int i = 0; i < repeaters.Count; i++)
            {
                ListViewItem item = new ListViewItem(new string[]
                {
                    repeaters.Keys[i],
                    repeaters.Values[i].Count.ToString()
                });
                item.Tag = repeaters.Values[i];
                LvRepeaterNames.Items.Add(item);
            }
        }