28 Commits

Author SHA1 Message Date
09e86de93d Merge branch 'release-2.1' 2022-11-21 19:42:17 +01:00
4bdaae0c70 Merge branch 'dev' into release-2.1 2022-11-21 19:42:06 +01:00
41302b9f9f Set bash args as extra-args 2022-11-14 23:02:47 +01:00
ad8d546b78 Utilize Multi-stage building to reduce Image-size 2022-11-14 22:39:57 +01:00
d5a727c3df Make executeable 2022-11-14 21:19:37 +01:00
d5c7f0a580 Make apk package install more elegant 2022-11-14 19:13:32 +01:00
9ff168317e Add build-scripts for own- and multi-arch 2022-11-14 18:59:06 +01:00
7469565f52 Merge branch 'dev' 2021-12-19 17:26:19 +01:00
a6a3a8b180 Add Architecture-Overview 2021-12-19 17:25:49 +01:00
e1238b1ba0 Fix TOC-points 2021-12-19 17:25:31 +01:00
b545b99135 FIx wrong Description 2021-12-13 13:33:02 +01:00
6c848c0e42 Merge branch 'release-2.1' 2021-12-10 22:39:33 +01:00
918306647d Fixed chunk-error not being stopped after handling 2021-12-10 22:39:21 +01:00
1bc52b0a37 Merge branch 'release-2.1' 2021-12-10 20:09:29 +01:00
3b10aca352 Added chunk-check against undefined 2021-12-10 20:09:05 +01:00
b1942b89cb Merge branch 'release-2.1' 2021-12-09 18:18:22 +01:00
10bd72907e Merge branch 'f_influxdb-line-protocol' into dev 2021-12-09 17:57:27 +01:00
69e910428e Added documentation for LineProtocol export 2021-12-09 17:57:15 +01:00
01e28682df Merge branch 'dev' into f_influxdb-line-protocol 2021-12-09 17:33:33 +01:00
3903e492d2 Merge branch 'docs' into dev 2021-12-09 17:32:49 +01:00
ae4f2f13f0 Remove screenshot-section, it will be readded later 2021-12-09 17:32:24 +01:00
5303b31bd7 Merge branch 'release-2.0' 2021-12-06 13:32:34 +01:00
c3cd6393d4 Merge branch 'release-2.0' 2021-12-06 13:01:31 +01:00
c97137f4a7 Merge branch 'release-2' 2021-12-06 12:47:14 +01:00
a13d81e9c0 Merge branch 'release-1.1' 2021-12-03 10:53:35 +01:00
059c02e243 Merge branch 'dev' into release-1.1 2021-12-03 10:53:13 +01:00
a610f209d5 Merge branch 'release-1.1' 2021-12-02 14:08:54 +01:00
6e05a0b45c Merge branch 'release-1.0' 2021-11-29 15:55:27 +01:00
6 changed files with 149 additions and 44 deletions

View File

@@ -1,18 +1,28 @@
FROM node:16-alpine # ---- Base ----
FROM alpine:3 AS base
# Create app directory # Create app directory
WORKDIR /usr/src/app WORKDIR /usr/src/app
# Copy project file
COPY package.json .
# Install required apk-packages
RUN apk add --no-cache nodejs npm tcpdump
# ---- Dependencies ----
FROM base AS dependencies
# Install app dependencies # Install app dependencies
COPY package*.json ./ RUN npm install --only=production
RUN npm install
# remove development dependencies
RUN npm prune --production
# Install required apk-packages & delete cache # ---- Release ----
RUN apk update && apk add tcpdump && rm -rf /var/cache/apk/* FROM base AS release
# copy from build image
COPY --from=dependencies /usr/src/app/ ./
# Bundle app source # Bundle app source
COPY ./src/ . COPY ./src/ .

142
README.md
View File

@@ -14,25 +14,26 @@ Table of contents
================= =================
<!-- TOC --> <!-- TOC -->
- [1. Description](#1-description) - [1. Description](#1-description)
- [1.1. What kind of data](#11-what-kind-of-data) - [1.1. What kind of data](#11-what-kind-of-data)
- [1.2. Data-Usage](#12-data-usage) - [1.2. Data-Usage](#12-data-usage)
- [1.3. Tools used](#13-tools-used) - [1.3. Tools used](#13-tools-used)
- [1.4. Architecture](#14-architecture)
- [2. Usage/Installation](#2-usageinstallation) - [2. Usage/Installation](#2-usageinstallation)
- [2.1. Prerequisites](#21-prerequisites) - [2.1. Prerequisites](#21-prerequisites)
- [2.2. Running with Docker](#22-running-with-docker) - [2.2. Choosing an Export-Method](#22-choosing-an-export-method)
- [2.3. Environment-Variables](#23-environment-variables) - [2.3. Running with Docker](#23-running-with-docker)
- [2.4. Environment-Variables](#24-environment-variables)
- [3. Data collected](#3-data-collected) - [3. Data collected](#3-data-collected)
- [3.1. Data-Types](#31-data-types) - [3.1. Data-Types](#31-data-types)
- [3.2. Metric-Overview](#32-metric-overview) - [3.2. Metric-Overview](#32-metric-overview)
- [3.3. Metric-Details](#33-metric-details) - [3.3. Metric-Details](#33-metric-details)
- [3.4. Tag-Overview](#34-tag-overview) - [3.4. Tag-Overview](#34-tag-overview)
- [3.5. Tag-Details](#35-tag-details) - [3.5. Tag-Details](#35-tag-details)
- [4. Screenshots](#4-screenshots) - [4. Potential Issues](#4-potential-issues)
- [5. Potential Issues](#5-potential-issues) - [4.1. Channel/Frequency](#41-channelfrequency)
- [5.1. Channel/Frequency](#51-channelfrequency) - [4.2. Technology](#42-technology)
- [5.2. Technology](#52-technology) - [4.3. Data protection](#43-data-protection)
- [5.3. Data protection](#53-data-protection) - [4.4. Ethical](#44-ethical)
- [5.4. Ethical](#54-ethical)
<!-- /TOC --> <!-- /TOC -->
<br> <br>
@@ -81,6 +82,14 @@ e.g.
The program uses `tcpdump` for listening in a subProcess and then extract the metadata when packets arrive. The program uses `tcpdump` for listening in a subProcess and then extract the metadata when packets arrive.
<br>
## 1.4. Architecture
![](docs/img/1.4.architecture.png)
The system heavily uses NodeJS-Streams to read, transform and pass data around.
<br> <br>
# 2. Usage/Installation # 2. Usage/Installation
@@ -114,18 +123,34 @@ iw dev <interface> set channel <channelNumber>
<br> <br>
## 2.2. Running with Docker ## 2.2. Choosing an Export-Method
### 2.2.1. Permissions The system allows exporting directly into [InfluxDB](https://docs.influxdata.com/influxdb) version >= 2.0 or into any system using the [InfluxDb-Line-Protocol](https://docs.influxdata.com/influxdb/v2.1/reference/syntax/line-protocol/) e.g. [QuestDB](https://questdb.io/) over TCP.
As of writing (using InfluxDB v2.1 and using the *flux*-language), the data written by this system was a bit too much for InfluxDB and it struggled very quickly on a fairly beefy machine.
Thats why the additional LineProtocol-Export-Method was added. Freedom of choice of the Time-Database.
<br>
If you want to use the InfluxDB-Line-Protocol, simply set the environment variable `USE_INFLUXDB_LINEPROTOCOL` to `true` along with the-other necessary Host and Port-variables.
<br>
## 2.3. Running with Docker
### 2.3.1. Permissions
The container must run as **root**, to have permission to listen on the wifi-interface. The container must run as **root**, to have permission to listen on the wifi-interface.
<br> <br>
### 2.2.2. docker run ### 2.3.2. docker run
Either run with docker directly. Either run with docker directly.
<details><summary>for InfluxDB</summary>
```sh ```sh
docker run docker run
-d -d
@@ -135,18 +160,35 @@ docker run
-e INFLUX_URL="http://influxdb:8086/" -e INFLUX_URL="http://influxdb:8086/"
-e INFLUX_TOKEN="<yourToken>" -e INFLUX_TOKEN="<yourToken>"
-e INFLUX_ORG="<yourOrganisation>" -e INFLUX_ORG="<yourOrganisation>"
-e INFLUX_BUCKET="<yourBucket>"
ruakij/rfmon-to-influx:2 ruakij/rfmon-to-influx:2
``` ```
</details>
<details><summary>for InfluxDB-Line-Protocol</summary>
```sh
docker run
-d
--restart unless-stopped
--network host
-e WIFI_INTERFACE="<yourInterfaceName or leave empty for wlan0>"
-e USE_INFLUXDB_LINEPROTOCOL="true"
-e INFLUXDB_LINEPROTOCOL_HOST="<host>"
-e INFLUXDB_LINEPROTOCOL_PORT="<port>"
ruakij/rfmon-to-influx:2
```
</details>
<br> <br>
### 2.2.3. docker-compose ### 2.3.3. docker-compose
Or use the more preferred way with docker-compose. Or use the more preferred way with docker-compose.
`docker-compose.yml` `docker-compose.yml`
<details><summary>for InfluxDB</summary>
```yaml ```yaml
version: '3' version: '3'
@@ -163,6 +205,28 @@ services:
- INFLUX_ORG="<yourOrganisation>" - INFLUX_ORG="<yourOrganisation>"
- INFLUX_BUCKET="<yourBucket>" - INFLUX_BUCKET="<yourBucket>"
``` ```
</details>
<details><summary>for InfluxDB-Line-Protocol</summary>
```yaml
version: '3'
services:
rfmon:
container_name: rfmon
image: ruakij/rfmon-to-influx:2
restart: unless-stopped
network_mode: "host"
environment:
- WIFI_INTERFACE="<yourInterfaceName or leave empty for wlan0>"
- USE_INFLUXDB_LINEPROTOCOL="true"
- INFLUXDB_LINEPROTOCOL_HOST="<host>"
- INFLUXDB_LINEPROTOCOL_PORT="<port>"
```
</details>
<br>
And then pull&start the container: And then pull&start the container:
```sh ```sh
@@ -171,9 +235,11 @@ docker-compose up -d
<br> <br>
## 2.3. Environment-Variables ## 2.4. Environment-Variables
### 2.3.1. Necessary ### 2.4.1. Necessary
<details><summary>for InfluxDB</summary>
Variable|Description Variable|Description
---|--- ---|---
@@ -181,15 +247,25 @@ Variable|Description
`INFLUX_TOKEN` | Token with write-access `INFLUX_TOKEN` | Token with write-access
`INFLUX_ORG` | Organisation and.. `INFLUX_ORG` | Organisation and..
`INFLUX_BUCKET` | Bucket to write into `INFLUX_BUCKET` | Bucket to write into
</details>
<details><summary>for InfluxDB-Line-Protocol</summary>
Variable|Description
---|---
`USE_INFLUXDB_LINEPROTOCOL` | Enable LineProtocol
`INFLUXDB_LINEPROTOCOL_HOST` | Host and..
`INFLUXDB_LINEPROTOCOL_PORT` | Port of your server
</details>
<br> <br>
### 2.3.2. Optional ### 2.4.2. Optional
Variable|Default|Description Variable|Default|Description
---|---|--- ---|---|---
`LOGLEVEL` | INFO | Loglevel `LOGLEVEL` | INFO | Loglevel
`WIFI_INTERFACE` | wlan0 | Token with write-access `WIFI_INTERFACE` | wlan0 | Wifi-Interface name in Monitor-Mode
~~`HOSTNAME`~~ | ~~Device's Hostname~~ | ~~Hostname to use as global hostname-tag~~ *(Unused)* ~~`HOSTNAME`~~ | ~~Device's Hostname~~ | ~~Hostname to use as global hostname-tag~~ *(Unused)*
<br> <br>
@@ -308,13 +384,9 @@ Unknown | - | Unknown packets not identified into above types
<br> <br>
# 4. Screenshots # 4. Potential Issues
<br> ## 4.1. Channel/Frequency
# 5. Potential Issues
## 5.1. Channel/Frequency
The System can only monitor one channel at a time which might not be enough cover, The System can only monitor one channel at a time which might not be enough cover,
to combat this, more Interfaces and Systems can be deployed. to combat this, more Interfaces and Systems can be deployed.
@@ -323,14 +395,14 @@ This is not entirely unproblematic, as the system cannot currently prevent packa
<br> <br>
## 5.2. Technology ## 4.2. Technology
Mismatches between sender and receiver-technologies (e.g. MIMO or HT) can cause packets not being logged at all. Mismatches between sender and receiver-technologies (e.g. MIMO or HT) can cause packets not being logged at all.
Though this should only be a problem for data-packets. Though this should only be a problem for data-packets.
<br> <br>
## 5.3. Data protection ## 4.3. Data protection
Because the system collects any data, this can be problematic, specially in countries with strong data-protection laws. Because the system collects any data, this can be problematic, specially in countries with strong data-protection laws.
@@ -338,7 +410,7 @@ A wifi MAC address is likely to be considered as information of an identifiable
<br> <br>
## 5.4. Ethical ## 4.4. Ethical
The large-scale collection of data for behavioural or movement analysis, especially without consent of the data subject, is highly controversial. The large-scale collection of data for behavioural or movement analysis, especially without consent of the data subject, is highly controversial.

9
build/docker-multiarch.sh Executable file
View File

@@ -0,0 +1,9 @@
TAG="ruakij/rfmon-to-influx"
PLATFORM="linux/amd64,linux/arm64/v8,linux/arm/v7"
EXTRA_ARGS="$@"
docker buildx build \
--platform $PLATFORM \
--tag $TAG \
$EXTRA_ARGS \
.

7
build/docker-ownarch.sh Executable file
View File

@@ -0,0 +1,7 @@
TAG="ruakij/rfmon-to-influx"
EXTRA_ARGS="$@"
docker build \
--tag $TAG \
$EXTRA_ARGS \
.

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

View File

@@ -47,6 +47,13 @@ class PacketStreamFactory extends Transform{
} }
_transform(chunk, encoding, next){ _transform(chunk, encoding, next){
if(!chunk){
const err = "Chunk was invalid!";
logger.error(err);
next(err);
return;
}
let packet = new Packet(); let packet = new Packet();
const lines = chunk.split("\n"); const lines = chunk.split("\n");