工具概述
Sparrow-wifi本質上一款針對下一代2.4GHz和5GHz的WiFi頻譜感知工具,它不僅提供了GUI圖形化用戶界面,而且功能更加全面,可以代替類似inSSIDer和linssid之類的Linux工具。在其最完整的使用場景下,Sparrow-wifi可以將WiFi、軟件定義無線電(hackrf)、高級藍牙工具、傳統GPS(gpsd)和漫遊GPS(mavlink)整合到一個解決方案之中。
該工具完全使用Python3開發,並且適用於以下場景:
1、基本的WiFi SSID識別;
2、WiFi源捕捉;
3、2.4GHz和5GHz頻譜查看;
4、藍牙識別;
5、藍牙源捕捉;
6、iBeacon廣播;
7、遠程操作(通過GUI);
8、可掛載到無人機,支持樹莓派;
9、遠程代理基於JSON,可整合進其他應用;
10、CSV和JSON數據導出/導入;
11、可根據GPS座標生成Google地圖;
工具運行截圖
Sparrow-wifi主面板,執行基礎的WiFi掃描:
WiFi和藍牙跟蹤:
工具安裝
Sparrow-wifi使用了Python3、qt5和qtchart來構建UI界面,在標準的基於Debian的平臺上,已經自帶了Python3和qt5,只需要單獨配置qtchart即可。在Ubuntu和Kali Linux上執行下列命令:
sudo apt-get install python3-pip gpsd gpsd-clients python3-tk python3-setuptools
sudo pip3 install QScintilla PyQtChart gps3 dronekit manuf python-dateutil numpy matplotlib
當然了,你也可以在Python虛擬環境(virtualenv)中使用該工具:
git clone https://github.com/ghostop14/sparrow-wifi
cd sparrow-wifi
virtualenv --python=python3 $HOME/sparrow
source $HOME/sparrow/bin/activate
pip3 install gps3 python-dateutil requests pyqt5 pyqtchart numpy matplotlib
sudo python3 sparrow-wifi.py
工具運行
該工具需要使用標準的命令行工具“iw”來執行WiFi掃描,因此我們需要使用root權限來運行:
sudo ./sparrow-wifi.py
GPS通信
Sparrow-wifi基於gpsd來提供標準的GPS通信功能,我們可以使用下列命令來進行快速的GPS測試:
gpsd -D 2 -N /dev/ttyUSB0
運行Sparrow-wifi遠程代理
由於代理所需的權限跟GUI工具的運行權限相同,因此這裡我們同樣需要使用到root權限:
sudo ./sparrowwifiagent.py
默認配置下,代理會監聽端口8020。我們也可以使用下列命令來指定其他端口:
sudo ./sparrowwifiagent.py --port=<myport>
工具幫助菜單
我們可以使用–help命令來查看Sparrow-wifi的幫助菜單以及參數選項:
usage: sparrowwifiagent.py [-h] [--port PORT] [--allowedips ALLOWEDIPS]
[--mavlinkgps MLINKGPS] [--sendannounce]
[--userpileds] [--recordinterface RECORDINTERFACE]
[--ignorecfg] [--cfgfile CFGFILE]
[--delaystart DELAYSTART]
Sparrow-wifi agent
optional arguments:
-h, --help show this help message and exit
--port PORT Port for HTTP server to listen on
--allowedips ALLOWEDIPS
IP addresses allowed to connect to this agent. Default
is any. This can be a comma-separated list for
multiple IP addresses
--mavlinkgps MLINKGPS
Use Mavlink (drone) for GPS. Options are: '3dr' for a
Solo, 'sitl' for local simulator, or full connection
string ('udp/tcp:
'udp:10.1.1.10:14550')
--sendannounce Send a UDP broadcast packet on the specified port to
announce presence
--userpileds Use RPi LEDs to signal state. Red=GPS
[off=None,blinking=Unsynchronized,solid=synchronized],
Green=Agent Running [On=Running, blinking=servicing
HTTP request]
--recordinterface RECORDINTERFACE
Automatically start recording locally with the given
wireless interface (headless mode) in a recordings
directory
--ignorecfg Don't load any config files (useful for overriding
and/or testing)
--cfgfile CFGFILE Use the specified config file rather than the default
sparrowwifiagent.cfg file
--delaystart DELAYSTART
Wait <delaystart> seconds before initializing/<delaystart>
樹莓派
我們可以使用下列命令在樹莓派上完成工具的安裝以及構建:
sudo apt-get install libsqlite3-dev
cd /tmp
wget https://www.python.org/ftp/python/3.5.5/Python-3.5.5.tgz
tar -zxvf Python-3.5.5.tgz
cd Python-3.5.5
./configure && make -j3 && sudo make install
完成之後,安裝其他的依賴模塊:
sudo pip3.5 install gps3 dronekit manuf python-dateutil
接下來,直接使用下列命令運行代理即可:
/usr/local/bin/python3.5 ./sparrowwifiagent.py
/usr/local/bin/python3.5 ./sparrowwifiagent.py --mavlinkgps=3dr --recordinterface=wlan0
文章轉載於:https://www.freebuf.com/sectool/219581.html
閱讀更多 安界 的文章