[Sniffer] Sniffer Wireless Packet on Mac

[Sniffer] To sniffer wireless packets on Mac

由於對 Mac 不熟,但是想抓一些無線的封包,所以 google 一下,順便筆記。

新增 airport 連結

$ sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport

airport

$ airport
Usage: airport <interface> <verb> <options>

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

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

                Preferences may be configured using key=value syntax. Keys and p                                                                                                                                                             ossible 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 confi                                                                                                                                                             gure the interface
                to use that channel before it begins sniffing 802.11 frames. Cap                                                                                                                                                             tures files are saved to /tmp.
                Requires super user privileges.

        debug   Enable debug logging. A debug log setting may be enabled by pref                                                                                                                                                             ixing 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 Requ                                                                                                                                                             ireAdmin=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 sp                                                                                                                                                             ecified with this command:
                                  --password=<arg>  Specify a WPA password
                                  --ssid=<arg>      Specify SSID when creating a                                                                                                                                                              PSK
 -h        --help               Show this help

Sniffer

會將封包存在 /tmp 目錄下。

$ sudo airport en1 sniff 6
Capturing 802.11 frames on en1.
^CSession saved to /tmp/airportSniff8JZ030.cap.

wireshark

使用 Wireshark 來打開封包,應該就可以看見無線封包的內容了。

Reference

  1. How to put Mac OS X wireless adapter in monitor mode

留言

這個網誌中的熱門文章

[Tools] GCOV & LCOV 初探

Quilt Patch 管理操作方法

[C#]C# Coding 規則