Skip to content

Instantly share code, notes, and snippets.

@aczid
aczid / gist:5745983
Last active December 18, 2015 07:19
Bruteforcer for BostonKeyParty CTF level 'MITM'.
import base64
import struct
from Crypto.Cipher import AES
# reduce 2^48 to 2^27-ish using time-memory tradeoff
def crack(plaintext1, ciphertext1, plaintext2, ciphertext2):
print "Cracking plaintext '%s'" % plaintext1
zeroes = "\x00"*29
for table in range(0,7):
@aczid
aczid / gas.py
Last active December 28, 2015 01:49
A disgusting Python kludge to convert from Atmel to GNU assembly syntax. If you are reading this I'm sorry. Only here as a reference.
import sys
lines = open(sys.argv[1]).readlines()
double_if=False
print "#include <avr/io.h>"
print ".global encrypt"
print ".global decrypt"
for line in lines:
if '.endmacro' in line:
line = line.replace("endmacro", "endm")
if '.db' in line:
@aczid
aczid / build.sh
Last active July 13, 2018 13:27
AVR build script for bleeding edge toolchain
# - requires git, svn, hg installed
# - will just build the bleeding edge of everything
export PREFIX=`pwd`
export PATH=$PATH:$PREFIX/bin/
export SRCDIR=$PREFIX/src/
# todo test if SRCDIR exists, then get the source
mkdir -p $SRCDIR
# get binutils/gdb, gmp, mpfr, mpc