Skip to content

Instantly share code, notes, and snippets.

@sprout42
sprout42 / mysha.py
Created May 31, 2024 21:04
pure python sha256 implementation and hash-length-extension proof of concept
#!/usr/bin/env python
import struct
k = [
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
diff --git a/firmware/boards/azalea/pins.h b/firmware/boards/azalea/pins.h
index 2c2ef62..20a10f6 100644
--- a/firmware/boards/azalea/pins.h
+++ b/firmware/boards/azalea/pins.h
@@ -117,9 +117,11 @@ static const scu_grp_pin_t scu_type_led[NUM_LEDS] = {
-#define ONBOARD_FLASH_DEVICE_ID 0x14 /* Expected device_id for W25Q16DV */
+// #define ONBOARD_FLASH_DEVICE_ID 0x14 #<{(| Expected device_id for W25Q16DV |)}>#
@sprout42
sprout42 / ghidra_processor_docs_downloader.py
Last active December 9, 2022 19:22 — forked from apfelchips/ghidra_processor_docs_downloader.py
Ghidra Processor Documentation Downloader
#!/usr/bin/env python3
# vim: tabstop=4:softtabstop=4:shiftwidth=4:expandtab:
import os
import sys
import requests
docs = {
'68000': {
'M68000PRM.pdf': 'https://www.nxp.com/files-static/archives/doc/ref_manual/M68000PRM.pdf',
@sprout42
sprout42 / python_crimes.py
Created September 3, 2022 01:55
fun with python
import builtins
_old_import = builtins.__import__
def _test_import(*args, **kwargs):
print('before!', args, kwargs)
# args 2 and 3 are dictionaries that have the namespace in them, remove
# evidence of our python crimes
for a in args:
if isinstance(a, dict) and '_old_import' in a:
del a['_old_import']
if isinstance(a, dict) and '_test_import' in a:
@sprout42
sprout42 / run_tests.py
Created June 2, 2022 14:46
Python unittest runner and debug tool
#!/usr/bin/env python
import gc
import os
import sys
import glob
import time
import os.path
import unittest
import unittest.case
@sprout42
sprout42 / ubuntu_pipewire_install.md
Created December 6, 2021 16:13
Instructions to replace pulseaudio with pipewire
@sprout42
sprout42 / import_test.py
Last active November 12, 2021 15:27
import fun with python!
import builtins
_old_import = builtins.__import__
def _test_import(*args, **kwargs):
print('yo!', args, kwargs)
return _old_import(*args, **kwargs)
builtins.__import__ = _test_import
import os
print('done')
@sprout42
sprout42 / floatstuff.py
Created October 22, 2021 18:41
Exploring floating point values
import struct
def single_info(val):
iee1754_val = struct.unpack('>I', struct.pack('>f', val))[0]
exp = (iee1754_val & 0x7F80_0000) >> 23
frac = iee1754_val & 0x007F_FFFF
result = (2**(exp-127)) * (1+(frac/(2**23)))
print('Single Precision:')
@sprout42
sprout42 / install_binwalk.sh
Created October 19, 2021 15:50
Easy(est) Binwalk Install
#!/bin/bash
#
# requires git and docker to be installed
git clone https://github.com/ReFirmLabs.git -b v2.3.2 $HOME/.local/src
cd $HOME/.local/src/binwalk
docker build -t binwalk:latest .
alias binwalk &> /dev/null
if [ $? -eq 0 ]; then
@sprout42
sprout42 / 3PO_challenge2.md
Last active August 12, 2021 16:00
GRIMM's 3PO Challenge 2

CAN Bus Reverse Engineering Challenge #2: Find the Door Unlock Message

Prove it! Find the “unlock” message to gain access to the car!

Background:

Unlocking the doors through CAN message injection is the "hello world" of car hacking. Different vehicles have varying numbers of CAN buses, and send different messages on those buses. The number of messages sent on the vehicle bus make it seem overwhelming to identify which message will help you achieve your goal, but if you have physical access to a vehicle you can find the right message by: