1
0
Fork
You've already forked HBtCaptureParser
0
No description
  • Python 44.4%
  • Java 41.4%
  • Shell 12%
  • Makefile 2.2%
2024年03月29日 12:05:29 +01:00
java_parser Fix for GB code update 2024年03月29日 12:05:28 +01:00
lib Initial commit 2022年12月12日 15:20:51 +01:00
.gitignore Update for new GB code 2023年07月24日 22:21:23 +02:00
bootstrap.sh Fix for GB code update 2024年03月29日 12:05:28 +01:00
Makefile Initial commit 2022年12月12日 15:20:51 +01:00
parse.py Update Python code to handle txt and btsnoop files 2024年03月29日 12:05:29 +01:00
parse_rfcomm.py Update 2024年01月20日 01:05:19 +01:00
README.md Update 2024年01月20日 01:05:19 +01:00
requirements.txt Update 2024年01月20日 01:05:19 +01:00
rfcomm.py Add RFCOMM support 2023年01月21日 23:06:05 +01:00

Java parser

This uses the packet parsing code we implemented in Gadgerbridge to parse bluetooth pcaps. Last tested on commit https://codeberg.org/Martin.JM/Gadgetbridge/src/branch/huawei_connect_fix.

There are a couple of steps to using this:

  1. Install the requirements for python pip install -r requirements.txt (I recommend using a virtual environment)
  2. Get the files from GB
  3. Pipe the output from parse.py (with the right arguments) to the Java application:
    ./parse.py [bluetooth.pcapng] [mac:address] | make run
    
    or
    ./parse_rfcomm.py [bluetooth.pcapng] [mac:address] | make run
    
    if the band uses RFCOMM

Also nice: pipe that to a file for easier reading (for example append | tee [file] on Linux).

Note on file format

The file format of the bluetooth.pcapng has to be supported by Scapy. Most notably, the btsnoop format is not supported. If encountered, it can easily be converted using Wireshark.

Get files from GB

The easiest way of getting the files would be using a copy.sh script like the following:

#!/bin/sh
GB=/directory/of/Gadgetbridge
rm -rf \
	java_parser/huawei \
	java_parser/util
cp -r $GB/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huawei java_parser/huawei
mkdir -p java_parser/util
cp $GB/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/CheckSums.java java_parser/util
cp $GB/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/CryptoUtils.java java_parser/util
cp $GB/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/StringUtils.java java_parser/util

Make sure to change the GB variable to the actual directory where Gadgetbridge is stored.

Then when changing a file in the packet parsing, you can just tun the following two commands to get the updated version:

./copy.sh
make bootstrap

Also run these commands after cloning the repo.