예제 #1
0
        private void LoadNetWork()
        {
            //System.Int32 dwFlag = new Int32();
            Wlan.WlanAvailableNetwork[] networks = WlanIface.GetAvailableNetworkList(0);
            foreach (Wlan.WlanAvailableNetwork network in networks)
            {
                string SSID = WlanHelper.GetStringForSSID(network.dot11Ssid);
                if (network.flags.HasFlag(Wlan.WlanAvailableNetworkFlags.Connected))
                {
                    label2.Text = SSID;
                }
                //如果有配置文件的SSID会重复出现。过滤掉
                if (!listBox1.Items.Contains(SSID))
                {
                    listBox1.Items.Add(SSID);
                    NetWorkList.Add(network);
                }
            }

            //信号强度排序
            NetWorkList.Sort(delegate(Wlan.WlanAvailableNetwork a, Wlan.WlanAvailableNetwork b)
            {
                return(b.wlanSignalQuality.CompareTo(a.wlanSignalQuality));
            });
            listBox1.Items.Clear();
            foreach (Wlan.WlanAvailableNetwork network in NetWorkList)
            {
                listBox1.Items.Add(WlanHelper.GetStringForSSID(network.dot11Ssid));
            }
        }
예제 #2
0
        private void Tick(object sender, System.EventArgs e)
        {
            this.CurrentTime.Text = DateTime.Now.ToLocalTime().ToString();

            Wlan.WlanAvailableNetwork[] networks = WlanIface.GetAvailableNetworkList(0);
            foreach (Wlan.WlanAvailableNetwork network in networks)
            {
                string SSID = WlanHelper.GetStringForSSID(network.dot11Ssid);
                if (!SSID.Contains("?") && SSID.Length > 0)
                {
                    if (network.flags.HasFlag(Wlan.WlanAvailableNetworkFlags.Connected))
                    {
                        this.CurrentWifi.Text = SSID;
                    }
                    //如果有配置文件的SSID会重复出现。过滤掉
                    if (!WifiList.Items.Contains(SSID))
                    {
                        WifiList.Items.Add(SSID);
                        NetWorkList.Add(network);
                    }
                }
            }

            checkConnection();
        }
예제 #3
0
        static void CrackWiFiList()
        {
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("\r\nUnsecured networks & profiles will not be shown");
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Available networks:");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.Write("Scanning");
            Interface.Scan();

            Thread.Sleep(500);
            Console.Write(".");
            Thread.Sleep(500);
            Console.Write(".");
            Thread.Sleep(500);
            Console.Write(".");
            Thread.Sleep(500);
            Console.SetCursorPosition(0, Console.CursorTop);
            Console.Write("                 ");
            Console.SetCursorPosition(0, Console.CursorTop);

            AvNetwork = Interface.GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags.IncludeAllManualHiddenProfiles);
            for (int i = 0; i < AvNetwork.Length; i++)
            {
                var network = AvNetwork[i];

                if (network.profileName.Length <= 0 && network.securityEnabled)
                {
                    Console.ForegroundColor = ConsoleColor.Gray;
                    Console.Write("[" + i);

                    Console.ForegroundColor = ConsoleColor.Gray;
                    Console.Write("] ");


                    // if (network.profileName.Length >= 1) { Console.ForegroundColor = ConsoleColor.DarkRed; Console.Write("saved "); }
                    //else { Console.ForegroundColor = ConsoleColor.DarkGreen;                               Console.Write("new   "); }


                    Console.ForegroundColor = ConsoleColor.White;
                    Console.Write(GetStringForSSID(network.dot11Ssid));

                    //if (network.securityEnabled) { Console.ForegroundColor = ConsoleColor.DarkGreen; Console.Write(" secured "); }
                    //else { Console.ForegroundColor = ConsoleColor.DarkRed; Console.Write(" unsecured "); }
                    Console.ForegroundColor = ConsoleColor.DarkGray;
                    Console.Write(" " + network.dot11DefaultCipherAlgorithm.ToString() + " " + network.dot11DefaultAuthAlgorithm.ToString() + " ");
                    Console.Write("signal: " + network.wlanSignalQuality);
                    Console.WriteLine();
                }
            }
            Console.ForegroundColor = ConsoleColor.Gray;
            // WlanAvailableNetwork a = new NativeWifi.Wlan.WlanAvailableNetwork();
            //Console.WriteLine(a.profileName);
        }
예제 #4
0
 public IEnumerable <Wlan.WlanAvailableNetwork> GetAvailableNetworkList()
 {
     try
     {
         return(interFace.GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags.IncludeAllAdhocProfiles).Where(x => x.flags != 0));
     }
     catch
     {
         return(new List <Wlan.WlanAvailableNetwork>());
     }
 }
예제 #5
0
        private void LoadNetWork()
        {
            Wlan.WlanAvailableNetwork[] networks = WlanIface.GetAvailableNetworkList(0);
            foreach (Wlan.WlanAvailableNetwork network in networks)
            {
                string SSID = WlanHelper.GetStringForSSID(network.dot11Ssid);

                //只有存在Giwifi才会存储
                if (SSID.Equals(wifiname) && !network.flags.HasFlag(Wlan.WlanAvailableNetworkFlags.Connected)) // 刚才想的是能不能直接构造一个放进List
                {
                    NetWorkList.Add(network);                                                                  // 如果giwifi的信息不一样怎么办?那么根据名字查找总比按照固定参数找要好,因此暂时不动这个方法。
                }
            }
        }
예제 #6
0
        public void Arcquire()
        {
            Profiles.Clear();

            WlanClient client = new WlanClient();

            // Lists all networks with WEP security
            Wlan.WlanAvailableNetwork[] networks = iFace.GetAvailableNetworkList(0);

            var x = new System.Xml.Serialization.XmlSerializer(typeof(WLANProfile));

            // Retrieves XML configurations of existing profiles.
            // This can assist you in constructing your own XML configuration
            foreach (Wlan.WlanProfileInfo profileInfo in iFace.GetProfiles())
            {
                string name = profileInfo.profileName; // this is typically the network's SSID

                string xml = iFace.GetProfileXml(name);

                using (TextReader reader = new StringReader(xml))
                {
                    var prov = x.Deserialize(reader) as WLANProfile;
                    Profiles.Add(new FiProfile(prov));
                }
            }

            foreach (var net in networks)
            {
                var ssid = net.dot11Ssid.ToStringBeauty();
                if (string.IsNullOrEmpty(ssid))
                {
                    continue;
                }
                var prof = Profiles.Where((p) => p.SSID == ssid).FirstOrDefault();
                if (prof != null)
                {
                    prof.SetAvailability(net);
                }
                else
                {
                    prof = new FiProfile(null);
                    prof.SetAvailability(net);
                    Profiles.Add(prof);
                }
            }

            Profiles.Sort(new FiProfileSorter());
        }
예제 #7
0
 public static void WlanNotification(Wlan.WlanNotificationData notifyData)
 {
     switch ((Wlan.WlanNotificationCodeAcm)notifyData.NotificationCode)
     {
     case Wlan.WlanNotificationCodeAcm.ScanComplete:
         foreach (Wlan.WlanAvailableNetwork net in wlan_intr.GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags.IncludeAllAdhocProfiles))
         {
             if (GetSsidString(net.dot11Ssid) == settings["card_ssid"])
             {
                 wlan_client.Interfaces[0].Connect(Wlan.WlanConnectionMode.Auto, Wlan.Dot11BssType.Any, net.dot11Ssid, Wlan.WlanConnectionFlags.HiddenNetwork);
                 break;
             }
         }
         break;
     }
 }
예제 #8
0
        private List <Object> GetAvailableNetworkList1()
        {
            WlanClient wlanClient = null;

            WlanClient.WlanInterface wlanInterface = null;
            List <Object>            wlanList      = null;

            try
            {
                wlanClient = new WlanClient();
            }
            catch (Exception exception)
            {
                Wlan.WlanCloseHandle(clientHandle, IntPtr.Zero);
                LogHelper.Log(new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name, exception.Message);
                LogHelper.Error(exception);
                MessageBox.Show(exception.Message, "信息", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }

            if (wlanClient != null && wlanClient.Interfaces.Length != 0)
            {
                wlanList      = new List <object>();
                wlanInterface = wlanClient.Interfaces[0];
                WlanClient.WlanInterface    wlanInterfaceTmp  = wlanClient.Interfaces[0];
                Wlan.WlanAvailableNetwork[] availableNetworks = wlanInterfaceTmp.GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags.IncludeAllAdhocProfiles);
                wlanAvailableNetworks = availableNetworks;

                int index = 1;
                foreach (Wlan.WlanAvailableNetwork wlanAvailableNetworkTmp in availableNetworks)
                {
                    bool isConnected = Wlan.WlanAvailableNetworkFlags.Connected.ToString() == wlanAvailableNetworkTmp.flags.ToString().Split(',')[0] && wlanAvailableNetworkTmp.networkConnectable;
                    wlanList.Add(new
                    {
                        IndexID         = index,
                        NetworkName     = GetStringForSSID(wlanAvailableNetworkTmp.dot11Ssid),
                        SignalQuality   = wlanAvailableNetworkTmp.wlanSignalQuality.ToString() + "%",
                        SignalStrength  = StringHelper.ClassifySignalByStrength(Convert.ToInt32(wlanAvailableNetworkTmp.wlanSignalQuality)),
                        NetworkSecurity = wlanAvailableNetworkTmp.securityEnabled ? "安全" : "不安全",
                        NetworkFlag     = Convert.ToInt32(wlanAvailableNetworkTmp.flags),
                        Connectable     = wlanAvailableNetworkTmp.networkConnectable ? "可连接" : "不可访问",
                        ConnectState    = isConnected ? "已连接使用中" : "未连接",
                    });
                    index++;
                }
            }
            return(wlanList);
        }
        private NativeWifi.Wlan.WlanAvailableNetwork?SearchForArDroneNetworkUsingInterface(WlanClient.WlanInterface wlanInterface)
        {
            NativeWifi.Wlan.WlanAvailableNetwork[] networks = wlanInterface.GetAvailableNetworkList(
                Wlan.WlanGetAvailableNetworkFlags.IncludeAllAdhocProfiles |
                Wlan.WlanGetAvailableNetworkFlags.IncludeAllManualHiddenProfiles);
            foreach (NativeWifi.Wlan.WlanAvailableNetwork network in networks)
            {
                String ssid = ByteArrayToString(network.dot11Ssid.SSID);

                if (ssid.StartsWith(droneNetworkIdentifierStart))
                {
                    return(network);
                }
            }

            return(null);
        }
예제 #10
0
        private void OnWlanNotification(ref Wlan.WlanNotificationData notifyData, IntPtr context)
        {
            switch (notifyData.notificationSource)
            {
            case Wlan.WlanNotificationSource.ACM:
                switch ((Wlan.WlanNotificationCodeAcm)notifyData.notificationCode)
                {
                case Wlan.WlanNotificationCodeAcm.ConnectionComplete:
                    lock (sync)
                    {
                        if (isBinding)
                        {
                            Status("Connected successfully to Drone");
                            this.Invoke(telnetDelegate);
                        }
                        if (isRegistering)
                        {
                            Status("Connected successfully to Router");
                            Thread t1 = new Thread(RegisterDrone);
                            t1.Start();
                            //this.Invoke(registerDelegate);
                        }
                    }

                    break;

                case Wlan.WlanNotificationCodeAcm.ConnectionStart:
                    break;

                case Wlan.WlanNotificationCodeAcm.ConnectionAttemptFail:
                    Status("Connection failed");
                    break;

                case Wlan.WlanNotificationCodeAcm.Disconnected:
                    //Status("Disconnected");
                    break;

                case Wlan.WlanNotificationCodeAcm.ScanComplete:
                    networkList = networkInterface.GetAvailableNetworkList(0);
                    this.Invoke(outputScanDelegate);
                    break;
                }
                break;
            }
        }
        private Wlan.WlanAvailableNetwork?getChosenNetwork()
        {
            Debug.log("First connect");
            uint maxSignal = 0;

            Wlan.WlanAvailableNetwork?chosenNetwork = null;
            var profiles = m_Interface.GetProfiles();

            var networks = m_Interface.GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags.IncludeAllAdhocProfiles);

            foreach (var network in networks)
            {
                if (network.networkConnectable && network.wlanSignalQuality > maxSignal /* && profileExists(network.profileName, profiles)*/)
                {
                    maxSignal     = network.wlanSignalQuality;
                    chosenNetwork = network;
                }
            }

            return(chosenNetwork);
        }
예제 #12
0
        private void LoadNetWork()
        {
            Wlan.WlanAvailableNetwork[] networks = WlanIface.GetAvailableNetworkList(0);
            if (networks == null)
            {
                MessageBox.Show("WIFI服务未开启");
                return;
            }
            foreach (Wlan.WlanAvailableNetwork network in networks)
            {
                //过滤信号强度小于20的网络
                if (network.wlanSignalQuality < 20)
                {
                    continue;
                }
                string SSID = WlanHelper.GetStringForSSID(network.dot11Ssid);
                if (network.flags.HasFlag(Wlan.WlanAvailableNetworkFlags.Connected))
                {
                    labelControl2.Text      = SSID;
                    labelControl2.ForeColor = Color.RosyBrown;
                }
                //如果有配置文件的SSID会重复出现。过滤掉
                if (!myListBox1.Items.Contains(SSID))
                {
                    myListBox1.Items.Add(SSID);
                    NetWorkList.Add(network);
                }
            }

            //信号强度排序
            NetWorkList.Sort(delegate(Wlan.WlanAvailableNetwork a, Wlan.WlanAvailableNetwork b)
            {
                return(b.wlanSignalQuality.CompareTo(a.wlanSignalQuality));
            });
            myListBox1.Items.Clear();
            foreach (Wlan.WlanAvailableNetwork network in NetWorkList)
            {
                myListBox1.Items.Add(WlanHelper.GetStringForSSID(network.dot11Ssid));
            }
        }
예제 #13
0
        public static ObservableCollection <Wlan.WlanAvailableNetwork> FindNetworks()
        {
            WlanClient client   = new WlanClient();
            var        networks = new ObservableCollection <Wlan.WlanAvailableNetwork>();

            WlanClient.WlanInterface wlanIface = client.Interfaces[0]; //Получаем первый интерфейс, который связан с сетевой картой
            if (wlanIface.InterfaceState == Wlan.WlanInterfaceState.Connected)
            {
                throw new Exception("Интерфейс занят! Отключите все сети");
            }

            Wlan.WlanAvailableNetwork[] wlanBssEntries = wlanIface.GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags.IncludeAllAdhocProfiles);

            IEnumerable <Wlan.WlanAvailableNetwork> sortedNetworks = wlanBssEntries.OrderByDescending(s => s.wlanSignalQuality);

            foreach (Wlan.WlanAvailableNetwork network in sortedNetworks)
            {
                networks.Add(network);
            }

            return(networks);
        }
예제 #14
0
        void UpdateAPs()
        {
            try {
                av_nets = adapter.GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags.IncludeAllAdhocProfiles);
            } catch (Exception) {
                SetEnabled(false);
                return;
            }

            access_points = new AP[av_nets.Length];
            for (int c = 0; c < av_nets.Length; c++)
            {
                access_points[c] = new AP(av_nets[c].flags.HasFlag(Wlan.WlanAvailableNetworkFlags.Connected),
                                          Encoding.Default.GetString(av_nets[c].dot11Ssid.SSID).Remove((int)av_nets[c].dot11Ssid.SSIDLength),
                                          av_nets[c].profileName,
                                          av_nets[c].wlanSignalQuality.ToString(),
                                          av_nets[c].numberOfBssids.ToString());
            }
            dg_wifi.DataSource = access_points;
            SetEnabled(true);
            return;
        }
예제 #15
0
        public DataSets.WlanInfo getWlanInfo()
        {
            infoWlan.WLANS.Clear();
            lista_bss = INTERFAZ.GetNetworkBssList();
            INTERFAZ.Scan();
            lista_redes = INTERFAZ.GetAvailableNetworkList(0);
            Wlan.WlanAvailableNetwork WLAN = new Wlan.WlanAvailableNetwork();
            foreach (Wlan.WlanBssEntry redBSS in lista_bss)
            {
                DataSets.WlanInfo.WLANSRow row = infoWlan.WLANS.NewWLANSRow();

                WLAN         = devuelve_red(redBSS.dot11Ssid, lista_redes);
                row.ESSID    = Encoding.ASCII.GetString(redBSS.dot11Ssid.SSID, 0, (int)redBSS.dot11Ssid.SSIDLength);
                row.BSSID    = Utils.ByteArrayToString(redBSS.dot11Bssid);
                row.Auth     = WLAN.dot11DefaultAuthAlgorithm.ToString();
                row.Cipher   = WLAN.dot11DefaultCipherAlgorithm.ToString();
                row.PowerDbm = redBSS.rssi;
                infoWlan.WLANS.AddWLANSRow(row);
            }

            return(infoWlan);
        }
예제 #16
0
파일: Network.cs 프로젝트: easis/WifiView
        public static void AddNetworks(DataGridView table, WlanClient.WlanInterface wlanIface)
        {
            table.Rows.Clear();

            Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList(0);
            foreach (Wlan.WlanAvailableNetwork network in networks)
            {
                try
                {
                    table.Rows.Add(new string[]
                    {
                        Utils.GetStringForSSID(network.dot11Ssid),
                        AlgorithmToString(network.dot11DefaultCipherAlgorithm),
                        network.dot11DefaultAuthAlgorithm.ToString(),
                        $"{network.wlanSignalQuality} %"
                    });
                } catch {
                    Console.WriteLine($"error");
                    continue;
                }
            }
        }
예제 #17
0
        void WlanScanThread()
        {
            while (tourRecording)
            {
                if (!validGpsSignal)
                {
                    context.MainForm.SetStatusBar("Warte auf gültiges GPS Signal...");
                    while (!validGpsSignal)
                    {
                        Thread.Sleep(100);
                    }
                }
                double signalAge = (DateTime.Now - gpsLlTimestamp).TotalSeconds;
                while (signalAge > 10)
                {
                    context.MainForm.SetStatusBar(String.Format("Letztes GPS Signal ist {0} Sekunden her. Warte auf Erneuerung...", (int)signalAge));
                    Thread.Sleep(1000);
                    signalAge = (DateTime.Now - gpsLlTimestamp).TotalSeconds;
                }

                scanComplete = false;
                usableInterface.Scan();
                while (!scanComplete)
                {
                    Thread.Sleep(100);
                }

                Invoke((MethodInvoker) delegate { listView1.Items.Clear(); });
                int numAps = 0;
                Wlan.WlanAvailableNetwork[] networks = usableInterface.GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags.IncludeAllAdhocProfiles | Wlan.WlanGetAvailableNetworkFlags.IncludeAllManualHiddenProfiles);
                foreach (Wlan.WlanAvailableNetwork network in networks)
                {
                    Wlan.Dot11Ssid      ssid       = network.dot11Ssid;
                    Wlan.WlanBssEntry[] bssEntries = usableInterface.GetNetworkBssList(ssid, network.dot11BssType, network.securityEnabled);

                    foreach (Wlan.WlanBssEntry bss in bssEntries)
                    {
                        numAps++;
                        string bssid       = BitConverter.ToString(bss.dot11Bssid);
                        string ssidEncoded = BitConverter.ToString(network.dot11Ssid.SSID);
                        this.Invoke(wifiFoundDelegate, bssid, Encoding.UTF8.GetString(network.dot11Ssid.SSID, 0, (int)network.dot11Ssid.SSIDLength), bss.rssi, network.dot11BssType, network.dot11DefaultAuthAlgorithm);

                        lock (lockVictim)
                        {
                            tourStreamWriter.WriteLine("NETWORK;{0};{1};{2};{3};{4};{5};{6};{7};{8};{9};{10};{11};" +
                                                       "{12};{13};{14};{15};{16};{17};{18};{19};{20};{21};{22};{23};{24};{25};{26};{27}",
                                                       DateTime.Now.Ticks, DateTime.Now.ToString(), lon, lat, bssid, (int)network.dot11BssType,
                                                       (int)network.dot11DefaultAuthAlgorithm, (int)network.dot11DefaultCipherAlgorithm,
                                                       network.dot11Ssid.SSIDLength, ssidEncoded, (int)network.flags, network.morePhyTypes,
                                                       network.networkConnectable, network.securityEnabled, network.wlanSignalQuality,
                                                       bss.beaconPeriod, bss.capabilityInformation, bss.chCenterFrequency,
                                                       (int)bss.dot11BssPhyType, (int)bss.dot11BssType, bss.hostTimestamp, bss.ieOffset,
                                                       bss.ieSize, bss.inRegDomain, bss.phyId, bss.rssi, bss.timestamp, (int)bss.wlanRateSet.GetRateInMbps(0)
                                                       );
                        }
                    }
                }
                lock (lockVictim)
                {
                    tourStreamWriter.Flush();
                }
                context.MainForm.SetStatusBar(String.Format("{0} Services entdeckt.", numAps));
            }
            scanThreadEnded = true;
            context.MainForm.SetStatusBar("Scan angehalten!");
        }
예제 #18
0
        /// <summary>
        /// Using managedWifi APIs to scan Wi-Fi networks and their details
        /// </summary>
        /// <returns>Result of managedWifi APIs scaned - Wi-Fi networks</returns>
        public string StartWifiScanning()
        {
            WlanClient client = new WlanClient();

            WlanClient.WlanInterface wlanIface = client.Interfaces[0];
            wlanIface.Scan();
            Thread.Sleep(10000);
            Wlan.WlanBssEntry[]         WlanBssValues = wlanIface.GetNetworkBssList();
            Wlan.WlanAvailableNetwork[] networks      = wlanIface.GetAvailableNetworkList(0);
            String APList = "";

            APList += "Wireless Card : " + wlanIface.InterfaceDescription + "\r\n";
            APList += "接口名称 : " + wlanIface.InterfaceName + "\r\n";
            APList += "当前有 " + WlanBssValues.Length.ToString() + "网络可见" + "\r\n";
            APList += "\r\n";
            int i = 1;

            foreach (Wlan.WlanBssEntry WlanBssValue in WlanBssValues)
            {
                APList += "SSID " + i.ToString() + ":" + GetStringForSSID(WlanBssValue.dot11Ssid) + "\r\n";
                APList += "Network type                :  结构" + "\r\n";
                String channel       = Convert.ToString(((WlanBssValue.chCenterFrequency - 2412000) / 1000 / 5 + 1));
                String securetype    = "Unknow";
                String securety      = "Unknow";
                String SignalQuality = "Unknow";
                int    j             = 0;
                for (j = 0; j < networks.Length; j++)
                {
                    if (GetStringForSSID(WlanBssValue.dot11Ssid).Equals(GetStringForSSID(networks[j].dot11Ssid)))
                    {
                        switch (networks[j].dot11DefaultCipherAlgorithm)
                        {
                        case Wlan.Dot11CipherAlgorithm.WEP:
                        case Wlan.Dot11CipherAlgorithm.WEP104:
                        case Wlan.Dot11CipherAlgorithm.WEP40:
                            securety = "WEP";
                            break;

                        case Wlan.Dot11CipherAlgorithm.None:
                            securety = "开放";
                            break;

                        case Wlan.Dot11CipherAlgorithm.CCMP:
                            securety = "CCMP";
                            break;

                        case Wlan.Dot11CipherAlgorithm.TKIP:
                            securety = "TKIP";
                            break;

                        default:
                            securety = "unknow";
                            break;
                        }
                        switch (networks[j].dot11DefaultAuthAlgorithm)
                        {
                        case Wlan.Dot11AuthAlgorithm.RSNA:
                            securetype = "WPA2 - 企业";
                            break;

                        case Wlan.Dot11AuthAlgorithm.RSNA_PSK:
                            securetype = "WPA2 - 个人";
                            break;

                        case Wlan.Dot11AuthAlgorithm.IEEE80211_SharedKey:
                            securetype = "IEEE80211_SharedKey";
                            break;

                        case Wlan.Dot11AuthAlgorithm.IEEE80211_Open:
                            securetype = "开放";
                            break;

                        case Wlan.Dot11AuthAlgorithm.WPA:
                            securetype = "WPA";
                            break;

                        case Wlan.Dot11AuthAlgorithm.WPA_None:
                            securetype = "WPA_None";
                            break;

                        case Wlan.Dot11AuthAlgorithm.WPA_PSK:
                            securetype = "WPA - 个人";
                            break;

                        default:
                            securety = "unknow";
                            break;
                        }
                        SignalQuality = networks[j].wlanSignalQuality.ToString() + "%";
                        break;
                    }
                }
                APList += "身份验证                : " + securetype + "\r\n";
                APList += "加密                    : " + securety + "\r\n";
                APList += "BSSID 1                 : " + GetStringForBSSID(WlanBssValue) + "\r\n";
                APList += "信号                    : " + SignalQuality + "\r\n";
                APList += "无线电类型              :      802.11n\r\n";
                APList += "频道                    : " + channel + "\r\n";
                //StringBuilder sb = new StringBuilder();
                //foreach (ushort value in WlanBssValue.wlanRateSet.Rates)
                //sb.AppendFormat("{0:d}" + " ", value);
                APList += "基本速率(Mbps)          :          1 2 5.5 11\r\n";
                APList += "其他速率(Mbps)          :          28 24 36 48 54\r\n";
                APList += "RSSI                    : " + WlanBssValue.rssi.ToString() + "\r\n";
                APList += "\r\n";

                //System.IO.File.Delete("testlog.txt");
                //System.IO.File.AppendAllText("testlog.txt", APList);
            }

            return(APList);
        }
예제 #19
0
 public Wlan.WlanAvailableNetwork[] GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags flags)
 {
     return(_wlanInterface.GetAvailableNetworkList(flags));
 }
예제 #20
0
 static Wlan.WlanAvailableNetwork[] GetAvailableWifiNetworks(WlanClient.WlanInterface wlanIface)
 {
     // Lists all available networks
     Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList(0);
     return(networks);
 }