# 使用 Raspberry 3B+ 蒐集 CSI 資料 ## 現在可使用樹梅派編號 * 103 * 106 (建議重新用一次,感覺很容易當機) ## 環境設置 #### 作業系統: Rasp pi OS 5.4.83 #### 下載: https://downloads.raspberrypi.com/raspios_armhf/images/raspios_armhf-2021-01-12/ ## Nexmon補丁下載 根據官網 BCM43455c0 指引下載及配置: https://github.com/seemoo-lab/nexmon_csi :::warning * 如果遇到在各階段 make 時失敗可以先 apt-get update & upgrade * 第九個步驟要仔細看清楚,是要到patches/bcm43455c0/7_45_189/ 下去clone nexmon_csi * 第十二步驟 apt-get remove wpasupplicant 可刪可不刪,不刪wifi也一樣無法正常連線 ::: ## CSI數據蒐集 (使用守則) ### 每次開啟Raspberry pi 或是要重新設定參數蒐集資料時要做的事: 1. sudo su 1. cd /nexmon 1. source setup_env.sh 1. cd /nexmon/patches/bcm43455c0/7_45_189/nexmon_csi/ 1. make install-firmware ### 操作步驟: 1. 在 CMD 上輸入 /nexmon/patches/bcm43455c0/7_45_189/nexmon_csi/utils/makecsiparams/makecsiparam -c <font color="#F7A004">通道編號/通道頻寬</font> -C 1 -N 1 -m <font color="#F7A004">預蒐集裝置 MAC Address</font> -b <font color="#F7A004">0x88 or 0x80 or 0x00 or **不填**</font> 指令打下去後會得到一個base64編碼<font color="#FF0000">**(為參數設定碼)**</font> :::info 這步驟是在設定filter參數,以及等等開啟 monitor mode 時要在哪個 channel 監聽。 在 channel為 XXX 頻寬 XXX 上監聽,並且過濾來自 MAC Address 裝置的封包,並且要是 XX(frame type) 種封包。 ::: :::info * 0x88 為 QoS Data frame(如果要做跟時間有關的資料,最好是加這個,打ICMP PING 一般都是這個) * 0x00 為 管理 frame * 0x80 為 Beacom frame 不填就是不用特別去過濾封包。 ::: 2. ifconfig wlan0 up :::info 將網卡開啟 ::: 3. pkill wpa_supplicant :::info 將WPA process kill 掉 ::: 4. nexutil -Iwlan0 -s500 -b -l34 -v<font color="#FF0000">**(參數設定碼)**</font> 5. iw phy `iw dev wlan0 info | gawk '/wiphy/ {printf "phy" $2}'` interface add mon0 type monitor ifconfig mon0 up :::info 開啟監聽模式,並且建立一個虛擬窗口 mon0 ::: 6. tcpdump -i wlan0 dst port 5500 -w <font color="#F7A004">檔案名稱</font>.pcap ## 分析工具 1. Nexmon Matlab CSI Tools 2. Python Code ### Nexmon Csi Tools: 進入 Nexmon CSI 資料夾並在進入utils/matlab/ 再將 pcap 檔丟入 csireader 執行。  ### Python Code: 這裡有一個nexmon專家 Zeroby0 有 python code 可以萃取封包內的CSI以及其他相關資訊(有問題也可以問他,他是專家)。 我自己的code比較亂,而且我有額外刪除較舊的標準的子載波,如果在前面操作步驟有加0x88過濾的話,收到較舊標準封包的機率會降低,那還是用這個老哥的code比較好,之後在蒐集更高頻寬的時候也比較有保障。 https://github.com/nexmonster/nexmon_csi/tree/feature/python/utils/python https://github.com/nexmonster/nexcsi 這是我去掉NULL、PILOT、Legacy protocol NULL(只使用 48 個子載波) 在 5GHz、20MHz下(10個封包)。  到了40MHz 以及 80MHz 會變得更加複雜,sub-band problem 等等,如果任何想討論可以到nexmon論壇上去與專家討論。 到以下網址提出issue: https://github.com/seemoo-lab/nexmon_csi/issues tag 專家 #### 專家: * https://github.com/jlinktu * https://github.com/zeroby0 # AP設定 小米 R3P 1. 連線 MCSLAB WIFI 2.4G or 5G 都可以 (192.168.31.1)  2. 登入 密碼: sousokian 3. 點擊上方常用設定  4. 設定 WIFI AP 在 2.4G 跟 5G 想要運行的 channel.
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up