greatscottgadgets / ubertooth

Software, firmware, and hardware designs for Ubertooth
https://greatscottgadgets.com/ubertoothone/
GNU General Public License v2.0
1.92k stars 430 forks source link

Transmit advertisement, custom MAC custom content #347

Closed jensolsson closed 5 years ago

jensolsson commented 5 years ago

Hi

I would like to use the Ubertooth one to send a custom advertisement using a custom MAC address and in effect simulate that there are actually 10 different Bluetooth-devices advertising. Is this possible with the ubertooth one? Is there a command line tools with some parameters that I can use for this or what is the preferred approach?

Kind regards Jens

mikeryan commented 5 years ago

You can try hacking up ubertooth-btle to do what you want. You can see the following code sets very brief advertising data (flags only) and sends ADV_IND packets with the specified BD address at intervals of 100 ms:

https://github.com/greatscottgadgets/ubertooth/blob/master/host/ubertooth-tools/src/ubertooth-btle.c#L380

The simplest approach is probably to loop around something like this:

while (1) {
    cmd_le_set_adv_data(...);
    cmd_btle_slave(...);
    usleep(...); // some amount longer than 100 ms
    cmd_stop(...);
}

If you want the packets to be interleaved (i.e., one packet from one virtual device, the following packet from another, etc.) you will want to hack the firmware.

https://github.com/greatscottgadgets/ubertooth/blob/master/firmware/bluetooth_rxtx/bluetooth_rxtx.c#L2313

This function sets up the body of the packet and sends it in a loop using le_transmit(). Should be fairly straightforward to modify this to iterate through a list of different BD addresses and/or packet bodies.