59 lines
No EOL
1.9 KiB
Markdown
59 lines
No EOL
1.9 KiB
Markdown
# CZI presence detector
|
|
Tool to detect the presence of pre-defined devices by their WiFi MAC addresses.
|
|
|
|
## How scanning works
|
|
Sets the wifi adapter into monitor mode, then listens to surrounding packets listing all detected devices into `wifi_map.yaml`. Resets the wifi adapter to normal mode for uploading the results, filters the results by the mac addresses in `identities.yaml` and sends all matched identities to the front-end webhook server in `website`. This server stores the presence information locally and displays it with `website/index.php` with a timestamp of the last update.
|
|
|
|
## What the website is capable of
|
|
Shows the last update of the `upload.py` routine. It also allows to add identities by their name and mac and to delete identities by their mac. The mac addresses are hashed server-side and then stored into the world-accessible `identities.json`.
|
|
|
|
## Set-up
|
|
Dependencies:
|
|
- Scanner: Python3, trackerjacker (pip3)
|
|
- Website: php
|
|
|
|
Configs to change:
|
|
- `scanner/live-scanner.sh`:
|
|
- WiFi adapter name
|
|
- `scanner/upload.py`:
|
|
- URLs for webhook and identities
|
|
- webhook secret
|
|
- `public/update.php`:
|
|
- webhook secret
|
|
|
|
Put `scanner` onto the scanning device (e.g. Raspberry Pi) and put `scanner/scan.sh` into a cron job.
|
|
Put `website` onto a php-capable webserver and point your domain to it.
|
|
|
|
## Systemd services
|
|
Service for scanning packets in the background
|
|
```systemd
|
|
[Unit]
|
|
Description=CZI Presence Detector - Scanner
|
|
After=network.target
|
|
|
|
[Service]
|
|
User=root
|
|
Group=root
|
|
Restart=always
|
|
WorkingDirectory=/path/to/scanner
|
|
ExecStart=/path/to/scanner/live-scanner.sh
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
Service for uploading every $n seconds
|
|
```systemd
|
|
[Unit]
|
|
Description=CZI Presence Detector - Uploader
|
|
After=network.target
|
|
|
|
[Service]
|
|
User=pi
|
|
Group=pi
|
|
Restart=always
|
|
WorkingDirectory=/path/to/scanner
|
|
ExecStart=/path/to/scanner/live-uploader.sh
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
``` |