开启wpa_supplicant
wpa_supplicant –Dnl80211 -iwlan0 -c ./wpa.conf –B
或者
wpa_supplicant -Dwext -iwlan0 -c ./wpa.conf -B
扫描AP
wpa_cli -p/var/run/wpa_supplicant scan
查看AP扫描结果
wpa_cli -p/var/run/wpa_supplicant scan_results
连接到热点
OPEN
wpa_cli -p/var/run/wpa_supplicant remove_network 0
wpa_cli -p/var/run/wpa_supplicant ap_scan 1
wpa_cli -p/var/run/wpa_supplicant add_network
wpa_cli -p/var/run/wpa_supplicant set_network 0 ssid "test"
wpa_cli -p/var/run/wpa_supplicant set_network 0 key_mgmt NONE
wpa_cli -p/var/run/wpa_supplicant select_network 0
WEP40 with open system
wpa_cli -p/var/run/wpa_supplicant remove_network 0
wpa_cli -p/var/run/wpa_supplicant ap_scan 1
wpa_cli -p/var/run/wpa_supplicant add_network
wpa_cli -p/var/run/wpa_supplicant set_network 0 ssid "test"
wpa_cli -p/var/run/wpa_supplicant set_network 0 key_mgmt NONE
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_key0 1234567890
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0
wpa_cli -p/var/run/wpa_supplicant select_network 0
WEP40 with shared key mode
wpa_cli -p/var/run/wpa_supplicant remove_network 0
wpa_cli -p/var/run/wpa_supplicant ap_scan 1
wpa_cli -p/var/run/wpa_supplicant add_network
wpa_cli -p/var/run/wpa_supplicant set_network 0 ssid "test"
wpa_cli -p/var/run/wpa_supplicant set_network 0 key_mgmt NONE
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_key0 1234567890
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0
wpa_cli –p/var/run/wpa_supplicant set_network 0 auth_alg SHARED
wpa_cli -p/var/run/wpa_supplicant select_network 0
WEP104 with open system
wpa_cli -p/var/run/wpa_supplicant remove_network 0
wpa_cli -p/var/run/wpa_supplicant ap_scan 1
wpa_cli -p/var/run/wpa_supplicant add_network
wpa_cli -p/var/run/wpa_supplicant set_network 0 ssid "test"
wpa_cli -p/var/run/wpa_supplicant set_network 0 key_mgmt NONE
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_key0 12345678901234567890123456
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0
wpa_cli -p/var/run/wpa_supplicant select_network 0
WEP104 with shared key mode
wpa_cli -p/var/run/wpa_supplicant remove_network 0
wpa_cli -p/var/run/wpa_supplicant ap_scan 1
wpa_cli -p/var/run/wpa_supplicant add_network
wpa_cli -p/var/run/wpa_supplicant set_network 0 ssid "test"
wpa_cli -p/var/run/wpa_supplicant set_network 0 key_mgmt NONE
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_key0 12345678901234567890123456
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0
wpa_cli –p/var/run/wpa_supplicant set_network 0 auth_alg SHARED
wpa_cli -p/var/run/wpa_supplicant select_network 0
wep key is ASCII
#If wep key is ASCII type,use the following cmd:
#WEP40:
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_key0 "12345"
#WEP104:
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_key0 '"1234567890123"'
#WEP key index is X from 0 to 3, change X for other key index and select it.
#wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_keyX 12345678901234567890123456 #wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_tx_keyidx X
TKIP and AES
wpa_cli -p/var/run/wpa_supplicant remove_network 0
wpa_cli -p/var/run/wpa_supplicant ap_scan 1
wpa_cli -p/var/run/wpa_supplicant add_network
wpa_cli -p/var/run/wpa_supplicant set_network 0 ssid "test"
wpa_cli -p/var/run/wpa_supplicant set_network 0 key_mgmt WPA-PSK
wpa_cli -p/var/run/wpa_supplicant set_network 0 psk "12345678"
wpa_cli -p/var/run/wpa_supplicant select_network 0
Ad-hoc mode
OPEN
wpa_cli -p/var/run/wpa_supplicant scan
wpa_cli -p/var/run/wpa_supplicant scan_results
wpa_cli -p/var/run/wpa_supplicant remove_network 0
wpa_cli -p/var/run/wpa_supplicant ap_scan 2
wpa_cli -p/var/run/wpa_supplicant add_network
wpa_cli -p/var/run/wpa_supplicant set_network 0 ssid '"Adhoc_test"'
wpa_cli -p/var/run/wpa_supplicant set_network 0 mode 1
wpa_cli -p/var/run/wpa_supplicant set_network 0 key_mgmt NONE
wpa_cli -p/var/run/wpa_supplicant set_network 0 frequency 2412
wpa_cli -p/var/run/wpa_supplicant select_network 0
#frequency is to set the channel frequency for Ad-hoc master.
WEP40
wpa_cli -p/var/run/wpa_supplicant scan
wpa_cli -p/var/run/wpa_supplicant scan_results
wpa_cli -p/var/run/wpa_supplicant remove_network 0
wpa_cli -p/var/run/wpa_supplicant ap_scan 2
wpa_cli -p/var/run/wpa_supplicant add_network
wpa_cli -p/var/run/wpa_supplicant set_network 0 ssid '"Adhoc_test"'
wpa_cli -p/var/run/wpa_supplicant set_network 0 mode 1
wpa_cli -p/var/run/wpa_supplicant set_network 0 key_mgmt NONE
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_key0 1234567890
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0
wpa_cli -p/var/run/wpa_supplicant set_network 0 frequency 2412
wpa_cli -p/var/run/wpa_supplicant select_network 0
WEP104
wpa_cli -p/var/run/wpa_supplicant scan
wpa_cli -p/var/run/wpa_supplicant scan_results
wpa_cli -p/var/run/wpa_supplicant remove_network 0
wpa_cli -p/var/run/wpa_supplicant ap_scan 2
wpa_cli -p/var/run/wpa_supplicant add_network
wpa_cli -p/var/run/wpa_supplicant set_network 0 ssid '"Adhoc_test"'
wpa_cli -p/var/run/wpa_supplicant set_network 0 mode 1
wpa_cli -p/var/run/wpa_supplicant set_network 0 key_mgmt NONE
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_key0 12345678901234567890123456
wpa_cli -p/var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0
wpa_cli -p/var/run/wpa_supplicant set_network 0 frequency 2412
wpa_cli -p/var/run/wpa_supplicant select_network 0
Save the Current Connection AP configuration
wpa_cli -p/var/run/wpa_supplicant save_config
WPS Connection
Push Button
wpa_cli -p/var/run/wpa_supplicant remove_network 0
wpa_cli -p/var/run/wpa_supplicant wps_pbc any
Pin Code
wpa_cli -p/var/run/wpa_supplicant remove_network 0
wpa_cli -p/var/run/wpa_supplicant wps_pin any 12345670
or
wpa_cli -p/var/run/wpa_supplicant remove_network 0
wpa_cli -p/var/run/wpa_supplicant wps_pin any
Get Current Status of wpa_supplicant
wpa_cli -p/var/run/wpa_supplicant status
Disable current network connection
wpa_cli -p/var/run/wpa_supplicant disable_network 0
WPA_SUPPLICANT + WPA_CLI - Control interface commands
Following commands can be used with wpa_cli
PING
This command can be used to test whether wpa_supplicant is replying to the control interface commands. The expected reply is PING if the connection is open and wpa_supplicant is processing commands.
STATUS
Request current status information. The output is a text block with each line in variable=value format. For example:
bssid=02:00:01:02:03:04
ssid=test network
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA-PSK
wpa_state=COMPLETED
LIST_NETWORKS
List configured networks.
network id / ssid / bssid / flags
0 example network any [CURRENT]
(note: fields are separated with tabs)
SCAN
Request a new BSS scan.
SCAN_RESULTS
Get the latest scan results.
bssid / frequency / signal level / flags / ssid
00:09:5b:95:e0:4e 2412 208 [WPA-PSK-CCMP] jkm private
02:55:24:33:77:a3 2462 187 [WPA-PSK-TKIP] testing
00:09:5b:95:e0:4f 2412 209 jkm guest
(note: fields are separated with tabs)
ADD_NETWORK
Add a new network. This command creates a new network with empty configuration. The new network is disabled and once it has been configured it can be enabled with ENABLE_NETWORK command. ADD_NETWORK returns the network id of the new network or FAIL on failure
SELECT_NETWORK <network_id>
Select a network (disable others). Network id can be received from the LIST_NETWORKS command output.
ENABLE_NETWORK <network_id>
Enable a network. Network id can be received from the LIST_NETWORKS command output.
DISABLE_NETWORK <network_id>
Disable a network. Network id can be received from the LIST_NETWORKS command output. Special network id all can be used to disable all network. .
REMOVE_NETWORK <network_id>
Remove a network. Network id can be received from the LIST_NETWORKS command output. Special network id all can be used to remove all network.
SET_NETWORK <network_id> <variable> <value>
Set network variables. Network id can be received from the LIST_NETWORKS command output. This command uses the same variables and data formats as the configuration file.
• ssid (network name, SSID)
• psk (WPA passphrase or pre-shared key)
• key_mgmt (key management protocol, NONE, WPA-PSK, WPA-EAP)
• proto ( WPA WPA2)
• pairwise ( CCMP TKIP)
• group ( CCMP TKIP WEP40 WEP104)
• wep_key0 ( set wep key for key index 0)
• wep_tx_keyidx ( select wep key index)
• frequency ( Channel frequency in megahertz (MHz) for IBSS )
GET_NETWORK <network_id> <variable>
Get network variables. Network id can be received from the LIST_NETWORKS command output.
SAVE_CONFIG
Save the current configuration.
AP_SCAN <ap_scan_value>
Change ap_scan value: 0 = no scanning, 1 = wpa_supplicant requests scans and uses scan results to select the AP, 2 = wpa_supplicant does not use scanning and just requests driver to associate and take care of AP selection文章来源:https://www.toymoban.com/news/detail-644478.html
参考Realtek官方说明文档文章来源地址https://www.toymoban.com/news/detail-644478.html
到了这里,关于[Realtek] WPA_SUPPLICANT + WPA_CLI使用指南的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!