Newer
Older
Hardware / FaultInjection / examples / CuriousBolt / Level-1 / ConfigChall03.py
  1. ######
  2. # config to complete Level 1, Challenge 3 using "glitch-o-bolt"
  3. ######
  4. # LEAVE THESE IMPORTS!
  5. ######
  6. import functions
  7. import random
  8. from textual.widgets import Log
  9.  
  10. ######
  11. # config values
  12. ######
  13.  
  14. SERIAL_PORT = '/dev/ttyUSB0'
  15. BAUD_RATE = 115200
  16.  
  17. LENGTH = 6000
  18. REPEAT = 0
  19. DELAY = 1098144
  20.  
  21. ###
  22. # ^ = pullup, v = pulldown
  23. ###
  24. triggers = [
  25. ['-', False], #0
  26. ['v', True], #1
  27. ['-', False], #2
  28. ['-', False], #3
  29. ['-', False], #4
  30. ['-', False], #5
  31. ['-', False], #6
  32. ['-', False], #7
  33. ]
  34.  
  35. ###
  36. # name, enabled, string to match
  37. ###
  38. conditions = [
  39. ['Flag', True, 'ctf', 'stop_glitching'],
  40. ]
  41.  
  42. ######
  43. # Custom functions for conditions to trigger
  44. ######
  45.  
  46. def stop_glitching():
  47. elapsed = functions.get_glitch_elapsed()
  48. functions.glitching_switch(False)
  49. functions.add_text(f"[auto] glitching stopped (elapsed: {elapsed})")
Buy Me A Coffee