Newer
Older
BLE_CTF_V2 / lvl_01.py
root on 11 Mar 2022 600 bytes tidying for public release
  1. #! /usr/bin/python
  2. import binascii
  3. import struct
  4. import sys, os, time
  5. import bluepy.btle as btle
  6. '''
  7. 42 0x2A READ goodbye
  8.  
  9. fc3fd58dcdad9ab23fac
  10. '''
  11.  
  12. deviceMAC = open('ctf_mac.txt').read()
  13. p = btle.Peripheral(deviceMAC)
  14. svc=p.getServiceByUUID(0x00FF)
  15. print ("Attached to peripheral")
  16.  
  17. print("Loading level 1")
  18. hex1 = binascii.unhexlify(str('%0*x' % (4,1)))
  19. p.writeCharacteristic(0x30, hex1, withResponse=False)
  20.  
  21.  
  22. print("Reading value")
  23. hex1 = p.readCharacteristic(0x2C)
  24. hex2 = binascii.b2a_hex(hex1)
  25. hexlif2 = str(binascii.unhexlify(hex2))
  26. print("Flag: %s" % hexlif2)
  27.  
  28. p.disconnect()
Buy Me A Coffee