0

我正在尝试确定 10.7 及更高版本上扫描网络的安全类型和 phyMode,但似乎此信息在 10.7 版本后已被删除。到目前为止,我使用的是已弃用的 CWNetwork.securityMode/phyMode API,但在 10.9 中它已被完全删除,因此我无法确定它。最新的 CWNetwork 文档没有任何关于安全模式的信息。

任何人都可以请帮忙。

编辑:似乎没有人使用它....

谢谢,议员。

4

2 回答 2

2

节目有点晚了,但你可能想要使用的是:

BOOL isOpenNetwork = [myNetwork supportsSecurity:kCWSecurityNone];

这是检查网络是否安全的简单方法。您可以在 CoreWLANTypes.h(或以下)中查看所有安全类型:

enum {
    kCWSecurityNone                 = 0,
    kCWSecurityWEP                  = 1,
    kCWSecurityWPAPersonal          = 2,
    kCWSecurityWPAPersonalMixed     = 3,
    kCWSecurityWPA2Personal         = 4,
    kCWSecurityPersonal             = 5,
    kCWSecurityDynamicWEP           = 6,
    kCWSecurityWPAEnterprise        = 7,
    kCWSecurityWPAEnterpriseMixed   = 8,
    kCWSecurityWPA2Enterprise       = 9,
    kCWSecurityEnterprise           = 10,
    kCWSecurityUnknown              = NSIntegerMax,
};
typedef NSInteger CWSecurity;
于 2013-10-21T15:18:19.320 回答
0

supportsSecurity 方法的解决方案对我来说效果不佳:

main...
{
    CWNetwork *network = [self.scanResults objectAtIndex:row];
    NSLog(@"%@", network);
    NSLog(@"%@", [self securityStringForNetwork:network]);
}

- (NSString*)securityStringForNetwork:(CWNetwork *)network;
{
    NSString *securityString = @"Unknown";

    if ([network supportsSecurity:kCWSecurityNone])
        securityString = @"None";
    else if ([network supportsSecurity:kCWSecurityWEP])
        securityString = @"WEP";
    else if ([network supportsSecurity:kCWSecurityWPAPersonal])
        securityString = @"WPA Personal";
    else if ([network supportsSecurity:kCWSecurityWPAPersonalMixed])
        securityString = @"WPA Personal Mixed";
    else if ([network supportsSecurity:kCWSecurityWPA2Personal])
        securityString = @"WPA2 Personal";
    else if ([network supportsSecurity:kCWSecurityPersonal])
        securityString = @"Personal";
    else if ([network supportsSecurity:kCWSecurityDynamicWEP])
        securityString = @"Dynamic WEP";
    else if ([network supportsSecurity:kCWSecurityWPAEnterprise])
        securityString = @"WPA Enterprise";
    else if ([network supportsSecurity:kCWSecurityWPAEnterpriseMixed])
        securityString = @"WPA Enterprise Mixed";
    else if ([network supportsSecurity:kCWSecurityWPA2Enterprise])
        securityString = @"WPA2 Enterprise";
    else if ([network supportsSecurity:kCWSecurityEnterprise])
        securityString = @"Enterprise";

    return securityString;
}

结果是:

[ssid=RiO-摩尔曼斯克, bssid=54:04:a6:e9:b3:4e,安全=WPA2 个人, rssi=-48, 频道= [channelNumber=11(2GHz), channelWidth={20MHz}], ibss= 0]

WPA 个人混合

不匹配。

我想知道确切的安全模式。不是能够支持的安全模式。

于 2015-05-20T09:36:58.547 回答