Using text2pcap tool

The text2pcap tool is allowing you to create PCAP filed from text files. Here is a simple example how to convert a text file containing three Bluetooth 5 Advertising Extension packets into PCAP file.

sample.txt

# ADV_EXT_IND
0.0
0000 00 c1 80 00 d6 be 89 8e 13 0c d6 be 89 8e 47 0d
0010 0c 19 ec f1 95 13 df 41 b2 17 0c c3 1e 00 00 00

# ADV_AUX_IND
0.236250
0000 0e c3 80 00 d6 be 89 8e 13 0c d6 be 89 8e 47 ff
0010 06 18 b2 17 0d 53 00 5d 16 45 23 11 22 33 44 55
0020 66 77 88 99 00 11 22 33 44 55 66 77 88 99 00 11
0030 22 33 44 55 66 77 88 99 00 11 22 33 44 55 66 77
0040 88 99 00 11 22 33 44 55 66 77 88 99 00 11 22 33
0050 44 55 66 77 88 99 00 11 22 33 44 55 66 77 88 99
0060 00 11 22 33 44 55 66 77 88 99 00 11 22 33 44 55
0070 66 77 88 99 00 5d 16 56 34 11 22 33 44 55 66 77
0080 88 99 00 11 22 33 44 55 66 77 88 99 00 11 22 33
0090 44 55 66 77 88 99 00 11 22 33 44 55 66 77 88 99
00a0 00 11 22 33 44 55 66 77 88 99 00 11 22 33 44 55
00b0 66 77 88 99 00 11 22 33 44 55 66 77 88 99 00 11
00c0 22 33 44 55 66 77 88 99 00 11 22 33 44 55 66 77
00d0 88 99 00 5d 16 34 12 11 22 33 44 55 66 77 88 99
00e0 00 11 22 33 44 55 66 77 88 99 00 11 22 33 44 55
00f0 66 77 88 99 00 11 22 33 44 55 66 77 88 99 00 11
0100 22 33 44 55 66 77 88 99 00 11 22 33 44 55 66 00
0110 00 00

# ADV_CHAIN_IND
0.238740
0000 0d c3 80 00 d6 be 89 8e 13 0c d6 be 89 8e 47 26
0010 03 08 b2 17 77 88 99 00 11 22 33 44 55 66 77 88
0020 99 00 11 22 33 44 55 66 77 88 99 00 11 22 33 44
0030 55 66 77 88 99 00 00 00 00


To convert sample.txt file into sample.pcap file uses the following invocation:

text2pcap.exe -l 256 sample.txt sample.pcap -t "%S."

Input from: sample.txt
Output to: sample.pcap
Output format: pcap
Wrote packet of 32 bytes.
Wrote packet of 274 bytes.
Wrote packet of 57 bytes.
Read 3 potential packets, wrote 3 packets (435 bytes).


You can check sample.pcap using tshark.

tshark.exe -r sample.pcap

    1   0.000000 41:df:13:95:f1:ec → Broadcast    LE LL 32  ADV_EXT_IND
    2   0.236250    Anonymous → Broadcast    LE LL 274 Service Data - 16 bit UUID,Service Data - 16 bit UUID,Service Data - 16 bit UUID AUX_COMMON
    3   0.238740    Anonymous → Broadcast    LE LL 57 0x88 AUX_COMMON

Comments

Popular posts from this blog

Bluetooth 5 Advertising Extensions demo using Nordic nRF52840

Pcap files and sed