/command_ap

Send commands to configure 802.11 Hostapd

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Repository

This repository contains the python codes to control the thesis experiment. The codes are divided into the following directories

Dirs

  • cmd: contains the python codes for executing commands in the AP

  • publisher_subscriber: contains a test to create a publisher and a subscriber to be used with the command. The publisher runs command_ap.py, where each command in the API has a code. The subscriber subscribes to receive the information.

  • getter_setter: contains a test to create a http server that receives commands from a client. The client can send get or set commands. The server runs command_ap.py.

All other dirs are tests. Please don't use them

Install the AP

To install an AP and other wireless tools in Ubuntu use the following commands

sudo apt-get install hostapd
sudo apt-get install iw wireless-tools

Running the AP

To run the AP in a linux, you need the previous tools installed, and you need to configure the hostapd. The configuration file is hostapd.conf (see an example in the directory).

You will need to change the following fields in the file:

  • interface is wlan0 in my case, but you need to put here the name of your wireless interface
  • bssid is the mac address of your computer's wireless network card
  • channel set the channel number from 1 to 11 (in Brazil)
  • ssid defines the wifi network name
  • wpa_password is a string that defines the wifi network passphrase

Requisites

  • iw: The command uses iw to get and set some parameters in the wifi interface. It was tested using iw version 4.9 and 5.3 on Ubuntu. Notice that this tool comes with different versions depending on the Ubuntu's own version. Thus we recommend download and compile it from the source.
git clone git://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git
cd iw
make
sudo make install

Python dependencies

sudo -H python3 -m pip install pip --upgrade
sudo -H python3 -m pip install numpy scipy sklearn
sudo -H python3 -m pip install six requests html5lib urllib 
sudo -H python3 -m pip install matplotlib seaborn
sudo -H python3 -m pip install tables natsort
sudo -H python3 -m pip install tensorflow
sudo -H python3 -m pip install keras

If you get ERROR: Cannot uninstall 'six', remove the OS package, using

sudo apt-get remove python-six

If you get ERROR:: Could not find a local HDF5 installation, then:

apt-get install hdf5-tools libhdf5-7 libhdf5-dev