Newer
Older
BLE_CTF_V2 / lvl_00.py
#! /usr/bin/python
import binascii
import struct
import sys, os, time
import bluepy.btle as btle
  
'''
simply follow the example https://github.com/hackgnar/ble_ctf_infinity
to ensure know how to read and write to charachteristics and know the basics of how to navigate the game
understand GATT services, charachteristics and handles.. the basics.
'''

deviceMAC = open('ctf_mac.txt').read()  
p = btle.Peripheral(deviceMAC)
print ("Attached to peripheral")

handle = "0x2e"
content = "12345678901234567890"

print("Sending \"12345678901234567890\" to 0x2e")

services=p.getServices()

hex_int = int(handle, 16)
hex1 = binascii.hexlify(handle)
response = p.writeCharacteristic(hex_int, content, True)
print("Done")

p.disconnect()