We have developed a docker container that allows the compilation and development of ethanol agents. This is the method we recommend for you to compile (and change) Ethanol. The container already makes the clone of this repository (ethanol_hostapd). To see more go to ethanol_devel.
The development of ethanol agent for linux environments is based on hostapd and calls to nl80211 (as done by iw). The ethanol agent (in hostapd) requires that the iw command, generated in this repository (see iw-4.9 directory), to be copied to the same directory where hostapd will be installed. It is also necessary the file my_cert.pem (located in certificate) to be in the same directory as hostapd. To set up ethanol (hostapd), you need to create the /etc/ethanol.ini file. An example of this file can be seen inside the hostapd-2.6/src/ini directory. The most important option of this file is enabled. It controlls whether ethanol features will be active or not on Ethanol's hostapd.
Ethanol uses the libnl library that is deprecated on newer versions of Ubuntu (15+). It only exists until version 14.04 of Ubuntu. So if you want to use Ethanol without having to make your own modifications to make it work, you should use up to Ubuntu LTS 14.04.5 (last check 06/26/2017).
If you don't want to use the docker container, you can configure the environment and install our files on your own.
To download this repository, you need to have git installed. For this use the command below to install. We suggest installing gitk for a graphical interface (second line below):
sudo apt-get install git
sudo apt-get install gitk git-gui
With git installed, go to the desired directory (for example, your home directory) and issue the following commands to download and update submodules:
cd ~
mkdir ethanol
cd ethanol
git clone https://github.com/h3dema/ethanol_hostapd.git
cd ethanol_hostapd
git submodule update --init --recursive
In the root of this repository we find the directory documentation. This directory contains the series of files with ethanol's hostapd documentation. They provide some guidelines for development of Ethanol, as well as other information for installation and preparation of the development environment.
In addition we provide in the doxygen directory a series of html files with documentation generated by the doxygen application on hostapd. To access this information open your preferred browser and open the doxygen/index.html file. You will see all the files that make up the hostapd modified.
We need to prepare the environment for the compilation and execution of ethanol. Some tools and libraries are required. Run the following commands to install them.
sudo apt-get install -y libnl-dev libnl1
sudo apt-get install -y libssl-dev
sudo apt-get install -y libiw-dev
sudo apt-get install -y curl libcurl3 libcurl3-dev
sudo apt-get install -y wireless-tools
The Ethanol access point version is a hostapd modification. In the root of this repository we find the directory hostapd-2.6, which is a fork of the linux's hostapd. This directory is not updated from the internet. Modifications in it are local to the Ethanol project. The source files are used to make the adaptations in hostapd-2.6/hostapd/main.c and many other files For example, we changed in src/ap/ieee802_11.c the funcion ieee802_11_mgmt() where hostapd deals with users' association, authentication, reassociation, disassociation, and deauthentication.
To compile hostapd's version with ethanol, after downloading the repository, do
cd ~/ethanol/ethanol_hostapd/hostapd-2.6/hostapd
make clean
make ethanol
Two executables will be generated: hostapd and hostapd_cli. The first one is the program that contains the ethanol agent for wireless networks. The other one is a client that allows to configure hostapd. This is an unmodified version of hostapd_cli.
We use an adapted version of iw-4.9. The modified source code is in the iw-4.9 directory.
Many of the operations using nl80211 are similar to those found in the iw program, which can be used to identify calls to nl80211. IW is the best documentation found on the subject. On the iw, refer to the https://wireless.wiki.kernel.org/en/users/documentation/iw link.
cd ~/ethanol/ethanol_hostapd/iw-4.9
sudo apt-get install libnl-dev libnl1
make clean
make ethanol
The installation of iw (from the source code) can be done with make install.
To run Ethanol's hostapd you need to put in the same directory the following files:
- the modified version of hostapd -- this file is generated in the hostadp directory of this repository.
- the certificate -- you can use your own certificate or ours. You will find our in certificate directory of this repository. In the README you will find instructions to generate your own file.
- the modified version of iw -- You will find the source code in iw-4.9 directory.
- ethanol.ini -- this file should be copied to /etc directory. A sample file can be found in src/ini directory in this repository.
- hostapd.conf -- this is the configuration file of hostapd. You will find a sample file in this repository.
To run hostapd:
$ sudo hostapd ./hostapd.conf
We appreciate your understanding due to the existence of some comments that still remain in Portuguese in the program code. If you find something that needs our attention, please register it in Issues.