٩( ‘ω’ )و initial release
1 parent 48556ff commit 39c2a4713c5d8e3da7859765bca08c5ff18ccf30
root authored on 3 May
Showing 13 changed files
View
58
ConfigBaudBrute.py 0 → 100644
######
# LEAVE THESE IMPORTS!
######
import functions
 
######
# config values (you can edit these to fit your environment and use case)
######
 
# Serial port settings
SERIAL_PORT = "/dev/ttyUSB0"
BAUD_RATE = 9600
 
###
# name, enabled, string to match in output, function to run
# if string is blank ("") doesnt show toggle, just run button
###
conditions = [
["Next", False, "", "uart_up"],
["Prev", False, "", "uart_down"],
]
 
######
# Custom functions for conditions to trigger
######
 
baud_rates = [300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200, 128000, 256000]
 
 
def uart_up():
current_baud = functions.get_config_value("baud_rate")
# Find the index of the current baud rate
try:
index = baud_rates.index(current_baud)
except ValueError:
# If current baud rate is not in the list, start from the lowest
index = -1
# Get the next higher baud rate (wrapping around if at the end)
new_index = (index + 1) % len(baud_rates)
new_baud = baud_rates[new_index]
functions.change_baudrate(new_baud)
functions.add_text(f"\n[Rate Up] {new_baud}")
 
def uart_down():
current_baud = functions.get_config_value("baud_rate")
# Find the index of the current baud rate
try:
index = baud_rates.index(current_baud)
except ValueError:
# If current baud rate is not in the list, start from the highest
index = len(baud_rates)
# Get the next lower baud rate (wrapping around if at the start)
new_index = (index - 1) % len(baud_rates)
new_baud = baud_rates[new_index]
functions.change_baudrate(new_baud)
functions.add_text(f"\n[Rate Down] {new_baud}")
View
52
ConfigChall02.py 0 → 100644
######
# LEAVE THESE IMPORTS!
######
import functions
import random
from textual.widgets import Log
 
######
# config values
######
 
SERIAL_PORT = '/dev/ttyUSB0'
BAUD_RATE = 115200
 
LENGTH = 42
REPEAT = 1
DELAY = 0
 
###
# ^ = pullup, v = pulldown
###
triggers = [
['-', False], #0
['-', False], #1
['-', False], #2
['-', False], #3
['-', False], #4
['-', False], #5
['-', False], #6
['-', False], #7
]
 
###
# name, enabled, string to match in output, function to run
# if string is blank ("") doesnt show toggle, just run button
###
conditions = [
["Flag", True, "ctf", "stop_glitching"],
["Chal2", True, "Hold one of", "start_chal_02"] # requires bolt output gpio pin 0 -> challenge board chall 2 button
]
 
######
# Custom functions for conditions to trigger
######
 
def stop_glitching():
elapsed = functions.get_glitch_elapsed()
functions.glitching_switch(False)
functions.add_text(f"[auto] glitching stopped (elapsed: {elapsed})")
 
def start_chal_02():
functions.run_output_high(0, 30000000) ## can also run_output_low() if need too
View
48
ConfigChall03.py 0 → 100644
######
# LEAVE THESE IMPORTS!
######
import functions
import random
from textual.widgets import Log
 
######
# config values
######
 
SERIAL_PORT = '/dev/ttyUSB0'
BAUD_RATE = 115200
 
LENGTH = 6000
REPEAT = 0
DELAY = 1098144
 
###
# ^ = pullup, v = pulldown
###
triggers = [
['-', False], #0
['v', True], #1
['-', False], #2
['-', False], #3
['-', False], #4
['-', False], #5
['-', False], #6
['-', False], #7
]
 
###
# name, enabled, string to match
###
conditions = [
['Flag', True, 'ctf', 'stop_glitching'],
]
 
######
# Custom functions for conditions to trigger
######
 
def stop_glitching():
elapsed = functions.get_glitch_elapsed()
functions.glitching_switch(False)
functions.add_text(f"[auto] glitching stopped (elapsed: {elapsed})")
View
93
ConfigChall04.py 0 → 100644
######
# LEAVE THESE IMPORTS!
######
import time
import functions
 
from pyocd.core.helpers import ConnectHelper
from pyocd.flash.file_programmer import FileProgrammer
 
######
# config values
######
 
SERIAL_PORT = '/dev/ttyUSB0'
BAUD_RATE = 115200
 
LENGTH = 50
REPEAT = 1
DELAY = 1
 
###
# name, enabled, string to match
###
conditions = [
['Start', False, '', 'start_chall_04'],
['Step1', False, '', 'step_1'],
['Step2', False, '', 'step_2'],
]
 
######
# Custom functions for conditions to trigger
######
 
def start_chall_04():
functions.add_text(f"[Chall 4] enable uart switch then hold chall 4 button to load the challenge into memory.")
functions.add_text(f"[Chall 4] once loaded hold 'boot 1' button and press 'reset' button to put in bootloader mode")
functions.add_text(f"[Chall 4] then press 'Step1'")
 
def step_1():
functions.set_uart_switch(False)
 
functions.add_text(f"\n[Chall 4] uploading firmware to ram... please wait")
 
# Connect to the target board
session = ConnectHelper.session_with_chosen_probe()
session.open()
 
# Optionally halt the target
target = session.target
target.halt()
 
# Load binary file to specified address (e.g., 0x20000000)
newFirmware = "/tmp/f103-analysis/h3/rootshell/shellcode-0xRoM.bin"
programmer = FileProgrammer(session)
programmer.program(newFirmware, base_address=0x20000000, file_format='bin')
 
# Optionally resume execution
target.resume()
# Clean up
session.close()
 
with open(newFirmware, "rb") as f:
original_data = f.read()
 
# Connect to the target
session = ConnectHelper.session_with_chosen_probe()
session.open()
 
target = session.target
target.halt()
 
# Read back the memory from the target
read_data = target.read_memory_block8(0x20000000, len(original_data))
 
# Compare
if bytes(read_data) == original_data:
functions.add_text(f"[+] Shellcode loaded successfully.")
else:
functions.add_text(f"[!] Mismatch detected. Shellcode may not have loaded correctly.")
 
session.close()
 
functions.change_baudrate(9600)
functions.add_text(f"[Chall 4] hold buttons 'boot0' and 'boot1' and press the 'glitch' button")
functions.add_text(f"[Chall 4] this single glitch will boot from SRAM")
functions.add_text(f"[Chall 4] enable UART to access 'Low-level Shell' (might need to press reset)")
functions.add_text(f"[Chall 4] then press 'Step2'")
def step_2():
functions.send_uart_message("p")
time.sleep(1)
functions.change_baudrate(115200)
View
108
ConfigDemoAll.py 0 → 100644
######
# LEAVE THESE IMPORTS!
######
import functions
import random
from textual.widgets import Log
 
######
# config values (you can edit these to fit your environment and use case)
######
 
# Serial port settings
SERIAL_PORT = "/dev/ttyUSB0"
BAUD_RATE = 115200
 
LENGTH = 10
REPEAT = 5
DELAY = 100
 
###
# ^ = pullup, v = pulldown
###
triggers = [
["^", True], #0
["-", False], #1
["v", True], #2
["-", False], #3
["-", False], #4
["-", False], #5
["-", False], #6
["-", False], #7
]
 
###
# name, enabled, string to match in output, function to run
# if string is blank ("") doesnt show toggle, just run button
###
conditions = [
["No01", False, "WillNeverMatch01", ""],
["No02", False, "WillNeverMatch02", ""],
["Heigh", False, "", "get_scroll_height"],
["AllTg", False, "", "toggle_all"],
["Trigr", False, "", "change_all_triggers"],
["Value", False, "", "random_values"],
['9600', False, '', 'change_baud_9600'],
['11520', False, '', 'change_baud_115200'],
]
 
######
# Custom functions for conditions to trigger
######
 
def get_scroll_height():
if functions.app_instance:
text_widget = functions.app_instance.query_one(".scrollable_log", Log) # Find the scrollable text area
height = text_widget.scrollable_content_region.height # Get its height
# Ensure the text is a string and append it to the Log widget
random_number = random.randint(1, 100)
new_text = f"[CONDITION] Scrollable height: {height} and Random Number: {random_number}"
functions.add_text(new_text)
functions.log_message(new_text) # Log the value
else:
functions.log_message("App instance not set!") # Debugging in case it's called too early
 
def toggle_all():
TriggersStatus = functions.get_trigger_value(0)
if TriggersStatus is True:
for i in range(8):
functions.set_trigger_value(i, False)
for i in range( len(conditions) ):
functions.set_condition_value(i, False)
else:
for i in range(8):
functions.set_trigger_value(i, True)
for i in range( len(conditions) ):
functions.set_condition_value(i, True)
 
def change_all_triggers():
for i in range(8):
current_symbol = functions.get_trigger_string(i)
cycle = ["^", "v", "-"]
next_symbol = cycle[(cycle.index(current_symbol) + 1) % len(cycle)]
functions.set_trigger_string(i, next_symbol)
 
def random_values():
functions.glitching_switch(False)
 
OrigLen = functions.get_config_value("length")
OrigRep = functions.get_config_value("repeat")
OrigDel = functions.get_config_value("delay")
 
NewLen = random.randint(1, 100)
NewRep = random.randint(1, 100)
NewDel = random.randint(1, 100)
 
functions.set_config_value("length", NewLen)
functions.set_config_value("repeat", NewRep)
functions.set_config_value("delay", NewDel)
 
functions.add_text(f"[UPDATED] length ({OrigLen} -> {NewLen}), repeat ({OrigRep} -> {NewRep}), delay ({OrigDel} -> {NewDel})")
 
def change_baud_9600():
functions.change_baudrate(9600)
functions.set_uart_switch()
 
def change_baud_115200():
functions.change_baudrate(115200)
functions.set_uart_switch(False)
View
ConfigGlitchBrute.py 0 → 100644
View
ConfigLoginBrute.py 0 → 100644
View
README.md
View
functions.py 0 → 100644
View
glitch-o-bolt.py 0 → 100644
View
img/main_tagged.png 0 → 100644
View
scope.py 0 → 100644
View
style.tcss 0 → 100644
Buy Me A Coffee