Skip to content

Instantly share code, notes, and snippets.

View mkow's full-sized avatar

Michał Kowalczyk mkow

View GitHub Profile
@mkow
mkow / YOU_wa_SHOCKWAVE_solver.py
Created April 26, 2020 17:04
Solver for YOU wa SHOCKWAVE (re 250) from PlaidCTF 2020
from struct import pack, unpack
# reversed from the challenge
def zz_helper(x, y, z):
if y > z:
return [1, z - x]
a, b = zz_helper(y, x + y, z)
if b >= x:
return [2 * a + 1, b - x]
@mkow
mkow / The Watness 2 solver.py
Created April 26, 2020 18:06
Solver for The Watness 2 (re 450) from PlaidCTF 2020
def split_by(data, cnt):
return [data[i : i+cnt] for i in range(0, len(data), cnt)]
MAX_PATH = 150 # just some guessed estimate, should be fine
LEVELS = [
'rbrr rgb rb r brgrbrgb grrgbbg grg bgrg bbgrbg',
'rrbrb rg g bgrbgggr ggrgr gr rg brr b bggrbgbb',
'rbr bbggrgrggb bggbb b b bbrbbgg gbrrbgrbbb g',
]
@mkow
mkow / crc_hard_solver.cpp
Created January 15, 2022 22:55
Solver for CRC Recursive Challenge from Dragon CTF 2021
// Solver for CRC Recursive Challenge from Dragon CTF 2021
// Author: Michał "Redford" Kowalczyk
//
// Could probably be much simpler, but this code was evolving for too long
// without a rewrite ¯\_(ツ)_/¯
#include <iostream>
#include <cstdio>
#include <cstddef>
#include <cstring>
@mkow
mkow / backdoor_decomp.c
Last active March 31, 2024 14:05
xz decompiled backdoor key setting
// +0xABC0 (in .o)
bool ensure_calling_only_once_and_set_key_bit(
unsigned __int64 addr_to_disasm_if_valid,
unsigned int key_bit_ind,
unsigned int a3,
unsigned int ket_init_unique_id)
{
char *addr; // rax
char *retaddr; // [rsp+0h] [rbp+0h]