Skip to content

Commit

Permalink
added statistic collection
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasseemoo committed Jun 27, 2017
1 parent 3684a80 commit 388140a
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ We setup a survey to learn about who uses Nexmon to which purpose and how we cou
Our software may damage your hardware and may void your hardware’s warranty! You use our tools at your own risk and responsibility! If you don't like these terms, don't use nexmon!

# Important changes
* We started to collect usage statistics. In the file [STATISTICS.md](https://github.com/seemoo-lab/nexmon/STATISTICS.mk), you can find information on which data we collect and how you can opt-out of the statistics collection
* Starting with commit 4f8697743dc46ffc37d87d960825367531baeef9 the brcmfmac driver for the RPi3 can now be used as a regular interface. You need to use nexutil to activate monitor mode (`nexutil -m2` for monitor mode with radiotap headers), which will automtically adjust the interface type.
* Starting with commit 184480edd6696392aae5f818f305f244606f2d17 you can choose different monitor mode options using nexutil. Use `nexutil -m1` to activate monitor mode without radiotap headers, `nexutil -m2` to activate it with radiotap headers. The numbers were chosen as non-Nexmon firmwares also support native monitor mode without radiotap headers by activating monitor mode with `nexutil -m1`.
* Starting with commit 1bcfdc95b4395c2e8bdd962791ae20c4ba602f5b we changed the nexutil interface. Instead of calling `nexutil -m true` to activate monitor mode, you should now write `nexutil -m1`. To get the current monitor mode state execute `nexutil -m` instead of `nexutil -n`.
Expand Down
20 changes: 20 additions & 0 deletions STATISTICS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
![NexMon logo](https://github.com/seemoo-lab/nexmon/raw/master/gfx/nexmon.png)

# What kind of statistics do you collect?

Everytime you run a Nexmon firmware build, we collect the following information:
* A unique identifier based on a random number (e.g., 5O31UY9Z5IEX3O9KL680V5IHNASIE1SB)
* The name, release, machine and processor of your build system (`uname -srmp`, e.g., `Linux 4.2.0-42-generic x86_64 x86_64`)
* Git internal path to the built project (e.g., `patches/bcm4339/6_37_34_43/nexmon/`)
* Git version (e.g., `2.2.1-55-g3684a80c-dirty`)
* Git repository URL (e.g., `[email protected]:seemoo-lab/wisec2017_nexmon_jammer.git`)

# Why do you collect statistics?

Nexmon is mainly intended as a research project that we share with the community so that others can benefit from our tools.
We want to collect statistics to figure out how often Nexmon is used in general and which platform and firmware version is the most popular.
We also intent to share our findings in the future.

# How do I disable the collection of statistics?

If you have privacy concerns, we also offer to opt-out of the statistic collections. To this end, you simply have to create a `DISABLE_STATISTICS` file in your Nexmon root directory.
7 changes: 7 additions & 0 deletions patches/common/header.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ header: FORCE
@printf " Our software may damage your hardware and may void your hardware’s \n"
@printf " warranty! You use our tools at your own risk and responsibility \n"
@printf "\n\n"
ifeq ("$(wildcard $(NEXMON_ROOT)/DISABLE_STATISTICS)","")
@printf "\033[0;31m COLLECTING STATISTICS\033[0m read $(NEXMON_ROOT)/STATISTICS.md for more information\n"
@make -s -f $(NEXMON_ROOT)/patches/common/statistics.mk
else
@printf "\033[0;31m STATISTICS DISABLED\033[0m to enable: delete $(NEXMON_ROOT)/DISABLE_STATATISTICS\n"
endif



FORCE:
Expand Down
28 changes: 28 additions & 0 deletions patches/common/statistics.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
STAT_WGET := $(shell command -v wget 2> /dev/null)
STAT_CURL := $(shell command -v curl 2> /dev/null)
ifneq ("$(wildcard $(NEXMON_ROOT)/.UUID)","")
STAT_UUID := $(shell cat $(NEXMON_ROOT)/.UUID | base64)
else
STAT_UUID := $(shell cat /dev/urandom | LC_ALL=C tr -dc A-Z0-9 | head -c32 > $(NEXMON_ROOT)/.UUID && cat $(NEXMON_ROOT)/.UUID | base64)
endif
STAT_UNAME := $(shell uname -srmp | base64)
STAT_PATH := $(shell git rev-parse --show-prefix | base64)
ifeq ("$(STAT_PATH)","Cg==")
STAT_PATH := $(shell cd .. && git rev-parse --show-prefix | base64)
endif
STAT_GIT_VERSION := $(shell git describe --abbrev=8 --dirty --always --tags | base64)
STAT_GIT_REMOTE := $(shell git config --get remote.origin.url | base64)
#STAT_URL := http://172.16.121.1:8888/statistics/
STAT_URL := https://nexmon.org/statistics/
STAT_DATA := "uuid=$(STAT_UUID)&uname=$(STAT_UNAME)&path=$(STAT_PATH)&version=$(STAT_GIT_VERSION)&remote=$(STAT_GIT_REMOTE)"

statistics: FORCE
ifdef STAT_WGET
$(Q)$(STAT_WGET) --user-agent="Nexmon" --post-data=$(STAT_DATA) --quiet --background --delete-after --no-check-certificate $(STAT_URL) > /dev/null 2> /dev/null
else
ifdef STAT_CURL
$(Q)$(STAT_CURL) -A "Nexmon" --data $(STAT_DATA) $(STAT_URL) > /dev/null 2> /dev/null &
endif
endif

FORCE:

0 comments on commit 388140a

Please sign in to comment.