Coder Social home page Coder Social logo

ewine-connectivity-manager's Introduction

Wifi Connectivity Manager

The app exposes a REST API to control wifi connectivity. Using the right network interface, it is possible to connect and disconnect from wifi networks, but also store and manage network configurations in /etc/network/interfaces and in a Sqlite3 database.

The app runs with Python 2.7.

Option 1: system install

Make sure pip is installed on your system, then set up the environment:

pip install -r requirements.txt

Launch the app by running the bash script: wifi_manager/interpreter/python_wifi.sh.

Option 2: venv install

Create a virtual environment and install the requirements:

virtualenv -p /usr/bin/python .venv
. .venv/bin/activate
pip install -r requirements.txt
deactivate

Launch the app by running the bash script: wifi_manager/interpreter/python_venv.sh.

REST API specification

The app listens by default on port 5000. Every request to the REST API must include the following header:

X-Api-Key: <API KEY HERE>

Here is a list of all API requests, the parameters they accept, and their purpose:

Request Parameters Purpose
GET /networks retrieve all network configurations stored in /etc/network/interfaces
GET /networks/gps retrieve all network configurations stored in /etc/network/interfaces, including GPS location
GET /ifaces retrieve all active network interfaces
GET /ifaces/addr retrieve all active network interfaces and their IP addresses
GET /scan/<iface> iface: the wifi network interface scan a network interface for available wifi networks
GET /status/<iface> iface: the wifi network interface find whether the given interface is connected to a network
GET /available/<iface> iface: the wifi network interface find the best Wi-Fi network available, if any
GET /location/<ssid> ssid: the name of the wifi network retrieve the location of a Wi-Fi network
POST /enable/<iface> iface: the wifi network interface enable a network interface
POST /disable/<iface> iface: the wifi network interface disable a network interface
POST /networks/<iface>:<ssid>:<lat>:<lng> iface: the wifi network interface; ssid: the name of the wifi network; lat: latitude; lng: longitude store the configuration of an open wifi network in /etc/network/interfaces
POST /networks/<iface>:<ssid>:<lat>:<lng>:<passkey> iface: the wifi network interface; ssid: the name of the wifi network; lat: latitude; lng: longitude; passkey: password of the secured wifi network store the configuration of a secured wifi network in /etc/network/interfaces
POST /connect/<iface>:<ssid>:<lat>:<lng> iface: the wifi network interface; ssid: the name of the wifi network; lat: latitude; lng: longitude connect to an open wifi network
POST /connect/<iface>:<ssid>:<lat>:<lng>:<passkey> iface: the wifi network interface; ssid: the name of the wifi network; lat: latitude; lng: longitude; passkey: password of the secured wifi network connect to a secured wifi network
DELETE /networks/<iface>:<ssid> iface: the wifi network interface; ssid: the name of the wifi network delete a network configuration from /etc/network/interfaces and sqlite database
DELETE /networks delete all network configurations from /etc/network/interfaces and sqlite database

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.