1. 程式人生 > >WPAS是C/S結構中的Server端,linux平臺目前常用的Client端wpa_cli

WPAS是C/S結構中的Server端,linux平臺目前常用的Client端wpa_cli

wpa_supplicant是一個開源軟體專案,它實現了Station對無線網路進行管理和控制的功能。wpa_supplicant有兩個版本,分別是6和8。版本6中沒有網絡卡作為Soft AP相關原始碼。目錄結構如下:  ·hostapd:當手機進入Soft AP模式時,手機將扮演AP的角色,故需要hostapd來提供AP的功能。  ·wpa_supplicant:Station模式,也叫Managed模式。  ·src:hostapd和wpa_supplicant中都包含了一些通用的資料結構和處理方法,這些內容都放在此src目錄中。  以下凡是對wpa_supplicant都簡稱為WPAS

軟體架構 WPAS是C/S結構中的Server端,Linux/UNIX平臺中,Client端利用Unix域socket與其通訊。linux平臺目前常用的Client端wpa_cli(無介面的命令列程式)和wpa_gui(UI用Qt實現)。

我們就是仿照wpa_cli來做我們自己的連線程式。下面就來看看wpa_cli是如何工作的。

準備工作  先移植好WPAS,然後用如下命令啟動server端:  wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B  配置檔案/etc/wpa_supplicant.conf 可以先寫如下資訊 ctrl_interface=/var/run/wpa_supplicant 1 啟動成功後就可以執行wpa_cli客戶端了。  wpa_cli支援兩種模式:互動模式和命令列模式  互動模式就是直接執行wpa_cli,然後輸入各種命令即可

[email protected]

:~# wpa_cli wpa_cli v0.6.9 Copyright (c) 2004-2009, Jouni Malinen <[email protected]> and contributors

This program is free software. You can distribute it and/or modify it under the terms of the GNU General Public License version 2.

Alternatively, this software may be distributed under the terms of the BSD license. See README and COPYING for more details.

Selected interface 'wlan0'

Interactive mode

> status bssid=74:1f:4a:b2:e5:b3 ssid=QK-2 id=2 pairwise_cipher=WEP-104 group_cipher=WEP-104 key_mgmt=NONE wpa_state=COMPLETED ip_address=192.168.100.13 >  ---------------------  作者:濃咖啡jy  來源:CSDN  原文:https://blog.csdn.net/jy1075518049/article/details/51015141?utm_source=copy  版權宣告:本文為博主原創文章,轉載請附上博文連結!