All Projects → rohbotics → pifi

rohbotics / pifi

Licence: other
A headless wifi provisioning system.

Programming Languages

python
139335 projects - #7 most used programming language
EmberScript
38 projects

Projects that are alternatives of or similar to pifi

Tortipi
Tor based Raspberry π hotspot
Stars: ✭ 76 (+90%)
Mutual labels:  wifi-hotspot, raspberry-pi-3
Mili
Mili is an open source tool for auto login hotspot pages! (MacOS + Linux)
Stars: ✭ 162 (+305%)
Mutual labels:  wifi-hotspot
espresso-portal
FreeWifi PHP Portal for ubiquiti controller
Stars: ✭ 40 (+0%)
Mutual labels:  wifi-hotspot
Hostapd
Script for compiling, patching and packing hostapd from sources
Stars: ✭ 36 (-10%)
Mutual labels:  wifi-hotspot
Kupiki Hotspot Script
Create automatically a full Wifi Hotspot on Raspberry Pi including a Captive Portal
Stars: ✭ 265 (+562.5%)
Mutual labels:  wifi-hotspot
wifi-connect
Easy WiFi setup for Linux devices from your mobile phone or laptop
Stars: ✭ 1,043 (+2507.5%)
Mutual labels:  wifi-hotspot
pyaccesspoint
Package to manage accesspoint on linux
Stars: ✭ 25 (-37.5%)
Mutual labels:  wifi-hotspot
warpi
"GUI" script running on a Raspberry Pi 4
Stars: ✭ 29 (-27.5%)
Mutual labels:  raspberry-pi-3
Upribox
Usable Privacy Box
Stars: ✭ 153 (+282.5%)
Mutual labels:  wifi-hotspot
Wifi Connect
Easy WiFi setup for Linux devices from your mobile phone or laptop
Stars: ✭ 883 (+2107.5%)
Mutual labels:  wifi-hotspot
Raspberry Pi Turnkey
How to make a Raspberry Pi image that can be deployed anywhere and assigned to a WiFi network without SSH 👌
Stars: ✭ 682 (+1605%)
Mutual labels:  wifi-hotspot
Daloradius
daloRADIUS is an advanced RADIUS web management application aimed at managing hotspots and general-purpose ISP deployments. It features user management, graphical reporting, accounting, a billing engine and integrates with GoogleMaps for geo-locating.
Stars: ✭ 368 (+820%)
Mutual labels:  wifi-hotspot
Linux Router
Set Linux as router in one command. Support Internet sharing, redsocks, Wifi hotspot, IPv6. Can also be used for routing VM/containers
Stars: ✭ 129 (+222.5%)
Mutual labels:  wifi-hotspot
Sharethem
File Sharing & Transfer made a lot easier
Stars: ✭ 181 (+352.5%)
Mutual labels:  wifi-hotspot
Wifiutils
Easily Connect to WiFi Networks
Stars: ✭ 449 (+1022.5%)
Mutual labels:  wifi-hotspot
anon-hotspot
On demand Debian Linux (Tor) Hotspot setup tool
Stars: ✭ 34 (-15%)
Mutual labels:  wifi-hotspot
Virtualrouter
Original, open source Wifi Hotspot for Windows 7, 8.x and Server 2012 and newer
Stars: ✭ 53 (+32.5%)
Mutual labels:  wifi-hotspot
nrf24
nrf24l01 linux device driver
Stars: ✭ 20 (-50%)
Mutual labels:  raspberry-pi-3
Openwisp Radius
Administration web interface and REST API for freeradius 3 build in django & python. Supports captive portal authentication, WPA Enerprise (802.1x), freeradius rlm_rest, social login, Hotspot 2.0 / 802.11u, importing users from CSV, registration of new users and more.
Stars: ✭ 206 (+415%)
Mutual labels:  wifi-hotspot
Wififlutter
Plugin Flutter which can handle WiFi connections (AP, STA)
Stars: ✭ 142 (+255%)
Mutual labels:  wifi-hotspot

pifi

A headless wifi provisioning system, primarily designed for robots with Raspberry Pi's.

Build Status Coverage Status

Pifi uses NetworkManager to do the heavy lifting under the hood.

The command line tool is pifi:

Usage:
  pifi status                   Shows if the device is in AP mode or connected to a network
  pifi add <ssid> <password>    Adds a connection to scan/connect to on bootup (needs sudo)
  pifi remove <ssid>            Remove this network (may interfere with ssh)
  pifi list seen                Lists the SSIDs that see seen during bootup
  pifi list pending             Lists the SSIDs that still need to configured in NetworkManager
  pifi set-hostname <hostname>  Set the hostname of the system, also deletes existing AP mode configurations
  pifi --version                Prints the version of pifi on your system

Options:
  -h --help    Show this help message and exit
  --version    Show pifi version and exit

Pifi runs a script at boot up that does the following by default:

  • Determine if there is wifi device capable of access point mode
  • Scan for visible access points, and save the SSIDs to /var/lib/pifi/seen_ssids
  • Go through any pending connections in /var/lib/pifi/pending, and see if any are visiable
  • If any of the pending connections are visible, connect to them, and remove them from pending
  • Otherwise look for an existing AP mode definiton and start it
  • If there is no existing AP mode definition create one with the configuration in /etc/pifi/default_ap.em (SSID:<HOSTNAME><4HEX> and password:'robotseverywhere'). (Where <HOSTNAME> is the hostname of the system and <4HEX> is the last 4 digits of the device mac address.)
  • If AP mode was not started, and a button is configured, wait for a button press to start AP mode

Connecting to a network while in AP mode

Connect to the ap mode wifi (default <HOSTNAME><4HEX>, password robotseverywhere) on your laptop. (Where <HOSTNAME> is the hostname of the system and <4HEX> is the last 4 digits of the device mac address.)

SSH into the device with ssh [email protected].

Once logged into the device, run sudo pifi add WIFI_SSID PASSWORD, and reboot sudo reboot.

Your device should now be connected to your network.

Using a Button to Start AP Mode

When pifi starts without AP mode (because it connected to an existing network), if there is an input device specified in pifi.conf it will wait for a KEY_CONFIG press and start AP mode.

On Magni, the input device is the gpio-keys driver, connected to a button on the sonar board. This allows the button to show up as a input device, with a name specified in the device tree file. The same name should be specified in pifi.conf, so that pifi can grab that device and listen for events. On a event that matches a KEY_CONFIG press,

Installation

The recommended way to install is from debs. The apt source at https://packages.ubiquityrobotics.com/ has the packages.

If that source is configured on your system, simply run sudo apt install pifi.

To install from source, run sudo pip3 install . in the pifi directory after cloning this repo.

Dependencies

Note: Don't worry about dependencies if you are installing from debs, they will be installed automatically.

This package depends on python3-networkmanager, python3-empy, and python3-yaml.

python3-networkmanager is not availible in the standard ubuntu/debian repos, so you will have install it from pip3 install python-networkmanager, or use the debian package from https://packages.ubiquityrobotics.com/. More info here

Configuration

If you want to change the behavior of pifi, a few options are availible to tweak.

The main configuration file is a YAML file at /etc/pifi/pifi.conf.

The default configuration file is:

# YAML configuration file for pifi

# Should pifi delete other ap mode configurations in NetworkManager?
# Default: True
# If true, during the next boot where there are no networks availble 
# pifi will delete existing connections, and create a new default one
delete_existing_ap_connections: True

# The network interface to use for AP mode
# Default: any
# If set to any pifi will pick one automatically
ap_device: any

# The network interface to use for connecting out
# Default: any
# If set to any pifi will pick one automatically
client_device: any

# Path to a Linux LED device to use
# ex: /sys/class/leds/led0
status_led: None

# Name of a user input device to use
# ex: "Keyboard 5"
button_device_name: None

The settings of the default AP that pifi creates are also configurable. /etc/pifi/default_ap.em contains and empy template of the json that represents the connection settings.

The varibles passed into the template are the hostname of the system (hostname), the MAC address of the device (mac), and a newly generated UUIDv4 (uuid_str).

This is the default configuration:

{
    "connection": {
        "id": "Pifi AP Mode",
        "type": "802-11-wireless",
        "autoconnect": "False",
        "uuid": "@(uuid_str)"
    },

    "802-11-wireless": {
        "mode": "ap",
        "security": "802-11-wireless-security",
        "ssid": "@(hostname)@(mac.replace(":", "")[-4:])"
    },

    "802-11-wireless-security": {
        "key-mgmt": "wpa-psk",
        "psk": "robotseverywhere"
    },

    "ipv4": {
        "method": "shared"
    },
    "ipv6": {
        "method": "ignore"
    }
}

Empy uses the template format @() with python expressions inside of the parenthesis.

The mac.replace(":", "")[-4:] gets the last 4 digits of the MAC address after removing colons.

Interfacing

Your code can interface with pifi via the files in /var.

/var/lib/pifi/pending is a JSON file that contains a list of wifi connections that should be activated. The connections should be JSON serializations of the NetworkManager connection configuration.

Example contents of /var/lib/pifi/pending:

[
  {
    "ipv4": {
      "method": "auto"
    },
    "802-11-wireless-security": {
      "key-mgmt": "wpa-psk",
      "psk": "supersecurepassword"
    },
    "connection": {
      "type": "802-11-wireless",
      "autoconnect": true,
      "id": "wifi",
      "uuid": "ce17378f-b187-48ab-af93-48613e88a5e5"
    },
    "802-11-wireless": {
      "mode": "infrastructure",
      "ssid": "wifi",
      "security": "802-11-wireless-security"
    },
    "ipv6": {
      "method": "auto"
    }
  }
]

/var/lib/pifi/seen_ssids is a plain text file with the list of SSIDs seen when pifi was starting up, as many cards can't scan once they start AP mode.

Example contents of file:

xfinitywifi
xfinitywifi
xfinitywifi
Aleopile
Jhuangdds
Requilme-CA2
Linksys New
xfinitywifi
Aleopile
Jhuangdds
Requilme-CA2
ATT9C8eh3A
HOME-616E-2.4
HOME-99EB
linksys
xfinitywifi

Notice that the SSIDs can be duplicated (there will be one entry per AP).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].