我使用的是Windows 8.1,它没有一个带有GUI的工具来管理wifi网络配置文件。因此,我正在编写一个能够帮助我的工具。我进行了一些搜索,找到了Managed Wifi API,并通过教程的帮助将以下代码组合在一起:
foreach (WlanClient.WlanInterface wlanIface in client.Interfaces)
{
foreach (Wlan.WlanProfileInfo profileInfo in wlanIface.GetProfiles())
{
string profileName = profileInfo.profileName;
ListViewItem item = new ListViewItem(profileName);
string profileXML = wlanIface.GetProfileXml(profileInfo.profileName);
XmlDocument doc = new XmlDocument();
doc.LoadXml(profileXML);
var NSManager = new XmlNamespaceManager(doc.NameTable);
NSManager.AddNamespace("d", "http://www.microsoft.com/networking/WLAN/profile/v1");
XmlNode node = doc.DocumentElement.SelectSingleNode("//d:WLANProfile/d:MSM/d:security/d:authEncryption/d:authentication", NSManager);
item.SubItems.Add(node.InnerText);
Profiles.Items.Add(item);
}
}
获取已保存的网络配置文件列表并将其打印在ListView上。我有两个问题。一是如何使用Managed Wifi API获取完整的配置文件信息?因为我能获取到的只有配置文件名称,网站上没有文档说明。
第二个问题是,由于无法使用API获取完整的网络信息,我使用API以XML格式打印配置文件信息,然后解析XML并读取它。一个示例XML:
<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>MEDO PUB</name>
<SSIDConfig>
<SSID>
<hex>4D45444F20505542</hex>
<name>MEDO PUB</name>
</SSID>
</SSIDConfig>
<connectionType>ESS</connectionType>
<connectionMode>manual</connectionMode>
<MSM>
<security>
<authEncryption>
<authentication>WPA2PSK</authentication>
<encryption>AES</encryption>
<useOneX>false</useOneX>
</authEncryption>
<sharedKey>
<keyType>passPhrase</keyType>
<protected>true</protected>
<keyMaterial>someReallyLongStringLike500+chars</keyMaterial>
</sharedKey>
</security>
</MSM>
</WLANProfile>
我需要获取wifi密码,但我认为它是加密的。我应该如何获取实际密码或解码加密的密码?
更新:我找到了两个链接:揭示WiFi密码的秘密和[C++]转储无线密码,但我不确定它们是否有效,或如何在C#中实施它们。
netsh wlan show profiles
,接着获取密码:netsh wlan show profile "<a profile from the last step> key=clear
- alexcaliburnetsh
之外的其他工具,例如在 Windows 7 中使用图形用户界面。如果我表达不清楚,对不起。我会查看你提供的链接中的问题。我也想不使用 Managed Wifi API 来完成它。 - akinuri