[蓝牙嗅探-Ubertooth One] 千元开源蓝牙抓包 Ubertooth One 安装和使用

技术杂谈44

前言

Ubertooth One 是一款软硬件开源的蓝牙抓包器,我们本教程将采用:学习使用、分析代码、分析硬件设计、自己制作一款抓包器的路径来展开。

[蓝牙嗅探-Ubertooth One] 千元开源蓝牙抓包 Ubertooth One 安装和使用

1、编译 Ubertooth tools

1.1、准备工作

Ubertooth 需要用到 Ubertooth tools,该工具依赖 libbtbb (蓝牙 baseband 库),这两个工程都需要自己编译,因此,第一步需要安装为了编译上述工程的工具:

Debian 10 / Ubuntu 20.04 / Kali

sudo apt install cmake libusb-1.0-0-dev make gcc g++ libbluetooth-dev wget \
  pkg-config python3-numpy python3-qtpy python3-distutils python3-setuptools

1.2、编译安装 libbtbb

Bluetooth baseband library (libbtbb) 主要用来解码蓝牙数据包,编译安装操作如下:

wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz
tar -xf libbtbb-2020-12-R1.tar.gz
cd libbtbb-2020-12-R1
mkdir build
cd build
cmake ..

make
sudo make install
sudo ldconfig

1.3、编译安装 Ubertooth tools

Ubertooth 工程包含 host 端代码,主要提供:抓取蓝牙数据包、配置 Ubertooth、升级固件,编译安装操作如下:

wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz
tar -xf ubertooth-2020-12-R1.tar.xz
cd ubertooth-2020-12-R1/host
mkdir build
cd build
cmake ..

make
sudo make install
sudo ldconfig

1.4、Wireshark 插件

建议用 2.2+ 版本的 Wireshark,自带插件。下面我写了个脚本,可以一键运行并调用 Wireshark 进行抓包。

➜  bluetooth cat ubertooth_wireshark.sh
#!/bin/bash

sudo rm -rf /tmp/pipe
sudo mkfifo /tmp/pipe

echo the mac address is: $2
echo '''
HOW TO SET WIRESHARK:
    1.Click Edit -> Preferences
    2.Click Protocols -> DLT_USER
    3.Click Edit (Encapsulations Table)
    4.Click New
    5.Under DLT, select "User 0 (DLT=147)" (adjust this selection as appropriate if the error message showed a different DLT number than 147)
    6.Under Payload Protocol, enter: btle
    7.Click OK
    8.Click OK
'''

sudo killall wireshark
sudo wireshark -k -i /tmp/pipe &

echo "reset ubertooth"
sudo ubertooth-util -r

if [ "$2" != "NULL" ];then
    echo "-t<address> set connection following target (example: -t22:44:66:88:aa:cc/48)"
    sudo ubertooth-btle -t  $2
fi

if [ "$1" == "-p" ];then
    echo "-p promiscuous: sniff active connections"
    sudo ubertooth-btle -p -I -c /tmp/pipe
elif [ "$1" == "-n" ];then
    echo "-n don't follow, only print advertisements"
    sudo ubertooth-btle -n -c /tmp/pipe
elif [ "$1" == "-f" ];then
    echo "-f follow connections"
    sudo ubertooth-btle -f -I -c /tmp/pipe
else
    echo "INPUT_ERROR: sudo bash ubertooth_wireshark.sh -f BC:23:4C:00:00:01"
    exit 1
fi

echo the mac address is: $2
</address>

1.5、更新固件

当完全安装好 Ubertooth tools 之后,需要将固件更新到和上面工具软件相匹配的版本(参考第2.1节)。

2、更新及开发固件

2.1、更新固件

获取最新版本的 Ubertooth,然后解压进入 ubertooth-one-firmware-bin 目录,之后运行:

$ ubertooth-dfu -d bluetooth_rxtx.dfu -r
Switching to DFU mode...

Checking firmware signature
........................................

........................................

................

设备将会自动进入 DFU 模式然后更新固件。

[蓝牙嗅探-Ubertooth One] 千元开源蓝牙抓包 Ubertooth One 安装和使用

注:在处于非 DFU 模式,可以用 ubertooth-util -v 获取固件的信息。

2.2、开发固件

安装支持 ARM Cortex-M3 工具链:

sudo apt-get install gcc-arm-none-eabi libnewlib-arm-none-eabi

或这直接下载:https://launchpad.net/gcc-arm-embedded

编译:

cd firmware/bluetooth_rxtx/
make

烧写:

ubertooth-dfu -d bluetooth_rxtx.dfu -r

3、效果展示

运行抓包命令:

sudo bash ubertooth_wireshark.sh -f  dc:23:4D:0c:2f:5f

自动调用 wireshark 显示数据:

[蓝牙嗅探-Ubertooth One] 千元开源蓝牙抓包 Ubertooth One 安装和使用

附录

1.完整代码(GITHUB):https://github.com/greatscottgadgets/ubertooth
2.ubertooth 主页:https://greatscottgadgets.com/ubertoothone/
uBertooth 是一千元以下的开源蓝牙抓包器,实际使用存在一定的丢包率~ 专业抓包,还要买 Ellisys 之类的几万或几十万的工具~

[蓝牙嗅探-Ubertooth One] 千元开源蓝牙抓包 Ubertooth One 安装和使用

Original: https://www.cnblogs.com/zjutlitao/p/15075068.html
Author: beautifulzzzz
Title: [蓝牙嗅探-Ubertooth One] 千元开源蓝牙抓包 Ubertooth One 安装和使用



相关阅读

Title: cesium之流动线纹理实现的两种方式【转】

[蓝牙嗅探-Ubertooth One] 千元开源蓝牙抓包 Ubertooth One 安装和使用

直接上代码吧

方法一:采用自定义shader 的实现,利用cesium内置的glsl变量是纹理随着时间按照指定方向进行流动。效果图中科技感的数字流动是呈现沿着线往上流动,这种效果很适合在智慧城市数字孪生的场景中结合其他的三维地物作为装饰。我们可以看到wall的方向跟线的方向流动的方向是不一样的,wall 的流动方向是横着流动,这是着色器中的纹理方向的设置相关,我这里没有把wall的代码放出来。不过,如何更改流动方向,我相信聪明的你应该清楚如何更改了。赶紧去试一试吧。这种方式用的是addPrimiFlowline 方法

let source1 = "czm_material czm_getMaterial(czm_materialInput materialInput)\n\
{\n\
czm_material material = czm_getDefaultMaterial(materialInput);\n\
vec2 st = fract (repeat *materialInput.st);\n\
float time = czm_frameNumber * animationSpeed;\n\
vec4 colorImage = texture2D(image, vec2(st.t,fract((st.s - time)) ));\n\
vec4 fragColor;\n\
fragColor.rgb = (colorImage.rgb+color.rgb) / 1.0;\n\
fragColor = czm_gammaCorrect(fragColor);\n\
material.alpha = colorImage.a * color.a;\n\
material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n\
material.emission = fragColor.rgb;\n\
return material;\n\
}";
function addPrimitiveFlowAppear(pos){
var primitive = new Cesium.Primitive({
geometryInstances : new Cesium.GeometryInstance({
geometry : new Cesium.PolylineGeometry({
positions : pos,
width : 5,
vertexFormat : Cesium.PolylineMaterialAppearance.VERTEX_FORMAT//可以不设置,一般会根据 appearance的类型自动默认对应的类型
}),
attributes : {
//color : Cesium.ColorGeometryInstanceAttribute.fromColor(new Cesium.Color(1.0, 1.0, 1.0, 1.0))
}
}),
appearance : new Cesium.PolylineMaterialAppearance({
material :
Cesium.Material.fromType(Cesium.Material.FadeType, {
repeat: true,
fadeInColor: Cesium.Color.BLUE.withAlpha(0),
fadeOutColor: Cesium.Color.WHITE,
time: new Cesium.Cartesian2(0.0, 0.0),
fadeDirection: {
x: true,
y: false,
}
})
})

});
return primitive
}
function addPrimiFlowline(pos,fs){
var primitive = new Cesium.Primitive({
geometryInstances : new Cesium.GeometryInstance({
geometry : new Cesium.PolylineGeometry({
positions : pos,
width : 10
}),
attributes : {
//color : Cesium.ColorGeometryInstanceAttribute.fromColor(new Cesium.Color(1.0, 1.0, 1.0, 1.0))
}
}),
appearance : new Cesium.PolylineMaterialAppearance({
translucent : true
})

});
primitive.appearance.material=new Cesium.Material({
fabric: {
uniforms://uniforms,
{
image:wallMater,
animationSpeed:0,
color:Cesium.Color.GREEN.withAlpha(0.5),
repeat:new Cesium.Cartesian2(1.0,1.0)
},
source:fs
},
});
return primitive
}

// 通过设置fadetype 实现流动的线
let primi = this.addPrimitiveFlowAppear(positions)
viewer.scene.primitives.add(primi);
// 添加数字流动线

let linePos = Cesium.Cartesian3.fromDegreesArrayHeights([120.21725, 23.63556, 0,120.21725, 23.63556, 15000.0])
let linePos1 = Cesium.Cartesian3.fromDegreesArrayHeights([120.32044, 23.63392, 0, 120.32044, 23.63392, 15000.0])
let lineUniforms = {image:wallMater, animationSpeed:10,color:Cesium.Color.BLUE.withAlpha(0.6), repeat:new Cesium.Cartesian2(2.0,1.0)}
let num_line = this.addPrimiFlowline(linePos,source1)
num_line.appearance.material.uniforms=lineUniforms
let num_line1 = this.addPrimiFlowline(linePos1,source1)
num_line1.appearance.material.uniforms.color=Cesium.Color.BLACK
num_line1.appearance.material.uniforms.repeat=new Cesium.Cartesian2(2.0,1.0)
viewer.scene.primitives.add(num_line);
viewer.scene.primitives.add(num_line1);

var timex = 0;
function render() {
timex += 0.01;
if (timex >= 1.0) {
timex = 0; // 控制在0.0到1.0之间
}

primi.appearance.material.uniforms.time.x = timex;
requestAnimationFrame(render);
}
requestAnimationFrame(render);
方法二:根据cesium 内置的材质类型实现。具体介绍各位可以去API文档查看,有哪些uniforms和各个属性代表的意思也写的很清楚。示例代码看addPrimitiveFlowAppear方法。

[蓝牙嗅探-Ubertooth One] 千元开源蓝牙抓包 Ubertooth One 安装和使用

要注意:

1、cesium绘制地物有两种方式,一种是通过entity的方式。entity是cesium封装的一种高级接口,很适合上手入门。entity添加的地物可以使用如以下已经封装好的materialProperty 来组合各种材质效果,enetity详细内容参考官方文档,具体使用例子可以参考前面文章cesium property实现飞行实时姿态仿真中飞行尾部轨迹的实现

[蓝牙嗅探-Ubertooth One] 千元开源蓝牙抓包 Ubertooth One 安装和使用

另一种是primitive的方式,本文中这两个都是通过primitive来绘制几何体。他们的材质跟前面讲的property是不一样的机制,cesium通过primitive提高了渲染的自由度,让精通GLSL编程的开发者有更大的发挥舞台。在接口使用上的区别是:1、primitive通过appearance来给material赋值。2、上面列举的materialproperty是不可以在这里使用的,但是内置的几种类型材质可以使用,第二种实现方式实现就是利用内置的类型。

2、第二种实现方式中,通过内置材质类型的uniforms中的time必须是变化才能使其材质产生流动效果,因此为了让其变换,我们将其放到requstAnimation中,进行修改。有没有更好的实现方式呢,我们下期进行探讨。

原文链接:https://blog.csdn.net/qq_26991807/article/details/123429407

Original: https://www.cnblogs.com/mazhenyu/p/16138944.html
Author: 3D入魔
Title: cesium之流动线纹理实现的两种方式【转】