WPA_SUPPLICANT + WPA_CLI User Guide

Thisdocument had described the way to inform the wpa_supplicant to do theWiFi connection by using the wpa_cli. The wpa_supplicant hadsupported all kinds of security connections and WPS defined in the802.11 specification. So, we suggest use the wpa_supplicant to do theWiFi connection rather than the iwconfig wireless tool.


(A)WPA_SUPPLICANT + WPA_CLI User Guide


1.startwpa_supplicant in the background

wpa_supplicant-Dwext -iwlan0 -c /tmp/net/wpa.conf -B


2.ScaningAP and See Results

wpa_cli-p/var/run/wpa_supplicant scan

wpa_cli-p/var/run/wpa_supplicant scan_results


3.Connectto AP

a.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 '"dlink"'

wpa_cli-p/var/run/wpa_supplicant set_network 0 key_mgmt NONE

wpa_cli-p/var/run/wpa_supplicant select_network0



b.WEP40

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 '"dlink"'

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_network0


c.WEP104

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 '"dlink"'

wpa_cli-p/var/run/wpa_supplicant set_network 0 key_mgmt NONE

wpa_cli-p/var/run/wpa_supplicant set_network 0 wep_key012345678901234567890123456

wpa_cli-p/var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0

wpa_cli-p/var/run/wpa_supplicant select_network0


#Ifwep 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"'


#WEPkey index is X from 0 to 3, change X for other key index and selectit.

#wpa_cli-p/var/run/wpa_supplicant set_network 0 wep_keyX12345678901234567890123456

#wpa_cli-p/var/run/wpa_supplicant set_network 0 wep_tx_keyidx X



d.TKIPand 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 '"dlink"'

wpa_cli-p/var/run/wpa_supplicant set_network 0 psk '"12345678"'

wpa_cli-p/var/run/wpa_supplicant select_network0



4.Ad-hocmode

a.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 select_network0


b.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 select_network0


c.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_key012345678901234567890123456

wpa_cli-p/var/run/wpa_supplicant set_network 0 wep_tx_keyidx 0

wpa_cli-p/var/run/wpa_supplicant select_network0



5.Savethe Current Connection AP configuration file

wpa_cli-p/var/run/wpa_supplicant save_config



6.WPSConnection

PushButton:

wpa_cli-p/var/run/wpa_supplicant remove_network 0

wpa_cli-p/var/run/wpa_supplicant wps_pbc any

PinCode:

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


7.GetCurrent Status of wpa_supplicant

wpa_cli-p/var/run/wpa_supplicant status



8.Disablecurrent network connection

wpa_cli-p/var/run/wpa_supplicant disable_network 0




(B)WPA_SUPPLICANT + WPA_CLI - Control interface commands


Followingcommands can be used with wpa_cli


PING

Thiscommand can be used to test whether wpa_supplicant is replying to thecontrol interface commands.

Theexpected reply is PONGif theconnection is open and wpa_supplicant is processing commands.


STATUS

Requestcurrent status information. The output is a text block with each linein

variable=valueformat. Forexample:

bssid=02:00:01:02:03:04

ssid=testnetwork

pairwise_cipher=CCMP

group_cipher=CCMP

key_mgmt=WPA-PSK

wpa_state=COMPLETED


LIST_NETWORKS

Listconfigured networks.

networkid / ssid / bssid / flags

0example network any [CURRENT]

(note:fields are separated with tabs)


SCAN

Requesta new BSS scan.


SCAN_RESULTS

Getthe latest scan results.

bssid/ frequency / signal level / flags / ssid

00:09:5b:95:e0:4e2412 208 [WPA-PSK-CCMP] jkm private

02:55:24:33:77:a32462 187 [WPA-PSK-TKIP] testing

00:09:5b:95:e0:4f2412 209 jkm guest

(note:fields are separated with tabs)


ADD_NETWORK

Adda new network. This command creates a new network with emptyconfiguration. The new network is

disabledand once it has been configured it can be enabled with ENABLE_NETWORKcommand.ADD_-

NETWORKreturns thenetworkid ofthe new network or FAIL on failure



SELECT_NETWORK<networkid>

Selecta network (disable others). Network id can be received from theLIST_NETWORKScommand

output.


ENABLE_NETWORK<networkid>

Enablea network. Network id can be received from the LIST_NETWORKScommandoutput.



DISABLE_NETWORK<networkid>

Disablea network. Network id can be received from the LIST_NETWORKScommandoutput. Special

networkid allcan be usedto disable all network.

.

REMOVE_NETWORK<networkid>

Removea network. Network id can be received from the LIST_NETWORKScommandoutput. Special

networkid allcan be usedto remove all network.



SET_NETWORK<networkid><variable><value>

Setnetwork variables. Network id can be received from the LIST_NETWORKScommandoutput.

Thiscommand uses the same variables and data formats as the configurationfile.


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)






GET_NETWORK<networkid><variable>

Getnetwork variables. Network id can be received from the LIST_NETWORKScommandoutput.


SAVE_CONFIG

Savethe current configuration.



AP_SCAN<ap_scanvalue>

Changeap_scan value: 0 = no scanning, 1 = wpa_supplicant requests scans anduses scan results to select

theAP, 2 = wpa_supplicant does not use scanning and just requests driverto associate and take care of AP

selection


你可能感兴趣的:(WPA_SUPPLICANT + WPA_CLI User Guide)