C# 如何扫描网络上存在的无线设备
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2377426/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to scan the wireless devices which exist on the network
提问by amexn
Now my team working in a network project using windows application c#.
现在我的团队使用 Windows 应用程序 C# 在网络项目中工作。
How to scan the wireless devices which exist on the network.The functionality is exactly the same thing that you see in the existing windows utilities within the windows operating system. I'm sure you experienced when you plug a wireless laptop card in, it brings up a window that shows you all of the access points it detects for connecting to. How to capture this information listed below
如何扫描网络上存在的无线设备。功能与您在 Windows 操作系统中现有的 Windows 实用程序中看到的完全相同。我相信当您插入无线笔记本电脑卡时,它会弹出一个窗口,向您显示它检测到的所有接入点以进行连接。如何捕获下面列出的这些信息
- MAC Address
- IP Address
- SSID
- Channel
- Timestamp
- Cipher type
- Encryption level
- Signal Strength
- MAC地址
- IP地址
- SSID
- 渠道
- 时间戳
- 密码类型
- 加密级别
- 信号强度
Did i use Kismet or NetStumbler. Please suggest good library/code
我使用的是 Kismet 还是 NetStumbler。请推荐好的库/代码
采纳答案by Krishnan
if you are ready to invest money then u can use WiFi-Manager/Advanced WiFi-Manager
如果您准备投资,那么您可以使用WiFi-Manager/ Advanced WiFi-Manager
WiFi-Manager is a developer tool that allows you to manage WiFi connections and settings in Windows XP SP2 and Windows Vista using one set of API functions, although these versions of Windows use absolutely different APIs for wireless network management. Also, WiFi-Manager provides a COM interface for all API functions so you can simply control WiFi settings from VB or such .NET languages as VB.NET or C#.
WiFi-Manager 是一个开发者工具,允许您使用一组 API 函数在 Windows XP SP2 和 Windows Vista 中管理 WiFi 连接和设置,尽管这些版本的 Windows 使用完全不同的 API 进行无线网络管理。此外,WiFi-Manager 为所有 API 功能提供了一个 COM 接口,因此您可以简单地从 VB 或诸如 VB.NET 或 C# 之类的 .NET 语言控制 WiFi 设置。
WiFi-Manager contains functions for enumerating WiFi adapters, enumerating available networks and getting their settings, functions for connecting and disconnecting to networks, functions for working with wireless networks profiles, etc.
WiFi-Manager 包含用于枚举 WiFi 适配器、枚举可用网络并获取其设置的功能、用于连接和断开网络的功能、用于处理无线网络配置文件的功能等。
Advanced WiFi-Manager is a next-generation tool, it supports all features WiFi-Manager has but also can use NDIS to manage WiFi adapters and works in Windows 2000/2003/XP/Vista/Windows7 and has no dependencies on Service Packs or hotfixes installed!
Advanced WiFi-Manager 是下一代工具,它支持 WiFi-Manager 的所有功能,但也可以使用 NDIS 来管理 WiFi 适配器,适用于 Windows 2000/2003/XP/Vista/Windows7,不依赖于 Service Pack 或修补程序安装了!
I hope this is useful
我希望这是有用的
回答by Jayjitraj
You should use native WiFi APIfor that. There are set of functions which you need to use first of all
您应该为此使用本机 WiFi API。您首先需要使用一组功能
- openhandler()
- getEnuminterface() - here you will get GUID of your WiFi hardware
- wlanscann()
- wlangetavailablenetworklist() -here as output you will get a structure where you can find all above information.
- closehandler()
- 打开处理程序()
- getEnuminterface() - 在这里您将获得您的 WiFi 硬件的 GUID
- wlanscann()
- wlangetavailablenetworklist() - 作为输出,您将获得一个结构,您可以在其中找到所有上述信息。
- 关闭处理程序()
Just dig into native WiFi and you will get all information.
只需深入了解原生 WiFi,您就会获得所有信息。
Starting with Windows 8.1 and Windows Server 2012 R2, use Wi-Fi Direct instead.
从 Windows 8.1 和 Windows Server 2012 R2 开始,请改用 Wi-Fi Direct。
回答by Sameh Deabes
You may start from this "How to programmatically detect wi-fi routers and signal strength?"
您可以从“如何以编程方式检测 Wi-Fi 路由器和信号强度?”开始。
回答by Jubjub
You could use the Managed Wifi API. It's just a wrapper for the Native Wifi Api, which is available to Windows XP and later versions.
您可以使用托管 Wifi API。它只是 Native Wifi Api 的包装器,可用于 Windows XP 和更高版本。
This code should show the available networks:
此代码应显示可用网络:
WlanClient client = new WlanClient();
foreach ( WlanClient.WlanInterface wlanIface in client.Interfaces )
{
// Lists all available networks
Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList( 0 );
foreach ( Wlan.WlanAvailableNetwork network in networks )
{
Console.WriteLine( "Found network with SSID {0}.", GetStringForSSID(network.dot11Ssid));
}
}
static string GetStringForSSID(Wlan.Dot11Ssid ssid)
{
return Encoding.ASCII.GetString( ssid.SSID, 0, (int) ssid.SSIDLength );
}