• Stars
    star
    333
  • Rank 126,599 (Top 3 %)
  • Language
    Python
  • License
    GNU Affero Genera...
  • Created about 6 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Python application for Linux machines to perform WiFi site surveys and present the results as a heatmap overlayed on a floorplan

python-wifi-survey-heatmap

Project Status: Inactive – The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows. Docker Hub Build Status

A Python application for Linux machines to perform WiFi site surveys and present the results as a heatmap overlayed on a floorplan.

This is rather rough "beta" code. The heatmap generation code is roughly based on Beau Gunderson's MIT-licensed wifi-heatmap code.

Many thanks to DL6ER who contributed a massive amount of improvements to this project.

Quick start

Check out the Running In Docker steps below to get single-line commands that run without the need to install anything on your computer (thanks to using docker). Creating a heatmap using the software consists of the following three essential steps:

  1. Start an iperf3 server on any machine in your local network. This server is used for bandwidth measurements to be independent of your Internet connection. When omitting the --server option, this may be skipped, however, be aware that the performance heatmaps tpyically are the icing on the cake of your measurement and are very useful in determining the real performance of your WiFi.
  2. Use the wifi-survey tool to record a measurement. You can load a floorplan and click on your current location ot record signal strength and determine the achievable bandwidth.
  3. Once done with all the measurements, use the wifi-heatmap tool to compute a high-resolution heatmap from your recorded data. In case your data turns out to be too coarse, you can always go back to step 2 and delete or move old and also add new measurements at any time.

Installation and Dependencies

NOTE: These can all be ignored when using Docker. DOCKER IS THE RECOMMENDED INSTALLATION METHOD. See below.

  • The Python iperf3 package, which needs iperf3 installed on your system.
  • The Python libiw package.
  • wxPython Phoenix, which unfortunately must be installed using OS packages or built from source.
  • An iperf3 server running on another system on the LAN, as described below is recommended but optional.

Recommended installation is via python setup.py develop in a virtualenv setup with --system-site-packages (for the above dependencies).

Tested with Python 3.7.

Data Collection

At each survey location, data collection should take 45-60 seconds. The data collected is currently:

  • 10-second iperf3 measurement, TCP, client (this app) sending to server, default iperf3 options [optional, enable with --server]
  • 10-second iperf3 measurement, TCP, server sending to client, default iperf3 options [optional, enable with --server]
  • 10-second iperf3 measurement, UDP, client (this app) sending to server, default iperf3 options [optional, enable with --server]
  • Recording of various WiFi details such as advertised channel bandwidth, bitrate, or signal strength
  • Scan of all visible access points in the vicinity [optional, enable with --scan]

Hints: - The duration of the bandwidth measurement can be changed using the --duration argument of wifi-survey. This has great influence on the actual length of the individual data collections. - Scanning for other network takes rather long. As this isn't required in most cases, it is not enabled by default

Usage

Server Setup

On the system you're using as the iperf3 server, run iperf3 -s to start iperf3 in server mode in the foreground. By default it will use TCP and UDP ports 5201 for communication, and these must be open in your firewall (at least from the client machine). Ideally, you should be running the same exact iperf3 version on both machines.

Performing a Survey

The survey tool (wifi-survey) must be run as root or via sudo in order to use iwconfig/iwlist (or via Docker; see below).

First connect to the network that you want to survey. Then, run sudo wifi-survey where:

Command-line options include:

  • -i INTERFACE / --interface INTERFACE is the name of your Wireless interface (e.g. wlp3s0)
  • -p PICTURE / --picture PICTURE is the path to a floorplan PNG file to use as the background for the map; see examples/example_floorplan.png for an example. In order to compare multiple surveys it may be helpful to pre-mark your measurement points on the floorplan, like `examples/example_with_marks.png <examples/example_with_marks.png`_. The UI currently loads the PNG at exact size, so it may help to scale your PNG file to your display.
  • -t TITLE / --title TITLE is the title for the survey (such as the network name or AP location), which will also be used to name the data file and output files.
  • -s IPERF3_SERVER / --server IPERF3_SERVER to enable iperf3 scans. The generated speed heatmaps are very useful (much more useful than signal strength) in visualizing the real performance of your network as they are live measurements with real data (instead of only theoretical values).
  • -S / --scan to enable wireless scaning at the end of each measurement. This may take a lot of time, however, generates data used later for generating channel utilization graphs. If you're using a modern wireless product that allows running RF scans, it makes sense to use that data instead of these scans.
  • -b BSSID / --bssid BSSID allows you to specify a single desired BSSID for your survey. This will be checked several times during of every measurement, and the measurement will be discarded if you're connected to the wrong BSSID. This can be useful as a safeguard to make sure you don't accidentally roam to a different AP.
  • -d 123 / --duration 123 allows you to change the duration of each individual iperf3 test run (default is 10 seconds as mentioned above)
  • --ding FILENAME will play the audio file at FILENAME when each measurement point is complete. See Playing A Sound When Measurement Finishes below for details.

If TITLE.json already exists, the data from it will be pre-loaded into the application; this can be used to resume a survey.

When the UI loads, you should see your PNG file displayed. The UI is really simple:

  • If you (left / primary) click on a point on the PNG, this will begin a measurement (survey point). The application should draw a yellow circle there. The status bar at the bottom of the window will show information on each test as it's performed; the full cycle typically takes a minute or a bit more. When the test is complete, the circle should turn green and the status bar will inform you that the data has been written to Title.json and it's ready for the next measurement. If iperf3 encounters an error, you'll be prompted whether you want to retry or not; if you don't, whatever results iperf was able to obtain will be saved for that point.
  • The output file is (re-)written after each measurement completes, so just exit the app when you're finished (or want to resume later; specifying the same Title will load the existing points and data from JSON).
  • Right (secondary) clicking a point will allow you to delete it. You'll be prompted to confirm.
  • Dragging (left/primary click and hold, then drag) an existing point will allow you to move it. You'll be prompted to confirm. This is handy if you accidentally click in the wrong place.

At the end of the process, you should end up with a JSON file in your current directory named after the title you provided to wifi-survey (Title.json) that's owned by root. Fix the permissions if you want.

Note: The actual survey methodology is largely up to you. In order to get accurate results, you likely want to manually handle AP associations yourself. Ideally, you lock your client to a single AP and single frequency/band for the survey.

Playing A Sound When Measurement Finishes

It's possible to have wifi-survey play a sound when each measurement is complete. This can be handy if you're reading or watching something in another window while waiting for the measurements.

To enable this, call wifi-survey with the --ding argument, passing it the path to an audio file to play. A short sound effect is included in this repository at wifi_survey_heatmap/complete.oga and can be used via --ding wifi_survey_heatmap/complete.oga. by default, this will call /usr/bin/paplay (the PulseAudio player) passing it the ding file path as the only argument. The command used can be overridden with --ding-command /path/to/command but it must be one that accepts the path to an audio file as its only argument.

Inside Docker, however, this becomes quite a bit more difficult. Currently PulseAudio systems are supported, and this can be set up and enabled with the following steps:

1. Find your host computer's IP address on the docker0 network: ip addr show dev docker0 - mine (and most Linux machines) is 172.17.0.1 1. Find the CIDR block of your docker0 network. I do this using ip route show dev docker0, which gives me a CIDR of 172.17.0.0/16 1. Have PulseAudio listen on a TCP socket, allowing connections from your Docker network: pactl load-module module-native-protocol-tcp port=34567 auth-ip-acl=172.17.0.0/16 1. If you have iptables restricting traffic, insert a rule allowing traffic on port 34567 from Docker before your DROP rule. For example, to insert a rule at position 5 in the INPUT chain: iptables -I INPUT 5 -s 172.17.0.0/16 -p tcp -m multiport --dports 34567 -m comment --comment "accept PulseAudio port 34567 tcp from Docker" -j ACCEPT 1. When running the Docker container, add -e "PULSE_SERVER=tcp:172.17.0.1:34567" to the docker run command. 1. When running wifi-survey, add the --ding argument as specified above. Note that the path to the file must be inside the container; you can put an audio file in your current directory and use it via --ding /pwd/audioFile or you can use the default file built-in to the container via --ding /app/wifi_survey_heatmap/complete.oga

Heatmap Generation

Once you've performed a survey with a given title and the results are saved in Title.json, run wifi-heatmap TITLE to generate heatmap files in the current directory. This process does not require (and shouldn't have) root/sudo and operates only on the JSON data file. For this, it will look better if you use a PNG without the measurement location marks.

You can optionally pass the path to a JSON file mapping the access point MAC addresses (BSSIDs) to friendly names via the -a / --ap-names argument. If specified, this will annotate each measurement dot on the heatmap with the name (mapping value) and frequency band of the AP that was connected when the measurement was taken. This can be useful in multi-AP roaming environments.

The end result of this process for a given survey (Title) should be some .png images in your current directory:

  • channels24_TITLE.png - Bar graph of average signal quality of APs seen on 2.4 GHz channels, by channel. Useful for visualizing channel contention. (Based on 20 MHz channel bandwidth)
  • channels5_TITLE.png - Bar graph of average signal quality of APs seen on 5 GHz channels, by channel. Useful for visualizing channel contention. (Based on per-channel bandwidth from 20 to 160 MHz)
  • signal_quality_TITLE.png - Heatmap based on the received signal strength.
  • tx_power_TITLE.png - Heatmap based on the transmitter power your WiFi card used. If your WiFi card doe snot support adaptive power management, this number will stay constant.
  • tcp_download_Mbps_TITLE.png - Heatmap of iperf3 transfer rate, TCP, downloading from server to client.
  • tcp_upload_Mbps_TITLE.png - Heatmap of iperf3 transfer rate, TCP, uploading from client to server.
  • udp_download_Mbps_TITLE.png - Heatmap of iperf3 transfer rate, UDP, downloading from server to client.
  • udp_upload_Mbps_TITLE.png - Heatmap of iperf3 transfer rate, UDP, uploading from client to server.
  • jitter_download_TITLE.png - Heatmap based on UDP jitter measurement in milliseconds.
  • jitter_upload_TITLE.png - Heatmap based on UDP jitter measurement in milliseconds.
  • frequency_TITLE.png - Heatmap of used frequency. May reveal zones in which Wi-Fi steering moved the device onto a different band (2.4GHz / 5 GHz co-existance).
  • channel_bitrate_TITLE.png - Heatmap of negotiated channel bandwidth

If you'd like to synchronize the colors/thresholds across multiple heatmaps, such as when comparing different AP placements, you can run wifi-heatmap-thresholds passing it each of the titles / output JSON filenames. This will generate a thresholds.json file in the current directory, suitable for passing to the wifi-heatmap -t / --thresholds option.

Add --show-points to see the measurement points in the generated maps. Typically, they aren't important when you have a sufficiently dense grid of points so they are hidden by default.

Running In Docker

Survey

Note the

docker run \
  --net="host" \
  --privileged \
  --name survey \
  -it \
  --rm \
  -v $(pwd):/pwd \
  -w /pwd \
  -e DISPLAY=$DISPLAY \
  -v "$HOME/.Xauthority:/root/.Xauthority:ro" \
  jantman/python-wifi-survey-heatmap \
  wifi-survey -b <BSSID> -i <INTERFACE> -s <IPERF SERVER> -p <FLOORPLAN PNG> -t <TITLE>

Note that running with --net="host" and --privileged is required in order to manipulate the host's wireless interface.

Heatmap

docker run -it --rm -v $(pwd):/pwd -w /pwd jantman/python-wifi-survey-heatmap:23429a4 wifi-heatmap <TITLE>

iperf3 server

Server: docker run -it --rm -p 5201:5201/tcp -p 5201:5201/udp jantman/python-wifi-survey-heatmap iperf3 -s

Examples

Floorplan

example floorplan image

Floorplan with Measurement Marks

example floorplan image with measurement marks

2.4 GHz Channels

example 2.4 GHz channel usage

5 GHz Channels

example 5 GHz channel usage

Jitter

example jitter heatmap

Quality

example quality heatmap

RSSI / Signal Strength

example rssi heatmap

TCP Download Speed (Mbps)

example tcp download heatmap

TCP Upload Speed (Mbps)

example tcp upload heatmap

UDP Upload Speed (Mbps)

example udp upload heatmap

Issues

If you see:

Couldn't connect to accessibility bus: Failed to connect to socket /run/user/1000/at-spi/bus_0: No such file or directory

when running in docker, mount the socket in docker explicitly by adding an additional -v switch:

docker run ... -v /run/user/1000/at-spi/bus_0:/run/user/1000/at-spi/bus_0 ...

More Repositories

1

awslimitchecker

A script and python package to check your AWS service limits and usage via boto3.
Python
515
star
2

repostatus.org

A standard to easily communicate to humans and machines the development/support and usability status of software repositories/projects.
Python
160
star
3

misc-scripts

A collection of my standalone scripts to small/quick for their own repos. All kinds of useful stuff.
Python
132
star
4

biweeklybudget

Responsive Flask/SQLAlchemy personal finance app, specifically for biweekly budgeting.
Python
96
star
5

xfinity-usage

Python/selenium script to get Xfinity bandwidth usage
Python
64
star
6

puppet-archlinux-macbookretina

UNSUPPORTED - Puppet module and accompanying documentation to install/setup Arch linux on a MacBook Pro Retina 11,4
Ruby
64
star
7

home-automation-configs

home automation/security config/scripts/tooling - HomeAssistant, AppDaemon, ZoneMinder, etc.
37
star
8

vagrant-r10k

UNSUPPORTED - SEEKING MAINTAINER - Vagrant middleware plugin to retrieve puppet modules using r10k.
Ruby
35
star
9

serverspec-extended-types

A set of extended types for ServerSpec 2.x
Ruby
28
star
10

pizero-gpslog

Raspberry Pi Zero gpsd logger with status LEDs
Python
27
star
11

pypi-download-stats

ABANDONED - Calculate detailed download stats and generate HTML and badges for PyPI packages
Python
24
star
12

vault-aws-creds

Python helper to export Vault-provided temporary AWS creds into the environment
Python
21
star
13

puppet-archlinux-workstation

Puppet module for configuring various aspects of an Arch Linux workstation/desktop.
Ruby
17
star
14

workstation-bootstrap

My r10k/puppet based workstation bootstrapping and configuration
Ruby
17
star
15

archautorepo

ABANDONED - Automatic Arch Linux package rebuilds and repository creation.
Python
17
star
16

nagios-scripts

A collection of my Nagios check scripts, and related stuff.
Perl
11
star
17

blog

my blog
HTML
11
star
18

scantool.net

ScanTool.net's GPLv2 cross-platform OBDII software, "scantool.net"
C
11
star
19

pydnstest

ABANDONED - Python tool for testing DNS changes (add, remove, rename, change records) against a staging DNS server, verifying the same changes against production, or confirming that a record returns the same result in both environments.
Python
11
star
20

python-amcrest-noauth-proxy

ABANDONED - Python/Flask reverse proxy server that removes HTTP Digest auth from Amcrest IP cameras; Docker image provided
Shell
10
star
21

php-nagios-xml

This is a PHP script that parses the Nagios status.dat file into an array, and then outputs that array as XML. There is also a PHP module written in C to do the same task, and based on the same code.
PHP
8
star
22

puppet-facter-facts

a collection of facts for user with Facter and Puppet
Ruby
8
star
23

docker-twilio-ppp-proxy

Docker container to proxy HTTP via USB PPP modem using Twilio Programmable Wireless
Shell
7
star
24

multibindadmin

A web-based (PHP) tool for managing BIND DNS zone files, with builtin understanding of split-horizon DNS with NAT (i.e. a name can have an internal address and an external address).
PHP
6
star
25

webhook2lambda2sqs

ABANDONED - Generate code and manage infrastructure for receiving webhooks with AWS API Gateway and pushing to SQS via Lambda.
Python
6
star
26

nodemeister

NodeMeister is an External Node Classifier (ENC) for Puppet, written in Python using the Django framework. It supports hierarchical groups, exclusions and overrides, and aims to provide a fully-functional ENC for those more comfortable with Python.
Python
6
star
27

kvmdash

kvmdash is a simple Python daemon and web app to collect information about libvirt-controlled qemu/kvm guest VMs running on standalone hosts, ans present the information on a single web page (with a simple API). It will also include a companion Puppet module for installation, and Facter facts that make use of the data.
HTML
5
star
28

docker-zoneminder

Modern, best-practices Debian-based Zoneminder container
Perl
5
star
29

docker-debian-mongodb24

Debian-based Docker image with MongoDB 2.4 server.
4
star
30

gw2copilot

A Python-based GuildWars2 helper tool
Python
4
star
31

ecsjobs

A scheduled job wrapper for ECS, focused on email reporting and adding docker exec and local command abilities.
Python
3
star
32

specfiles

A collection of my RPM spec files
Python
3
star
33

SwitchSNMP

A collection of PHP classes and scripts to communicate with and control network devices via SNMP.
PHP
3
star
34

php-ems-tools

Web-based Patient Care Report and organization management software for volunteer Emergency Medical Services. Largely unusable, just an example.
PHP
3
star
35

git-clone-sync

Script to keep git clones in sync with origin and upstream
Python
3
star
36

kvmdashclient

Python client script for the kvmdash application.
Python
3
star
37

TuxTruck-wxPython

TuxTruck-wxPython was a project to creat a wxPython/Linux-based in-vehicle PC platform. It currently has an audio player and not much else.
Python
3
star
38

RPyMostat

A python-based intelligent home thermostat, targeted at the RaspberryPi.
Python
2
star
39

alexa-skill-trello-todo-list

Alexa skill to read your Trello todo list and add items to it
Python
2
star
40

versionfinder

Python package to find the version of another package, whether installed via pip, setuptools or git
Python
2
star
41

tuxtruck

Aborted attempt at a Python/Linux-based CarPC platform. Some of the OBD and GPS code might be useful, and there's Python code to read the accelerometer on a SunSPOT.
Python
2
star
42

jiveapi

ABANDONED - Simple and limited Python client for Jive collaboration software ReST API v3, along with utilities for massaging HTML to display better on Jive.
Python
2
star
43

userscripts

ABANDONED - Some of my UserScripts
JavaScript
2
star
44

rackman

An old PHP project to track machines' locations in a rack, diagram them, and preview changes.
PHP
2
star
45

python-package-skeleton

Skeleton for a python package, complete with tox/Travis-CI, Landscape.io, codecov, etc.
Python
2
star
46

autosimulationcraft

A python script to run SimulationCraft reports for World of Warcraft characters when their gear/stats/level/etc. changes.
Python
2
star
47

piface-webhooks

Python script/daemon to read RPi PiFace inputs and run a webhook when they change
Python
1
star
48

RPyMostat-ui

Web UI for RPyMostat Project.
1
star
49

RPyMostat-control

Relay control portion of the RPyMostat project.
Python
1
star
50

CFDash

A simple dashboard for CloudFormation stack metrics from CloudWatch.
JavaScript
1
star
51

pypuppetdb-daily-report

ABANDONED - Daily run summary report for PuppetDB, written in Python using nedap's pypuppetdb module.
Python
1
star
52

hiking-logs

GPS tracks and other info from my hikes
JavaScript
1
star
53

s3sfe

Sync a list of files to S3, using server-side encryption with customer-provided keys
Python
1
star
54

rpmbuild-vagrant-boxes

A collection of Vagrantfiles for boxes to build RPMs
Ruby
1
star
55

BoardTest

Testing various GitHub kanban boards
Python
1
star
56

laser-cutter-projects

Things I've made on the GlowForge laser cutter
G-code
1
star
57

kbdtest

wxPython tool for testing keyboards on Linux/Mac/Unix operating systems
Python
1
star
58

PHPsa

This is really the skeleton of a defunct project from a few years ago. In retrospect, PHP was almost certainly the wrong language to use for this (compared to pretty much any modern web language, but especially because of its scoping issues). I'm leaving it here only to pay homage to the idea of it, which still might have some usefulness.
PHP
1
star
59

franz-recipe-pushover

meetfranz.com (Franz 5) recipe for Pushover
JavaScript
1
star
60

micropython-esp32-pulse-generator

MicroPython project to use an ESP32 as a pulse generator
Python
1
star
61

ec2-utils-el7

Amazon Linux ec2-utils for EL7
Shell
1
star
62

python-obd

Some OBD code for Python. Old and crappy, but putting it here in case I need it again.
HTML
1
star
63

xmlfinal

My final project from my Building Data-Driven Websites undergrad course. Here for nostalgia.
PHP
1
star
64

gitlab-scripts

Some scripts to help administering and migrating to GitLab
Python
1
star
65

howtopuppet

howtopuppet.com - a community FAQ site for Puppet and related technologies
1
star
66

helga-queue

A simple helga IRC bot plugin to let you manage a short queue (FIFO) of strings (eg. todo items).
Python
1
star
67

grumble

What do you want to grumble about today?
1
star
68

networkmapper

Tools to map physical data network connetions.
Python
1
star
69

Android-CycleSys

A really old, bad, incomplete implementation of the Cycle System task management for Android. Only staying around because I'm sentimental.
Java
1
star
70

NetworkLunchbox

My Network Lunchbox project (originally I was going to name it palantir) aims to provide a ready-to-use image for Soekris net4801 (and possibly 4501) to make them usable as general-purpose network troubleshooting devices. Specifically, the intent is enable administrators of large, complex or geographically dispersed networks to be able to install a Soekris device with one interface on a network reachable from their workstation and use the other two interfaces as entry points into unreachable or problematic networks.
PHP
1
star
71

rspec-matcher-num-times

A rspec matcher for include or match a specified number of times
Ruby
1
star
72

PUP1244_test

tests for PUP-1244
HTML
1
star
73

resume

My resume. see http://resume.jasonantman.com
HTML
1
star
74

aws-docs-history

ABANDONED - Historical versions of AWS documentation
HTML
1
star
75

3d-printed-things

Collection of things I've 3d printed and might want to print again
G-code
1
star
76

prometheus-snmp-exporter-synology-ds1621

Prometheus snmp-exporter Docker image with Synology DS-1621+ config baked in
Dockerfile
1
star
77

rebuildbot

Rebuildbot re-runs builds of your inactive projects.
Python
1
star
78

tuxostat

abandoned linux/python thermostat project
C
1
star
79

rpymostat-common

Common libraries shared by packages in the RPyMostat project.
Python
1
star
80

raspberry-pi-imager

An example/template for baking a base Raspberry Pi image using Packer and pre-seeding a script for further customization.
HCL
1
star
81

RPyMostat-sensor

The temperature sensor component of RPyMostat
Python
1
star
82

reviewboard-scripts

Collection of scripts that use the ReviewBoard python client (RBClient) to perform various tasks with ReviewBoard.
Python
1
star
83

py-vista-turbo-serial

Python library and daemon to interface with Honeywell/Ademco Vista Turbo alarm panels via RS232 serial.
1
star
84

github-docs-index

Generate a single-page index of documentation hosted in one or more GitHub organizations on github.com and/or one or more GitHub Enterprise instances.
Python
1
star
85

pi2graphite

RaspberryPi-targeted app to send 1wire temperature & wifi stats to graphite.
Python
1
star
86

arch-pkgbuilds

My PKGBUILDs for Arch Linux
Shell
1
star
87

rpi-xscreensaver-tools

Scripts for doing things with xscreensaver on a Raspberry Pi with the official touchscreen
Python
1
star
88

rspec-matcher-hash-item

Rspec matchers for dealing with hashes and their content
Ruby
1
star
89

docker-zm-mlapi

A proper and uncomplicated Docker container for https://github.com/ZoneMinder/mlapi
Python
1
star
90

aw-watcher-manual-flaskweb

Tiny flask webapp for ActivityWatch manual data input.
Python
1
star