美文网首页
Mac使用Airport获取附近可用Wi-Fi

Mac使用Airport获取附近可用Wi-Fi

作者: 捡书 | 来源:发表于2019-10-29 16:57 被阅读0次

MacOS自带的命令可以获取附近Wi-Fi的详细信息。首先我们需要把命令加到环境变量中:

Last login: Sat Oct 26 10:25:45 on ttys000
➜  ~ sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport

Password:
➜  ~

重启终端,就可以使用airport命令了:

➜  ~ airport
Usage: airport <interface> <verb> <options>

    <interface>
    If an interface is not specified, airport will use the first AirPort interface on the system.

    <verb is one of the following:
    prefs   If specified with no key value pairs, displays a subset of AirPort preferences for
        the specified interface.

        Preferences may be configured using key=value syntax. Keys and possible values are specified below.
        Boolean settings may be configured using 'YES' and 'NO'.

        DisconnectOnLogout (Boolean)
        JoinMode (String)
            Automatic
            Preferred
            Ranked
            Recent
            Strongest
        JoinModeFallback (String)
            Prompt
            JoinOpen
            KeepLooking
            DoNothing
        RememberRecentNetworks (Boolean)
        RequireAdmin (Boolean)
        RequireAdminIBSS (Boolean)
        RequireAdminNetworkChange (Boolean)
        RequireAdminPowerToggle (Boolean)
        WoWEnabled (Boolean)

    logger  Monitor the driver's logging facility.

    sniff   If a channel number is specified, airportd will attempt to configure the interface
        to use that channel before it begins sniffing 802.11 frames. Captures files are saved to /tmp.
        Requires super user privileges.

    debug   Enable debug logging. A debug log setting may be enabled by prefixing it with a '+', and disabled
        by prefixing it with a '-'.

        AirPort Userland Debug Flags
            DriverDiscovery
            DriverEvent
            Info
            SystemConfiguration
            UserEvent
            PreferredNetworks
            AutoJoin
            IPC
            Scan
            802.1x
            Assoc
            Keychain
            RSNAuth
            WoW
            P2P
            Roam
            BTCoex
            AllUserland - Enable/Disable all userland debug flags

        AirPort Driver Common Flags
            DriverInfo
            DriverError
            DriverWPA
            DriverScan
            AllDriver - Enable/Disable all driver debug flags

        AirPort Driver Vendor Flags
            VendorAssoc
            VendorConnection
            AllVendor - Enable/Disable all vendor debug flags

        AirPort Global Flags
            LogFile - Save all AirPort logs to /var/log/wifi.log

<options> is one of the following:
    No options currently defined.

Examples:

Configuring preferences (requires admin privileges)
    sudo airport en1 prefs JoinMode=Preferred RememberRecentNetworks=NO RequireAdmin=YES

Sniffing on channel 1:
    airport en1 sniff 1


LEGACY COMMANDS:
Supported arguments:
 -c[<arg>] --channel=[<arg>]    Set arbitrary channel on the card
 -z        --disassociate       Disassociate from any network
 -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.
 -s[<arg>] --scan=[<arg>]       Perform a wireless broadcast scan.
                   Will perform a directed scan if the optional <arg> is provided
 -x        --xml                Print info as XML
 -P        --psk                Create PSK from specified pass phrase and SSID.
                   The following additional arguments must be specified with this command:
                                  --password=<arg>  Specify a WPA password
                                  --ssid=<arg>      Specify SSID when creating a PSK
 -h        --help               Show this help

其中-s参数可以列出当前所有能发现的wifi:

➜  ~ airport -s
                            SSID BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
                    小房间_5G 50:d2:f5:61:f4:cb -90  157     Y  CN WPA(PSK/TKIP,AES/TKIP) WPA2(PSK/TKIP,AES/TKIP)
                   ChinaNet-n9HF d0:0f:6d:d3:96:fb -88  9       Y  -- WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)
                    CMCC-gbkA-5G b4:d0:a9:02:be:c1 -87  52      Y  CN WPA(PSK/TKIP,AES/TKIP) WPA2(PSK/TKIP,AES/TKIP)
                ChinaNet-KEpF-5G fc:94:ce:51:e0:86 -84  149     Y  CN WPA2(PSK/TKIP,AES/TKIP)
                        jetum-5G cc:2d:21:38:a0:e5 -82  40      Y  -- WPA(PSK/AES/AES) WPA2(PSK/AES/AES)
                       myhome_5G 04:d4:c4:b8:30:9c -80  157     Y  -- WPA2(PSK/AES/AES)
                   ChinaNet-jU5G 00:be:9e:16:e3:3d -78  13      Y  CN WPA(PSK/AES/AES) WPA2(PSK/AES/AES)
                   ChinaNet-KEpF fc:94:ce:51:e0:82 -77  9       Y  CN WPA2(PSK/TKIP,AES/TKIP)
                   ChinaNet-y4bU ec:8a:c7:1c:2f:ed -77  8,+1    Y  CN WPA(PSK/AES/AES) WPA2(PSK/AES/AES)
                   ChinaNet-6P3X 00:1f:8f:2f:5f:0c -76  3       Y  -- WPA(PSK/TKIP/TKIP) WPA2(PSK/AES/TKIP)
                      358-58-701 c0:61:18:a3:ce:38 -67  11,-1   Y  -- WPA(PSK/AES/AES) WPA2(PSK/AES/AES)
                          myhome 04:d4:c4:b8:30:98 -67  11      Y  -- WPA2(PSK/AES/AES)
                      HUAWEI-XLJ 00:34:fe:63:0b:8c -64  5       Y  -- WPA(PSK/TKIP,AES/TKIP) WPA2(PSK/TKIP,AES/TKIP)
                   ChinaNet-z6j9 d0:60:8c:52:18:4b -63  4       Y  -- WPA(PSK/TKIP,AES/TKIP) WPA2(PSK/TKIP,AES/TKIP)
                       小房间 50:d2:f5:61:f4:ca -62  11      Y  CN WPA(PSK/TKIP,AES/TKIP) WPA2(PSK/TKIP,AES/TKIP)
                             xdy 08:1f:71:22:5d:b1 -50  2,+1    Y  CN WPA(PSK/AES/AES) WPA2(PSK/AES/AES)
                          ziroom 54:75:95:ae:c4:07 -34  1,+1    Y  CN WPA(PSK/AES/AES) WPA2(PSK/AES/AES)
                          ziroom 54:75:95:ae:c4:09 -46  149     Y  CN WPA(PSK/AES/AES) WPA2(PSK/AES/AES)

相关文章

网友评论

      本文标题:Mac使用Airport获取附近可用Wi-Fi

      本文链接:https://www.haomeiwen.com/subject/goegvctx.html