Skip to content

Instantly share code, notes, and snippets.

View pawlos's full-sized avatar
🐛

Paweł Łukasik pawlos

🐛
View GitHub Profile
@pawlos
pawlos / Program.cs
Created April 6, 2020 18:12
Modification to the waiver code to handle try-catch
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace SimpleILMeasurement
{
@pawlos
pawlos / a_happy_family.py
Created March 29, 2020 18:04
Solver for "A happy family (RE)" challenge from ångstromCTF 2020
#a_happy_family solver
from z3 import *
basechars = "angstromctf20"
def toascii(v):
res = ''
for i in range(8):
res += chr(v & 0xFF)
v >>= 8
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace SimpleILMeasurement
{
@pawlos
pawlos / solveWithZ3.py
Created February 13, 2020 15:30
Solution for vv_max with emulating AVX operation with z3
from z3 import *
zero = 0
reg0 = BitVec('r0', 32*8)
reg1 = BitVec('r1', 32*8)
reg2 = BitVec('r2', 32*8)
reg3 = BitVec('r3', 32*8)
reg4 = BitVec('r4', 32*8)
reg5 = BitVec('r5', 32*8)
''' i = 0;
sum = 0xffffffff;
while (*(char *)(param_1 + i) != '\0') {
iVar1 = i + 1;
sum = sum ^ (int)*(char *)(param_1 + i);
cnt = 7;
while (i = iVar1, -1 < cnt) {
sum = -(sum & 1) & 0xedb88320 ^ sum >> 1;
cnt = cnt + -1;
}
k = "Pl3as_d0"+"n't_cR45"+"h_1n_+h!"+"s_fUnC+1"+"0n"
s = "+U]\x93\xa0C\xdd\x14"+"CR}\xe5"
print len(k), len(s)
b = []
j = 0
cnt = 0xf6
a = [0x2a,0x7c,0x2d,0x49,0x66,0x6e,0x71,0x32,
0x30,0x21,0x20,0x0a,0x41,0x5a,0x64,0x24,
0x72,0x3c,0x58,0x6f,0x5c,0x44,0x2f,0x7b,
0x4b,0x43,0x7e,0x61,0x34,0x54,0x7a,0x37,
0x29,0x59,0x5e,0x3a,0x78,0x60,0x0b,0x7d,
0x53,0x73,0x31,0x79,0x4f,0x6d,0x69,0x76,
0x23,0x0d,0x25,0x5d,0x40,0x5b,0x5f,0x4e,
0x28,0x48,0x6a,0x2c,0x56,0x51,0x75,0x67]
#include <stdio.h>
int main() {
unsigned int expected[8] = {0};
expected[0] = 0x95cb8dbd;
expected[1] = 0xf84cc79;
expected[2] = 0xb899a876;
expected[3] = 0xa5dab55;
expected[4] = 0x9a8b3bba;
data = "I&r5v1\x13\x04N^"
key = "DuMb"
import itertools
flag = [chr(ord(x) ^ (ord(y) - 7)) for x,y in zip(data, itertools.cycle(key))]
print ''.join(flag)
def encipher(num_rounds, v, key):
v0=v[0]
v1=v[1]
sum=0
delta=0x9E3779B9
for i in range(num_rounds):
v0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + key[sum & 3])
sum += delta