探測場內wifi設備信息:cliprobe
介紹
cliprobe 用于探測網絡中的wifi客戶,無需用戶鏈接,進入網絡后主動探測。并根據多臺ap的反饋信號,計算出設備在場地內的坐標。
核心代碼:
ap等路由系統上的報文抓取(未開源) server端根據匯報數據計算client位置
對應web:
一、基于用戶做統計 1、用戶mac地址 2、設備類型 3、首次到場時間 4、最近到場時間 5、平均每次在場時間與在場總時間 6、指定時間用戶活躍排名(自選默認)
二、基于場地做統計 1、用戶mac地址,用戶到場時間, 1、場地每天總人數 2、平均在店時間 3、在場人數在不同時間的曲線(采樣時間自選) 4、用戶活躍區域圖
三、報表基于以上統計信息,每天,每周,每月,每季度出統計表
編譯執行
make 只生成client
make server 生成服務端
運行
客戶端
客戶端運行在任何支持monitor mode的機器上。不僅僅可以運行在路由器。檢查是否支持:iw phy
查看Supported interface modes:
./cliprobe
USAGE: probe wlan0 mon0 server minsig debug
e.g:
./cliprobe wlan0 mon0 192.168.10.119 70 0
minsig: 最小關心信號強度,注意沒有負號
服務端
配置文件: /etc/clipos/serprobe.conf
ap位置配置文件: /etc/clipos/ap.conf
[jianxi@Jianxi cliprobe]$ ./server/serprobe --help
USAGE: serprobe [options]
-a, --apconf ap position config file (default /etc/clipos/ap.conf)
-t, --agetime ap report age time (default 5s)
-l, --losttime client lost age time (default 300s)
-i, --dis sample distance (default 1m)
-s, --sig sample distance signal (default 53)
-f, --fac default factory 2.5 ~ 5 (default 4.5)
-r, --drift default drift (default 1)
-m, --minsig min signal get in calculate (default -70)
-d, --daemon daemon mode
-b, --debug enable debug will auto disable daemon_mode
--help help info
正常參數不需要修改, 長期修改請修改配置文件。正式部署時,請啟動daemon 模式 serprobe -d
數據庫
mysql數據庫, 數據庫配置使用my.cnf
, 使用[serprobe]
section.
數據庫:cliprobe 表: clipos, user
climac: 8字節存儲,后6字節為mac地址
macstr: mac地址字符串表示形式
x,y,z: 坐標
time: 時間戳
first_time: 客戶端首次出現時間
last_time: 客戶端最近一次出現時間
CREATE TABLE IF NOT EXISTS clipos ( climac BIGINT NOT NULL, macstr CHAR(17) NOT NULL, x DOUBLE, y DOUBLE, z DOUBLE, time TIMESTAMP ); CREATE TABLE IF NOT EXISTS user ( climac BIGINT NOT NULL, macstr CHAR(17) NOT NULL, first_time DATETIME NOT NULL, last_time DATETIME NOT NULL, primary key (climac) );
存儲
- 8 + 17 + 8 + 8 + 8 + 4 = 53B
- 活躍信息,每2秒一條記錄
- 程序設計最大用戶10000人
- 每天開業12小時
綜上:
12 * 3600 / 2 * 10000 * 53 = 11,448,000,000B (11,179,687KB, 10,917.7MB, 10.7GB)