GithubHelp home page GithubHelp logo

wcon's Introduction

wcon - A modular WiFi connector using wpa_supplicant

Installation

Clone repository first:

$ git clone https://github.com/8ware/wcon.git
$ cd wcon

And then either symlink script:

$ ln -s "$PWD/bin/wcon.sh" ~/bin/wcon

Or add bin directory to $PATH:

$ PATH+=":$PWD/bin"

Configuration

The idea is to simply add a configuration for a new WiFi network instead of blowing up one big configuration file. Thus for each SSID a configuration file in the wpa_supplicant format (WPA_SUPPLICANT.CONF(5)) must be provided. The configuration is then choosen by the SSID using the $WCON_CONFIGS variable which is required to be declared as associative array whose keys are the SSIDs and its values the config files. The function load_configs "${paths[@]}" can be used to fulfill that requirement. In fact, that function assumes that the config files are named according to a <SSID>.conf schema. For example, the SSID Home will be represented by the config file Home.conf. For handling more complex SSIDs, i.e. SSIDs with non-alphanumeric characters, see function hook_beautify in section Example Configuration below. To avoid adding the common config to each file (e.g. ctrl_interface=/var/run/wpa_supplicant) a dedicated hook which prints the commonalities can be specified (see function hook_common_config below).

To avoid storing passwords in plain text within the configuration files the hook_password can be specified which expects the SSID and delivers the password for it.

Example Configuration

$ ls ${XDG_CONFIG_HOME:-~/.config}/wcon
common.conf     HomeSSID.conf     rc.sh     WorkSSID.conf

$ cat ${XDG_CONFIG_HOME:-~/.config}/wcon/rc.sh

CONFIG_HOME=$(dirname "$(readlink -f "$BASH_SOURCE")")

load_configs "$CONFIG_HOME"/*.conf
function hook_comon_config() {
	cat "$CONFIG_HOME/common.conf"
}

function hook_beautify_ssid() {
	echo ${1//[^[:alnum:]]}
}

# use password-store (http://www.passwordstore.org)
function hook_password() {
	pass "wifi/$1"
}

WCON_VERBOSITY=1 # can be set to any level, e.g. 5

Usage

Since in one location often a particular WiFi is used the SSID can be selected automatically by determining which available SSID is already configured. Thus the following command is sufficient to connect to the WiFi:

$ wcon

Further arguments are not recognized by now.

wcon's People

Watchers

 avatar  avatar

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.