Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replay BLE advertisements from a Wireshark pcap #206

Open
mhaberler opened this issue Oct 11, 2024 · 1 comment
Open

replay BLE advertisements from a Wireshark pcap #206

mhaberler opened this issue Oct 11, 2024 · 1 comment

Comments

@mhaberler
Copy link

I am looking into replaying BLE packets (specifically advertisements) previously recorded with Wireshark and nRF sniffer

I wonder if such a "raw transmit" can be done with this library

this is how a BLE advertisement looks once recorded and exported as JSON from Wireshark (just the btle ad - full log attached):

  "btle": {
          "btle.access_address": "0x8e89bed6",
          "btle.advertising_header": "0x2560",
          "btle.advertising_header_tree": {
            "btle.advertising_header.pdu_type": "0x00",
            "btle.advertising_header.rfu.1": "0",
            "btle.advertising_header.ch_sel": "1",
            "btle.advertising_header.randomized_tx": "1",
            "btle.advertising_header.rfu.4": "0",
            "btle.advertising_header.length": "37"
          },
          "btle.length": "37",
          "btle.advertising_address": "d4:15:5c:77:56:68",
          "btcommon.eir_ad.advertising_data": {
            "btcommon.eir_ad.entry": {
              "btcommon.eir_ad.entry.length": "2",
              "btcommon.eir_ad.entry.type": "0x01",
              "btcommon.eir_ad.entry.flags.reserved": "0x00",
              "btcommon.eir_ad.entry.flags.le_bredr_support_host": "0x00",
              "btcommon.eir_ad.entry.flags.le_bredr_support_controller": "0x00",
              "btcommon.eir_ad.entry.flags.bredr_not_supported": "0x01",
              "btcommon.eir_ad.entry.flags.le_general_discoverable_mode": "0x01",
              "btcommon.eir_ad.entry.flags.le_limited_discoverable_mode": "0x00"
            },
            "btcommon.eir_ad.entry": {
              "btcommon.eir_ad.entry.length": "27",
              "btcommon.eir_ad.entry.type": "0xff",
              "btcommon.eir_ad.entry.company_id": "0x0499",
              "btcommon.eir_ad.entry.data": "05:10:ac:50:f7:bc:4a:00:48:00:28:03:fc:ad:96:68:31:19:d4:15:5c:77:56:68",
              "btcommon.eir_ad.entry.data_tree": {
                "_ws.expert": {
                  "btcommon.eir_ad.undecoded": "",
                  "_ws.expert.message": "Undecoded",
                  "_ws.expert.severity": "4194304",
                  "_ws.expert.group": "83886080"
                }
              }
            }
          },
          "btle.crc": "0xa96974"
        }

My idea would be to dump the JSON at an esp32 application, parse it and use esp-nimble-cpp to (re) transmit the capture

any suggestions how to go about it?

I could craft an NimBLEAdvertisementData from the above and transmit, but I wonder if there is a lower-level API which I could use in a more straightforward manner

thanks in advance for any suggestions

Michael

full JSON: ruuvi5668.json
same as pcapng

@h2zero
Copy link
Owner

h2zero commented Oct 11, 2024

Yes, you could do this with NimBLEAdvertisementData and just add the raw bytes to it. You could use NimBLE directly for this but would require you to implement the calls to start advertising etc as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants