免责声明本文内容仅用于学习、研究和技术交流请勿将文中涉及的工具、方法用于任何非法用途。作者不对任何因使用本文内容而产生的直接或间接后果负责包括但不限于违反法律法规、造成财产损失或人身伤害等。请读者自觉遵守当地法律法规合法合规地使用相关技术。Ubuntu18安装Ubuntu18自带python3python2后续安装依赖、运行均使用python2Ubuntu18虽自带python2环境但可能没有pip2包需要自己下载安装curl-Ohttps://bootstrap.pypa.io/pip/2.7/get-pip.pysudopython2.7 get-pip.py-ihttp://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com使用pip2 --version验证是否安装完成将BLESuite拉取到本地gitclone https://gitee.com/wuhao2343/BLESuite.git先安装环境不然会缺少系统依赖# 更新软件包列表sudoaptupdatesudoapt-getupdate# 安装编译工具链sudoapt-getinstallbuild-essential python2.7-dev# 安装蓝牙开发库和 Python 开发头文件sudoaptinstall-ylibbluetooth-dev libpython-dev python-sphinx# 安装蓝牙工具sudoaptinstall-ybluez bluez-tools完成后进入根目录安装项目依赖sudopip2install-rrequirements.txt-ihttp://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com依赖安装完成后将工具安装到系统中sudo python setup.py install完成后执行whereis ble-replay看是否有输出再执行ble-replay命令可能出现下面错误解决方式是卸载依赖再安装适应版本# 卸载当前版本pip uninstall pyshark scapy cryptography# 安装兼容 Python 2.7 的旧版本pipinstallpyshark0.3.8 pipinstallscapy2.4.5 pipinstallcryptography2.9.2之后再运行ble-replay命令即可成功解析、重放从HCI日志解析ble-replay-pbtsnoop_hci.log-ofreplay_data.json或从PCAP解析ble-replay-ppcapture.pcap-ofreplay_data.json重放JSONble-replay-ifreplay_data.json-r-i0-dAA:BB:CC:DD:EE:FF-tpublic解析重放HCI日志ble-replay-pbtsnoop_hci.log-r-i0-dAA:BB:CC:DD:EE:FF-tpublicdeepin25deepin不自带python2先通过pyenv安装python 2.7.18安装成功后切换到python2环境安装系统依赖sudoaptinstall-ylibbluetooth-dev完成后进入根目录安装项目依赖pip2install-rrequirements.txt-ihttp://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com执行setup.pypython setup.pyinstall刷新pyenv否则找不到 ble-replay 命令pyenv rehash现在运行 ble-replay 可能会报错通过降级pyshark和scapy依赖包版本后解决pip uninstall pyshark pipinstallpyshark0.3.8 pip uninstall scapy pipinstallscapy2.4.4由于是安装到普通用户目录下的pyenv里所以使用sudo调用该工具时需要手动指定绝对路径