Skip to content

Instantly share code, notes, and snippets.

@buhman
Last active March 8, 2023 21:51
  • Star 31 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save buhman/7162560 to your computer and use it in GitHub Desktop.
all wpa_cli ommands can be tab-completed
localhost ~ # cat <<EOF> /etc/wpa_supplicant.conf
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel
update_config=1
EOF
localhost ~ # wpa_supplicant -iwlp1s0 -Dnl80211 -c/etc/wpa_supplicant.conf -B
Successfully initialized wpa_supplicant
localhost ~ # wpa_cli
wpa_cli v2.0
Copyright (c) 2004-2012, Jouni Malinen <j@w1.fi> and contributors
This software may be distributed under the terms of the BSD license.
See README for more details.
Selected interface 'wlp1s0'
Interactive mode
> status
wpa_state=DISCONNECTED
p2p_device_address=00:15:6d:85:5b:1f
address=00:15:6d:85:5b:1f
> scan
OK
<3>CTRL-EVENT-SCAN-RESULTS
> scan_results
bssid / frequency / signal level / flags / ssid
f8:1a:67:78:4b:af 2462 -34 [WPA2-PSK-CCMP][ESS] buhman
> add_network
0
> list_network
network id / ssid / bssid / flags
0 any [DISABLED]
> set_network 0 ssid "buhman"
OK
> set_network 0 psk "world domination"
OK
> list_network
network id / ssid / bssid / flags
0 buhman any [DISABLED]
> enable_network 0
OK
<3>CTRL-EVENT-SCAN-RESULTS
<3>WPS-AP-AVAILABLE
<3>SME: Trying to authenticate with f8:1a:67:78:4b:af (SSID='buhman' freq=2462 MHz)
<3>Trying to associate with f8:1a:67:78:4b:af (SSID='buhman' freq=2462 MHz)
<3>Associated with f8:1a:67:78:4b:af
<3>WPA: Key negotiation completed with f8:1a:67:78:4b:af [PTK=CCMP GTK=CCMP]
<3>CTRL-EVENT-CONNECTED - Connection to f8:1a:67:78:4b:af completed [id=0 id_str=]
> status
bssid=f8:1a:67:78:4b:af
ssid=buhman
id=0
mode=station
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
p2p_device_address=00:15:6d:85:5b:1f
address=00:15:6d:85:5b:1f
> list_networks
network id / ssid / bssid / flags
0 buhman any [CURRENT]
> save_config
OK
> quit
localhost ~ # cat /etc/wpa_supplicant.conf
ctrl_interface=/run/wpa_supplicant
update_config=1
network={
ssid="buhman"
psk="world domination"
}
localhost ~ # wpa_cli
wpa_cli v2.0
Copyright (c) 2004-2012, Jouni Malinen <j@w1.fi> and contributors
This software may be distributed under the terms of the BSD license.
See README for more details.
Selected interface 'wlp1s0'
Interactive mode
> add_network
1
> set_network 1 ssid "starbucks"
OK
> set_network 1 key_mgmt NONE
OK
> list_networks
network id / ssid / bssid / flags
0 buhman any
1 starbucks any [DISABLED]
> enable_network 1
OK
<3>CTRL-EVENT-SCAN-RESULTS
<3>WPS-AP-AVAILABLE
<3>SME: Trying to authenticate with 3e:20:1d:c6:0e:d2 (SSID='starbucks' freq=2412 MHz)
<3>Trying to associate with 3e:20:1d:c6:0e:d2 (SSID='starbucks' freq=2412 MHz)
<3>Associated with 3e:20:1d:c6:0e:d2
<3>CTRL-EVENT-CONNECTED - Connection to 3e:20:1d:c6:0e:d2 completed [id=0 id_str=]
> save_config
OK
> quit
@Earnestly
Copy link

@LukeSwart That 125 limit sounds awful, have you reported these issues to hostap yet? That surely sounds like a bug, and moreover I agree that the requirement for associated numbers instead of SSID seems like very poor UI design.

@amarchandole
Copy link

My wireless interface does not get assigned an IPv6 link local address (which I am guessing should never be the case). I get to see the correct link-local once in a while but it vanishes after a reboot or network restart. I am using wpa_supplicant with nl80211 driver. I can connect two devices using p2p (wifi direct) and I wish to be able to ping one from another using the link-local IPv6 address.

@dsh2
Copy link

dsh2 commented Dec 31, 2020

@modulitos To find the number of a given ssid, you can grep for it in non-interactive mode like so wpa_cli list_networks | grep ssid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment