Linux Wi-Fi software connection

There are several questions regarding this functionality for Android or iOS, but I'm trying to do it on Linux (in particular for OpenWrt 15.05). I want to scan wireless networks, present the list to the user, select them and send username / password to the network.

I wrote a quick C program using iw_scan from the wireless_tools package, so I can see the wireless networks, but I'm having trouble trying to figure out how to connect to the wireless network. iwconfig from the same package is simply trying to modify an existing connection.

I spent several hours browsing the web and there should be a package that already does this, as this is such a common use case. Does anyone know one thing?

Thanks.

+4
source share
2 answers

wpa_supplicant

See the wpa_supplicant package. It includes a daemon wpa_supplicantthat can be controlled using utilities wpa_cliand wpa_guior the D-Bus API .

Programs, such as wicdand Network Manager, are used wpa_supplicantinternally.


Networkmanager

You can also use the D-Bus API or the command line interface ( nmcli) for . It provides a higher level abstraction than . NetworkManagerwpa_supplicant

+2
source

: wicd CLI nmcli, wifi python. , , python wifi , . , bash script wpa (WEP ), wpa_passphrase wpa_supplicant:

sudo apt-get install -y wireless-tools wpasupplicant expect macchanger
sudo wget -O /usr/local/bin/wifi-connect https://raw.githubusercontent.com/erjoalgo/erjoalgo-gnu-scripts/master/wifi-connect
sudo chmod +x /usr/local/bin/wifi-connect
wifi-connect -e Internet -p my-password

wpa-passphrase /etc/wpa-connect, ESSID , . iface mac macchanger.

0

Source: https://habr.com/ru/post/1607019/


All Articles