1. 程式人生 > >Mac OS下的wifi配置工具

Mac OS下的wifi配置工具

為了用mac抓取802.11 ac的空口包,需要用到Mac OS下的配置wifi的工具。找了半天沒有iwconfig/wpa_supplicant命令,但是發現了airport這個命令。雖然不是很熟悉,但值得高興的是可以直接用airport進行抓包。

1.為了方便在終端直接輸入airport命令,首先將工具連結到sbin目錄
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport

2.檢視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

3.其他常用命令(詳細用法根據上面的命令說明可以知道,這裡只列出,不贅述了):

~ $ airport -I  // 檢視網絡卡資訊,相當於iwconfig
~ $ airport -s  // 掃描
~ $ sudo airport -c1  // 固定wifi通道到1通道,wireshark抓包時會用到
~ $ airport -z //  解關聯
~ $ airport en1 sniff 1  // 用airport在1通道監聽抓包,Captures files are saved to /tmp

4.在Mac OS下用wireshark抓wifi空口包

5.參考文章: