First, you need an esp32 micro controller (esp32, esp32s3, or esp32c6). If you do not yet have one, I typically buy these ones from Amazon. If you are reading this because you know I will be at BSidesLV, BlackHat USA and DEFCON, you can ping me on Twitter and Ill hook you up with a pre-flashed on at co$t in Vegas.
The easiest way to get this projects firmware flashed to an ESP32 is to flash the provided pre-compiled binaries (esp32 only). You will need to install esptool Then do the following: Clone the repository
git clone https://github.com/hackgnar/ble_ctf
Chage directory into the repository
cd ble_ctf
Flash the pre-compiled binaries
esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_size 2MB --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/ble_ctf.bin
If you want to compile the code yourself, but are having issues setting up an environment, you can use the docker build method. This will provide you with a clean uniform build environment each time. To build from docker do the following:
Build your base docker image and compile the code
docker build -t blectf .
Start up a docker instance to pull out the binaries you compiled
docker run -it -v ./:/ble_ctf --name blectf blectf
Setup and build from your docker instance.
cd /ble_ctf
idf.py set-target esp32
idf.py build
You can also build for esp32s3 or esp32c6 by changing the set-target value.
Shutdown and kill your docker
exit
docker stop blectf
docker rm blectf
Flash the firmware you built (you will need esptool installed)
idf.py flash -p (PORT)
Setup your esp-idf build environment by following this documentation. Once complete, you can build and flash the code from this repository just the same as you would from the example bluetooth programs in that project which are located in /esp-idf/examples/bluetooth/
If you need a reminder, do the following once you set up your whole esp build environment from the link above.
cd ble_ctf
idf.py set-target esp32 # or esp32s3, esp32c6
idf.py build
idf.py flash -p (PORT)