Newer
Older
Hardware / FaultInjection / examples / CuriousBolt / Level-1 / ConfigChall02.py
  1. ######
  2. # config to complete Level 1, Challenge 2 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 = 42
  18. REPEAT = 1
  19. DELAY = 0
  20.  
  21. ###
  22. # ^ = pullup, v = pulldown
  23. ###
  24. triggers = [
  25. ['-', False], #0
  26. ['-', False], #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 in output, function to run
  37. # if string is blank ("") doesnt show toggle, just run button
  38. ###
  39. conditions = [
  40. ["Flag", True, "ctf", "stop_glitching"],
  41. ["Chal2", True, "Hold one of", "start_chal_02"] # requires bolt output gpio pin 0 -> challenge board chall 2 button
  42. ]
  43.  
  44. ######
  45. # Custom functions for conditions to trigger
  46. ######
  47.  
  48. def stop_glitching():
  49. elapsed = functions.get_glitch_elapsed()
  50. functions.glitching_switch(False)
  51. functions.add_text(f"[auto] glitching stopped (elapsed: {elapsed})")
  52.  
  53. def start_chal_02():
  54. functions.run_output_high(0, 30000000) ## can also run_output_low() if need too
Buy Me A Coffee