Code Monkey home page Code Monkey logo

python-wifi-survey-heatmap's Introduction

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
  2. 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
  3. 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
  4. 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
  5. When running the Docker container, add -e "PULSE_SERVER=tcp:172.17.0.1:34567" to the docker run command.
  6. 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

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:

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

python-wifi-survey-heatmap's People

Contributors

chris-reeves avatar dl6er avatar hnykda avatar jantman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-wifi-survey-heatmap's Issues

migrate away from iwconfig to nl80211/iw

iwconfig is working off the WEXT compatibility stubs left in the kernel after much of WEXT was removed. The newer official way of getting this information is from nl80211. It would be best to use netlink directly, but iw can show you the information available which seems a bit better than iwconfig.

iw does include a note warning to use netlink directly and not just parse iw output

Do NOT screenscrape this tool, we don't consider its output stable.

example of iwconfig output

wlan0     IEEE 802.11  ESSID:"My SSID"  
          Mode:Managed  Frequency:5.26 GHz  Access Point: 31:FG:A9:74:DF:DF   
          Bit Rate=866.7 Mb/s   Tx-Power=22 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=70/70  Signal level=-39 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
```

example of iw output
```
zero@theprophet ~ % iw dev wlan0 link
Connected to 34:fc:b9:74:cf:d0 (on wlan0)
	SSID: Guardia Forest Treasure Secure
	freq: 5260
	RX: 149879 bytes (882 packets)
	TX: 4747 bytes (33 packets)
	signal: -39 dBm
	tx bitrate: 866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2

	bss flags:	short-slot-time
	dtim period:	5
	beacon int:	100
zero@theprophet ~ % iw dev wlan0 info       
Interface wlan0
	ifindex 9
	wdev 0x1
	addr 12:e2:dd:f9:72:2f
	ssid Guardia Forest Treasure Secure
	type managed
	wiphy 0
	channel 52 (5260 MHz), width: 80 MHz, center1: 5290 MHz
	txpower 22.00 dBm
zero@theprophet ~ % iw wlan0 link
Connected to 34:fc:b9:74:cf:d0 (on wlan0)
	SSID: Guardia Forest Treasure Secure
	freq: 5260
	RX: 516340 bytes (3051 packets)
	TX: 8592 bytes (57 packets)
	signal: -39 dBm
	tx bitrate: 866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2

	bss flags:	short-slot-time
	dtim period:	5
	beacon int:	100
```

WARNING] Not associated to an AP

Examples looked great & wished to try this out.

Possible Bug Report

Not sure if this is a bug or my own error. If this can be resolved great, if not also ok.

Running wifi-survey with docker run command as specified runs successfully - But when starting tests (Left click on Plan) receive "Aborted : Not connected to an access point" in bottom of window.

Plan stays loaded & can click all over map but always returns Aborted error

Host is connected on wifi network.

Docker container appears to correctly receive wifi information from host - running "sudo docker exec ../sbin/iwconfig lists the connection details which includes the BSSID etc. - Although I believe this is not used by wifi-survey any more, thought this at least proved the container received the details from the host.

Version

Using docker image ID 27941809078c

Installation Method

Installed Docker on Debian Buster Debian 4.19.235-1 (First time ever used Docker)

Installed wifi survey with
sudo 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 -i wlp3s0 -s 192.168.x.x -p plan.png -t "Plan Heatmap"

Running iperf3 on separate system (Not in Docker) - Assuming the "Abort" issue is raised before any testing starts and I may have issues later if current issue can be resolved but one step at time.

Gtk-CRITICAL error - Don't think this error has anything to do with issue but does happen when launching.

Actual Output

Output from Terminal

(wifi-survey:1): Gtk-CRITICAL **: 21:29:57.664: gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed
[2022-06-17 21:30:04,489 WARNING] Not associated to an AP

sudo docker run   --net="host"   --privileged   --name survey   -it   --rm -vv  -v $(pwd):/pwd   -w /pwd   -e DISPLAY=$DISPLAY   -v "$HOME/.Xauthority:/root/.Xauthority:ro"   jantman/python-wifi-survey-heatmap   wifi-survey -i wlp3s0 -s 192.168.3.200 -p Plan.png -t "Plan Heatmap"

Expected Output

Was hoping for the first test to run & reach 100%

Testing Assistance

Will help if I can, but may need detailed instructions to provide required information.

Paplay fails when running as sudo

When running the script as root it fails to play the sound:

Connection failure: Connection refused
pa_context_connect() failed: Connection refused

It looks like it is not possible to run paplay with sudo.

Error in AP scanning causes hang

Bug Report

Version

Current pre-release @ 6a35b74

Installation Method

Docker image jantman/python-wifi-survey-heatmap:6a35b74

Supporting Software Versions

N/A - Docker

Actual Output

While running a survey/scan, the UI gets to 80% on the first point (status bar says "Scanning all access points within reach") and then just... hangs there. Looking at the console output, I see the following error:

2022-01-29 13:12:57,737 [DEBUG collector.py:102 - wifi_survey_heatmap.collector.scan_all_access_points() ] Scanning...
Traceback (most recent call last):
  File "/app/wifi_survey_heatmap/ui.py", line 295, in onLeftUp
    self._do_measurement(pos)
  File "/app/wifi_survey_heatmap/ui.py", line 411, in _do_measurement
    res['scan_results'] = self.collector.scan_all_access_points()
  File "/app/wifi_survey_heatmap/collector.py", line 103, in scan_all_access_points
    res = self.scanner.scan_all_access_points()
  File "/app/wifi_survey_heatmap/libnl.py", line 299, in scan_all_access_points
    pack = struct.pack('16sI', self.interface_name.encode('ascii'), 0)
AttributeError: 'NoneType' object has no attribute 'encode'

Expected Output

No error.

wifi-heatmap --ap-names seems not working

Hello everyone,

Thanks for all the work!

I'm trying to use the -a / --ap-names option. Unfortunately I can't find any documentation about the structure of the json file. I tried something like this:

{
    "aa:bb:cc:dd:ee:01": "AP1 5",  
    "aa:bb:cc:dd:ee:02": "AP1 24",  
    "aa:bb:cc:dd:ee:03": "AP2 5",   
    "aa:bb:cc:dd:ee:04": "AP2 24",  
    "aa:bb:cc:dd:ee:05": "AP3 24", 
    "aa:bb:cc:dd:ee:06": "AP3 5"     
}

A wifi-heatmap --ap-names ap-mapping.json [TITLE] does not change the images at all. Is this a bug or am I doing something wrong?

Best regards,
Gregor

Thank you

Thanks for putting this together and making it available!

can I somehow manually add values on map?

hi,thank you very much for so impressive project. I was wondering a few years is there any similar software but with fully manual values adding. I guess your program theoretically do this. I need it for similar measurements but not for wifi. I need to measure and heat map sound noise levels,reverberations time,and few other things. I would be happy if you help me with that

Failed to download FreeType

Bug Report

Version

wifi-survey-heatmap version, as reported by wifi-survey-heatmap --version

I can not tell since it does not build yet. But I just cloned it.

Installation Method

How was wifi-survey-heatmap installed (provide as much detail as possible, ideally
the exact command used and whether it was installed in a virtualenv or not).

Did not install yet, but tried to build it.

Supporting Software Versions

The output of python --version and virtualenv --version in the environment
that wifi-survey-heatmap is running in, as well as your operating system type and version.

Python 3.9.0
16.7.7

Actual Output

Paste here the output of wifi-survey-heatmap (including the command used to run it),
run with the -vv (debug-level output) flag, that shows the issue.

23-52-48:0:jd@localhost[SB=on]:~/Desktop/wifi-heatmap/python-wifi-survey-heatmap[125]$ sudo python setup.py develop
[sudo] password for jd:
running develop
running egg_info
writing wifi_survey_heatmap.egg-info/PKG-INFO
writing dependency_links to wifi_survey_heatmap.egg-info/dependency_links.txt
writing entry points to wifi_survey_heatmap.egg-info/entry_points.txt
writing requirements to wifi_survey_heatmap.egg-info/requires.txt
writing top-level names to wifi_survey_heatmap.egg-info/top_level.txt
reading manifest file 'wifi_survey_heatmap.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'wifi_survey_heatmap.egg-info/SOURCES.txt'
running build_ext
Creating /usr/local/lib/python3.9/site-packages/wifi-survey-heatmap.egg-link (link to .)
wifi-survey-heatmap 0.2.1 is already the active version in easy-install.pth
Installing wifi-heatmap script to /usr/local/bin
Installing wifi-heatmap-thresholds script to /usr/local/bin
Installing wifi-scan script to /usr/local/bin
Installing wifi-survey script to /usr/local/bin

Installed /home/jd/Desktop/wifi-heatmap/python-wifi-survey-heatmap
Processing dependencies for wifi-survey-heatmap==0.2.1
Searching for matplotlib==3.3.0
Reading https://pypi.org/simple/matplotlib/
Downloading https://files.pythonhosted.org/packages/7d/d4/e4c40c62cd8608ca09f0684e64139c56512e195f2351ac41a472d4dc8b38/matplotlib-3.3.0.tar.gz#sha256=24e8db94948019d531ce0bcd637ac24b1c8f6744ac86d2aa0eb6dbaeb1386f82
Best match: matplotlib 3.3.0
Processing matplotlib-3.3.0.tar.gz
Writing /tmp/easy_install-v765l_a_/matplotlib-3.3.0/setup.cfg
Running matplotlib-3.3.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-v765l_a_/matplotlib-3.3.0/egg-dist-tmp-20snfeb5
UPDATING build/lib.linux-x86_64-3.9/matplotlib/_version.py
set build/lib.linux-x86_64-3.9/matplotlib/_version.py to '3.3.0'
error: Setup script exited with error: Failed to download FreeType. Please download one of ['https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz', 'https://download.savannah.gnu.org/releases/freetype/freetype-2.6.1.tar.gz'] and extract it into build/freetype-2.6.1 at the top-level of the source repository.
10-41-16:0:jd@localhost[SB=on]:~/Desktop/wifi-heatmap/python-wifi-survey-heatmap[1]$

Expected Output

Describe the output that you expected (what's wrong). If possible, after your description,
copy the actual output above and modify it to what was expected.

I expect the software to build.

BSSID option intermittently not working

The --bssid option seems to be broken. When connected to a single specific BSSID, sometimes it will throw a warning about being associated to a completely unrelated BSSID, and sometimes it will not. This appears to be intermittent, almost like a race condition, and I haven't yet been able to figure out the issue... beyond the fact that if you specify --bssid with the BSSID that you're currently (and should) be connected to, it will intermittently show a warning about being connected to a different BSSID even though you're not...

This appears to be a regression introduced by @DL6ER 's #4 migration from iwscan/iwlist to libnl.

Update reminder + GitHub Actions

Next time I do much work on this, I want to update all dependencies plus the Docker image and everything inside it, as well as the tox test environments.

I also want to set up GitHub Actions for test, GitHub Release, and push to Docker Hub. I'll need something that parses the release notes and the version file.

running under Docker in macOS with X11

Feature Request

Feature Description

Support for running under macOS with XQuartz (X11 window system for macOS)

Installation Method

I'm attempting to run in docker under macOS 14.1.2 with XQuartz.

$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 DeckAP -i en0 -s 10.0.1.3 -p main_floor.png -t main_floor

Unable to access the X Display, is $DISPLAY set properly?

$ echo $DISPLAY

/private/tmp/com.apple.launchd.OoSO3ahrXN/org.xquartz:0

Testing Assistance

Yes, I can test.

Problem generating PNG's

Hi Jason, I really appreciate ur app but maybe I'm doing something wrong; first I have to tell you that English is not my first language so I'm sorry if there is some writing errors.

Im running the program in Docker using the commands that you provide us:

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

survey:

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 -s 10.0.0.214:5201 -t TEST03

heatmap generate:
docker run -it --rm -v $(pwd):/pwd -w /pwd jantman/python-wifi-survey-heatmap wifi-heatmap TEST03

I am actually running both of them(server and survey) in the same laptop, which is a Linux Mint 19 Tara using ZSH and the Docker version is the 20.10.14, build a224086.

The trouble is that when i run it, everything goes according to plan until y generate the heatmaps:

  • channel_TEST03.json.png
  • frequency_TEST03.json.png
  • signal_quality_TEST03.json.png
  • tx_power_TEST03.json.png

All of them are generated without data.

I attached example image:
frequency_TEST03 json (copia)

docker

After running the docker run \ command I used the rest of the commands for the survey. I keep getting errors on the last line. I have tried using <> , ' ' , " " , <' '> , <" "> and have got various errors. Any suggestions on how to correctly input this would be appreciated. Thanks.

Way to customize iperf command?

Feature Request

I wish there were a way to add options to the Iperf3 command that is used to measure up and down speeds.

Feature Description

For example, I would like to use iperf options like these: iperf3 -c xxx.xxx.xxx.xxx -w 416k -P 3 -R

Use Cases

I have found that this command maxes out the transfer speed across my WIFI network much better than the default settings, giving a better and more stable/accurate reading.

Testing Assistance

I would be happy to test pre-release code for this feature.

An error raised from cffi library when running via docker

I am trying:

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

following with:

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 cwusbtplink 192.168.0.12 plan.png home

and when I click on the plan I get:

(wifi-survey:1): dbind-WARNING **: 20:56:31.608: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-0Cmc632T9B: No such file or directory
Traceback (most recent call last):
  File "/app/wifi_survey_heatmap/ui.py", line 239, in onLeftUp
    self._do_measurement(event.GetPosition())
  File "/app/wifi_survey_heatmap/ui.py", line 288, in _do_measurement
    iwc = self.collector.run_iwconfig()
  File "/app/wifi_survey_heatmap/collector.py", line 96, in run_iwconfig
    res = get_iwconfig(self._interface_name)
  File "/app/wifi_survey_heatmap/vendor/iwlib/iwconfig.py", line 30, in get_iwconfig
    return _get_iwconfig(interface, sock)
  File "/app/wifi_survey_heatmap/vendor/iwlib/iwconfig.py", line 98, in _get_iwconfig
    iwlib.iw_print_key(key, len(key), buf, key_size, flags)
AttributeError: cffi library 'wifi_survey_heatmap.vendor.iwlib._iwlib' has no function, constant or global variable named 'iw_print_key'

libnl dependency seemingly not satisfied

Bug Report

I had to install the latest version (0.3.0) of libnl from PyPi; without it, wifi-survey failed immediately with

$ wifi-survey help
Traceback (most recent call last):
  File "/home/francis/.local/src/python-wifi-survey-heatmap/.venv2/bin/wifi-survey", line 33, in <module>
    sys.exit(load_entry_point('wifi-survey-heatmap', 'console_scripts', 'wifi-survey')())
  File "/home/francis/.local/src/python-wifi-survey-heatmap/.venv2/bin/wifi-survey", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib64/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/francis/.local/src/python-wifi-survey-heatmap/wifi_survey_heatmap/ui.py", line 46, in <module>
    from wifi_survey_heatmap.collector import Collector
  File "/home/francis/.local/src/python-wifi-survey-heatmap/wifi_survey_heatmap/collector.py", line 41, in <module>
    from wifi_survey_heatmap.libnl import Scanner
  File "/home/francis/.local/src/python-wifi-survey-heatmap/wifi_survey_heatmap/libnl.py", line 55, in <module>
    import libnl.handlers
ModuleNotFoundError: No module named 'libnl'

pip install libnl installs libnl0.2.0, which still does not work - needs to be `pip install libnl3.

Even with libnl3 installed, scancli.py offers up this error

23:40  ~/.local/src/python-wifi-survey-heatmap
$ ./wifi_survey_heatmap/scancli.py 
Traceback (most recent call last):
  File "./wifi_survey_heatmap/scancli.py", line 44, in <module>
    from wifi_survey_heatmap.collector import Collector
  File "/home/francis/.local/src/python-wifi-survey-heatmap/wifi_survey_heatmap/collector.py", line 41, in <module>
    from wifi_survey_heatmap.libnl import Scanner
  File "/home/francis/.local/src/python-wifi-survey-heatmap/wifi_survey_heatmap/libnl.py", line 55, in <module>
    import libnl.handlers
  File "/home/francis/.local/src/python-wifi-survey-heatmap/wifi_survey_heatmap/libnl.py", line 55, in <module>
    import libnl.handlers
ModuleNotFoundError: No module named 'libnl.handlers'; 'libnl' is not a package

scancli.py isn't mentioned in the README, but I was looking for somewhere to get the version info - I don't seem to have 1wifi-survey-heatmapand the other commands do not have a--version` flag.

Version

Most recent commit

Installation Method

git clone https://github.com/jantman/python-wifi-survey-heatmap.git
virtuelenv --system-site-packages --prompt "(wifi-heatmap)" .venv
source ./.venv/bin/activate
python setup.py develop

Supporting Software Versions

$ neofetch
          /:-------------:\          francis@francis-remote 
       :-------------------::        ---------------------- 
     :-----------/shhOHbmp---:\      OS: Fedora release 32 (Thirty Two) x86_64 
   /-----------omMMMNNNMMD  ---:     Host: P2540UA 1.0 
  :-----------sMMMMNMNMP.    ---:    Kernel: 5.10.11-100.fc32.x86_64 
 :-----------:MMMdP-------    ---\   Uptime: 2 days, 10 hours, 14 mins 
,------------:MMMd--------    ---:   Packages: 2814 (rpm) 
:------------:MMMd-------    .---:   Shell: bash 5.0.17 
:----    oNMMMMMMMMMNho     .----:   Resolution: 1920x1080, 1920x1080 
:--     .+shhhMMMmhhy++   .------/   WM: i3 
:-    -------:MMMd--------------:    Theme: Adwaita [GTK2] 
:-   --------/MMMd-------------;     Icons: Adwaita [GTK2] 
:-    ------/hMMMy------------:      Terminal: gnome-terminal 
:-- :dMNdhhdNMMNo------------;       CPU: Intel i5-7200U (4) @ 3.100GHz 
:---:sdNMMMMNds:------------:        GPU: Intel HD Graphics 620 
:------:://:-------------::          Memory: 1879MiB / 31988MiB 
:---------------------://
                                          
$ python --version
Python 3.8.7

$ virtualenv --version
virtualenv 20.4.2 from /home/francis/.local/lib/python3.8/site-packages/virtualenv/__init__.py

Actual Output

23:25  ~/.local/src/python-wifi-survey-heatmap
$ wifi-survey --help
Traceback (most recent call last):
  File "/home/francis/.local/src/python-wifi-survey-heatmap/.venv2/bin/wifi-survey", line 33, in <module>
    sys.exit(load_entry_point('wifi-survey-heatmap', 'console_scripts', 'wifi-survey')())
  File "/home/francis/.local/src/python-wifi-survey-heatmap/.venv2/bin/wifi-survey", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib64/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/francis/.local/src/python-wifi-survey-heatmap/wifi_survey_heatmap/ui.py", line 46, in <module>
    from wifi_survey_heatmap.collector import Collector
  File "/home/francis/.local/src/python-wifi-survey-heatmap/wifi_survey_heatmap/collector.py", line 41, in <module>
    from wifi_survey_heatmap.libnl import Scanner
  File "/home/francis/.local/src/python-wifi-survey-heatmap/wifi_survey_heatmap/libnl.py", line 55, in <module>
    import libnl.handlers
ModuleNotFoundError: No module named 'libnl'

Expected Output

$ wifi-survey --help
[2021-02-12 23:31:51,960 WARNING] You should run this script as root to be able to trigger Wi-Fi scans.
usage: wifi-survey [-h] [-v] [-S] [-s IPERF3_SERVER] [-d IPERF3_DURATION] [-b BSSID] [--ding DING] [--ding-command DING_COMMAND] [-i INTERFACE] [-p IMAGE] [-t TITLE]

wifi survey data collection UI

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         verbose output. specify twice for debug-level output.
  -S, --scan            Scan for access points in the vicinity
  -s IPERF3_SERVER, --server IPERF3_SERVER
                        iperf3 server IP or hostname
  -d IPERF3_DURATION, --duration IPERF3_DURATION
                        Duration of each individual ipref3 test run
  -b BSSID, --bssid BSSID
                        Restrict survey to this BSSID
  --ding DING           Path to audio file to play when measurement finishes
  --ding-command DING_COMMAND
                        Path to ding command
  -i INTERFACE, --interface INTERFACE
                        Wireless interface name
  -p IMAGE, --picture IMAGE
                        Path to background image
  -t TITLE, --title TITLE
                        Title for survey (and data filename)

Testing Assistance

Yes

iPerf error: Unable to send control Message

Please remove all of this template but the relevant section below, and fill in
each item in that section.

Bug Report

Latest version of
I am running wifi-survey in Docker on Ubuntu 20.04.
iperf is running in Docker on Debian 18

In wifi-Survey I consistently get this error when it gets to the final Download (UPD) step. All steps up and to this point are fine.
I get a prompt asking if I want to retry or not. If I hit yes to retry it just keeps popping the same message. If I hit no sometimes it seems to finish (the point I selected on the floorplan goes green and says 100%, other times wifi-survey freezes and I can either wait (which doesn't work) or force quit).

When I return to the cli I see the following errors:
warning: UDP block size 65507 exceeds TCP MSS 1448, may result in fragmentation/drops
iperf error control socket has closed unexpectedly; retrying
iperf error unable to send control message: ; retrying
On the iperf server I see iperf3: error - select failed: Bad file descriptor

To create the container I as using:

docker run
--net="host"
--privileged
--name survey
-it
--rm
-v $(pwd):/pwd
-w /pwd
-e DISPLAY=$DISPLAY
-v "$HOME/.Xauthority:/root/.Xauthority:ro"
-v /run/user/1000/at-spi/bus_0:/run/user/1000/at-spi/bus_0
jantman/python-wifi-survey-heatmap
wifi-survey -b AP:MA:CA:DD:RE:SS -i wlp3s0 -s 192.168.1.5 -t Test-Scan

Dot size

Feature Request

Dot size

Feature Description

To change scan dot size, when I'm using smaller png dot is too large.

Unable to install libiw

Bug Report

$ pip install libiw
ERROR: Could not find a version that satisfies the requirement libiw
ERROR: No matching distribution found for libiw

Also the link in the README 404's

But it also doesn't seem to matter?

X Display

Bug Report

When attempting to run the survey from Docker, X Display is not set.

Version

0.2.1 (Docker)

Installation Method

Docker container (latest)

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

Actual Output

No protocol specified
Unable to access the X Display, is $DISPLAY set properly?

Expected Output

Test to run.

Error when using --scan option

Bug Report

An error occurs during scan_all_access_points when calling with the --scan/-S option, as so:

sudo ./.venv/bin/python -m wifi_survey_heatmap.ui -v -v -i wlp3s0 -p floorplan.png -s 192.168.1.24:5201 -t test -S

The node gets stuck at 80%, and the JSON file has only an empty array.

Version

Most recent commit

Installation Method

git clone https://github.com/jantman/python-wifi-survey-heatmap.git
virtuelenv --system-site-packages --prompt "(wifi-heatmap)" .venv
source ./.venv/bin/activate
python setup.py develop

Supporting Software Versions

$ neofetch
          /:-------------:\          francis@francis-remote 
       :-------------------::        ---------------------- 
     :-----------/shhOHbmp---:\      OS: Fedora release 32 (Thirty Two) x86_64 
   /-----------omMMMNNNMMD  ---:     Host: P2540UA 1.0 
  :-----------sMMMMNMNMP.    ---:    Kernel: 5.10.11-100.fc32.x86_64 
 :-----------:MMMdP-------    ---\   Uptime: 2 days, 10 hours, 14 mins 
,------------:MMMd--------    ---:   Packages: 2814 (rpm) 
:------------:MMMd-------    .---:   Shell: bash 5.0.17 
:----    oNMMMMMMMMMNho     .----:   Resolution: 1920x1080, 1920x1080 
:--     .+shhhMMMmhhy++   .------/   WM: i3 
:-    -------:MMMd--------------:    Theme: Adwaita [GTK2] 
:-   --------/MMMd-------------;     Icons: Adwaita [GTK2] 
:-    ------/hMMMy------------:      Terminal: gnome-terminal 
:-- :dMNdhhdNMMNo------------;       CPU: Intel i5-7200U (4) @ 3.100GHz 
:---:sdNMMMMNds:------------:        GPU: Intel HD Graphics 620 
:------:://:-------------::          Memory: 1879MiB / 31988MiB 
:---------------------://
                                          
$ python --version
Python 3.8.7

$ virtualenv --version
virtualenv 20.4.2 from /home/francis/.local/lib/python3.8/site-packages/virtualenv/__init__.py

Actual Output

...
2021-02-12 23:54:49,590 [DEBUG collector.py:102 - wifi_survey_heatmap.collector.scan_all_access_points() ] Scanning...

----------------------------------------------------------------------------------------------------------
ui.py 295 onLeftUp
self._do_measurement(pos)

ui.py 411 _do_measurement
res['scan_results'] = self.collector.scan_all_access_points()

collector.py 103 scan_all_access_points
res = self.scanner.scan_all_access_points()

libnl.py 299 scan_all_access_points
pack = struct.pack('16sI', self.interface_name.encode('ascii'), 0)

AttributeError:
'NoneType' object has no attribute 'encode'
...

Expected Output

An iperf result

Testing Assistance

Yes

Error in wifi-heatmap - AttributeError - _image_path

Bug Report

Version

Pre-release 5173a85

Installation Method

Docker - jantman/python-wifi-survey-heatmap:5173a85

Supporting Software Versions

Docker - jantman/python-wifi-survey-heatmap:5173a85

Actual Output

wifi-heatmap -p DM_floorplan_1681x910.png foo
Traceback (most recent call last):
  File "/usr/local/bin/wifi-heatmap", line 11, in <module>
    load_entry_point('wifi-survey-heatmap', 'console_scripts', 'wifi-heatmap')()
  File "/app/wifi_survey_heatmap/heatmap.py", line 546, in main
    ignore_ssids=args.ignore, aps=args.aps, thresholds=args.thresholds
  File "/app/wifi_survey_heatmap/heatmap.py", line 259, in generate
    self._load_image()
  File "/app/wifi_survey_heatmap/heatmap.py", line 246, in _load_image
    self._layout = imread(self._image_path)
AttributeError: 'HeatMapGenerator' object has no attribute '_image_path'

Expected Output

Expected that the output images would be generated

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.