【无线】hostapd cli用法

hostapd是用户态的守护进程,用于无线station接入和安全认证,hostapd_cli是用于访问hostapd并且获取当前ap信息和对ap进行操作的客户端程序。

用法如下:

/*查看帮助*/

@OpenWrt:/tmp# ./hostapd_cli --help

hostapd_cli v2.0-devel
Copyright (c) 2004-2012, Jouni Malinen <[email protected]> and contributors


usage: hostapd_cli [-p<path>] [-i<ifname>] [-hvB] [-a<path>] \
                   [-G<ping interval>] [command..]


Options:
   -h           help (show this usage text)
   -v           shown version information
   -p<path>     path to find control sockets (default: /var/run/hostapd)
   -a<file>     run in daemon mode executing the action file based on events
                from hostapd
   -B           run a daemon in the background
   -i<ifname>   Interface to listen on (default: first interface found in the
                socket path)


Commands:
   mib                  get MIB variables (dot1x, dot11, radius)
   sta <addr>           get MIB variables for one station
   all_sta              get MIB variables for all stations
   new_sta <addr>       add a new station
   deauthenticate <addr>  deauthenticate a station
   disassociate <addr>  disassociate a station
   wps_pin <uuid> <pin> [timeout] [addr]  add WPS Enrollee PIN
   wps_check_pin <PIN>  verify PIN checksum
   wps_pbc              indicate button pushed to initiate PBC
   wps_ap_pin <cmd> [params..]  enable/disable AP PIN
   wps_config <SSID> <auth> <encr> <key>  configure AP
   get_config           show current configuration
   help                 show this usage help
   interface [ifname]   show interfaces/select interface
   level <debug level>  change debug level
   license              show full hostapd_cli license
   anqp_set <id> <ie>   set ANQP information elements
   hs20_anqp_set <id> <ie>  set HS20 ANQP information elements
   quit                 exit hostapd_cli
   
   
   /*接入到运行在某个无线设备上的hostapd后,进行hostapd的命令行模式*/
@OpenWrt:/tmp# ./hostapd_cli -p /var/run/hostapd_2g -i ath0
hostapd_cli v2.0-devel
Copyright (c) 2004-2012, Jouni Malinen <[email protected]> and contributors


This software may be distributed under the terms of the BSD license.
See README for more details.


Interactive mode

/*显示MAC地址为58:7f:57:8b:bc:0d station的信息,这里58:7f:57:8b:bc:0d是一台iphone6的手机*/
 > sta 58:7f:57:8b:bc:0d
58:7f:57:8b:bc:0d
dot11RSNAStatsSTAAddress=58:7f:57:8b:bc:0d
dot11RSNAStatsVersion=1
dot11RSNAStatsSelectedPairwiseCipher=00-0f-ac-4
dot11RSNAStatsTKIPLocalMICFailures=0
dot11RSNAStatsTKIPRemoteMICFailures=0
hostapdWPAPTKState=11
hostapdWPAPTKGroupState=0

/*获取当前ap的配置,该ap是2.4的AP*/
> get_config
bssid=00:aa:eb:09:29:00
ssid=openwrt_2.4G
wps_state=configured
passphrase=12345670
psk=53ee14c8e699fb18e163f7ddda799ad791a753b4d0c6374ff8ffe91934cfd2ed
key_mgmt=WPA-PSK 
group_cipher=TKIP
rsn_pairwise_cipher=CCMP TKIP 
wpa_pairwise_cipher=CCMP TKIP 


> interface
Available interfaces:
ath0

/*触发WPS,方式是push button config方式,这时候station设备可以选择WPS,按键方式尽心接入*/
> wps_pbc
OK



/*显示所有接入到ath0的设备*/
> all
90:67:1c:35:4c:08
dot11RSNAStatsSTAAddress=90:67:1c:35:4c:08
dot11RSNAStatsVersion=1
dot11RSNAStatsSelectedPairwiseCipher=00-0f-ac-4
dot11RSNAStatsTKIPLocalMICFailures=0
dot11RSNAStatsTKIPRemoteMICFailures=0
hostapdWPAPTKState=11
hostapdWPAPTKGroupState=0
wpsUuid=a1810a83-0864-5327-8c19-6b8e827677a5
wpsPrimaryDeviceType=10-0050F204-5
wpsDeviceName=G7-TL00
wpsManufacturer=HUAWEI
wpsModelName=HUAWEI G7-TL00
wpsModelNumber=HUAWEI G7-TL00
wpsSerialNumber=90671c355ba8
58:7f:57:8b:bc:0d
dot11RSNAStatsSTAAddress=58:7f:57:8b:bc:0d
dot11RSNAStatsVersion=1
dot11RSNAStatsSelectedPairwiseCipher=00-0f-ac-4
dot11RSNAStatsTKIPLocalMICFailures=0
dot11RSNAStatsTKIPRemoteMICFailures=0
hostapdWPAPTKState=11
hostapdWPAPTKGroupState=0

猜你喜欢

转载自blog.csdn.net/vickytong1018/article/details/79746340
CLI