repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/pwn/randomness/solver-template.py
ctfs/TAMUctf/2023/pwn/randomness/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="randomness") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/pwn/pointers/solver-template.py
ctfs/TAMUctf/2023/pwn/pointers/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="pointers") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/rev/absolute-cap/solver-template.py
ctfs/TAMUctf/2023/rev/absolute-cap/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="absolute-cap") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/embedded/Courier/solver-template.py
ctfs/TAMUctf/2023/embedded/Courier/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="courier") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/crypto/md5/server.py
ctfs/TAMUctf/2023/crypto/md5/server.py
import hashlib import subprocess def md5sum(b: bytes): return hashlib.md5(b).digest()[:3] whitelisted_cmd = b'echo lmao' whitelisted_hash = md5sum(whitelisted_cmd) def main(): while True: cmd = input('> ').encode() if cmd == b'exit': print('Goodbye') exit() i...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/crypto/md5/solver-template.py
ctfs/TAMUctf/2023/crypto/md5/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="md5") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/crypto/shmooving-3/solver-template.py
ctfs/TAMUctf/2023/crypto/shmooving-3/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="shmooving-3") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/crypto/shmooving/solver-template.py
ctfs/TAMUctf/2023/crypto/shmooving/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="shmooving") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/crypto/vigenot/chall.py
ctfs/TAMUctf/2023/crypto/vigenot/chall.py
import re from flag import flag, key alpha = 'abcdefghijklmnopqrstuvwxyz' regex = re.compile('[^a-zA-Z]') msg = flag key = key def encrypt(msg, key): ctxt = '' msg = regex.sub('', msg).lower() key = regex.sub('', key).lower() for i in range(len(msg)): index = alpha.index(msg[i]) ^ alpha.index(key[i % len(key...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/crypto/prng/server.py
ctfs/TAMUctf/2023/crypto/prng/server.py
import secrets from flag import flag, m, a, c class Rand: def __init__(self, seed): self.m = m self.a = a self.c = c self.seed = seed if seed % 2 == 0: # initial state must be odd self.seed += 1 def rand(self): self.seed = (self.a * self.seed + self....
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/crypto/prng/solver-template.py
ctfs/TAMUctf/2023/crypto/prng/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="prng") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/crypto/numbers-pensive/server.py
ctfs/TAMUctf/2023/crypto/numbers-pensive/server.py
from Crypto.Util.number import getPrime from Crypto.Random.random import getrandbits, randint from pathlib import Path from math import gcd flag = Path("flag.txt").read_text() e = 65537 while True: p = getPrime(1024) q = getPrime(1024) n = p * q phi = (p - 1) * (q - 1) if gcd(e, phi) == 1: ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/crypto/numbers-pensive/solver-template.py
ctfs/TAMUctf/2023/crypto/numbers-pensive/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="numbers-pensive") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2023/web/connect/app.py
ctfs/TAMUctf/2023/web/connect/app.py
import flask import os def escape_shell_cmd(data): for char in data: if char in '&#;`|*?~<>^()[]{}$\\': return False else: return True app = flask.Flask(__name__) @app.route('/', methods=['GET']) def index(): return flask.render_template('index.html') @app.route('/api...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2022/pwn/quick-mafs/solver-template.py
ctfs/TAMUctf/2022/pwn/quick-mafs/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="quick-mafs") for binary in range(5): instructions = p.recvline() # the server will give you instructions as to what your exploit should do with open("elf", "wb") as file: file.write(bytes.fromhex(p.recvline().rstrip().decode())) # send whatever data...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2022/pwn/trivial/solver-template.py
ctfs/TAMUctf/2022/pwn/trivial/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="trivial") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2022/pwn/live_math_love/solver-template.py
ctfs/TAMUctf/2022/pwn/live_math_love/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="live-math-love") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2022/pwn/void/solver-template.py
ctfs/TAMUctf/2022/pwn/void/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="void") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2022/pwn/rop_golf/solver-template.py
ctfs/TAMUctf/2022/pwn/rop_golf/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="rop-golf") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2022/pwn/lucky/solver-template.py
ctfs/TAMUctf/2022/pwn/lucky/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="lucky") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2022/pwn/ctf_sim/solver-template.py
ctfs/TAMUctf/2022/pwn/ctf_sim/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="ctf-sim") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2022/pwn/one-and-done/solver-template.py
ctfs/TAMUctf/2022/pwn/one-and-done/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="one-and-done") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2022/rev/labyrinth/solver-template.py
ctfs/TAMUctf/2022/rev/labyrinth/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="labyrinth") for binary in range(5): with open("elf", "wb") as file: file.write(bytes.fromhex(p.recvline().rstrip().decode())) # send whatever data you want p.sendline(b"howdy".hex()) p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2022/rev/unboxing/solver-template.py
ctfs/TAMUctf/2022/rev/unboxing/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="unboxing") for binary in range(5): with open("elf", "wb") as file: file.write(bytes.fromhex(p.recvline().rstrip().decode())) # send whatever data you want p.sendline(b"howdy".hex()) p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2022/crypto/viktor/provided.py
ctfs/TAMUctf/2022/crypto/viktor/provided.py
import asyncio import socket import hashlib from time import sleep, time ### CONSTANTS ### PORTNUM = 49204 TIMEDPRINT = 0.08 FLAG = "[REDACTED]" CONSTHASH = "667a32132baf411ebf34c81a242d9ef4bf72e288" def timedOutput(writer, msg, delay): for c in msg: writer.write(bytes(c, "utf-8")) sleep(delay) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2022/crypto/viktor/solver-template.py
ctfs/TAMUctf/2022/crypto/viktor/solver-template.py
from pwn import * p = remote("tamuctf.com", 443, ssl=True, sni="viktor") p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2022/crypto/rs-ayyy-how-you-doin/solver-template.py
ctfs/TAMUctf/2022/crypto/rs-ayyy-how-you-doin/solver-template.py
from pwn import * # This allow for some networking magic p = remote("tamuctf.com", 443, ssl=True, sni="rs-ayyy-how-you-doin") ## YOUR CODE GOES HERE p.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2020/TOC_TO_WHO/client.py
ctfs/TAMUctf/2020/TOC_TO_WHO/client.py
import grpc import argparse import protobuf_pb2 import protobuf_pb2_grpc import signal class UserLogoutError(Exception): pass def signal_handler(signum, frame): raise UserLogoutError('Logging user out') class Client: def __init__(self,hname,p,uname): self.hostname = hname self.port = p ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2020/TOC_TO_WHO/protobuf_pb2_grpc.py
ctfs/TAMUctf/2020/TOC_TO_WHO/protobuf_pb2_grpc.py
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc import protobuf_pb2 as protobuf__pb2 class EchoServiceStub(object): """The messenger service definition. """ def __init__(self, channel): """Constructor. Args: channel: A grpc.Channel. """ self.Login = cha...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TAMUctf/2020/TOC_TO_WHO/protobuf_pb2.py
ctfs/TAMUctf/2020/TOC_TO_WHO/protobuf_pb2.py
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: protobuf.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _refl...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Berlin/pwn/spygame/setup.py
ctfs/nullconHackIM/2023-Berlin/pwn/spygame/setup.py
from distutils.core import setup, Extension def main(): setup(name="spy", version="1.0.0", description="Spy Game Module", author="Louis Burda", author_email="[email protected]", ext_modules=[Extension("spy", ["spymodule.c"])]) if __name__ == "__main__": ma...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Berlin/pwn/spygame/game.py
ctfs/nullconHackIM/2023-Berlin/pwn/spygame/game.py
#!/usr/bin/env python3 import spy from secret import flag print("Lets play a simple game!"); print(""); print("I'll give you a list of numbers, and you need to spy with"); print("your little eye which two numbers in the list are swapped"); print("as fast as possible!"); print(""); while True: print("--- New Game...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Berlin/crypto/collector/chall.py
ctfs/nullconHackIM/2023-Berlin/crypto/collector/chall.py
from Crypto.PublicKey import RSA from Crypto.Util.number import bytes_to_long, long_to_bytes from hashlib import sha256 import random from secret import flag # Parameters N = 2048 hLen = 256 def MGF(seed, length): random.seed(seed) return [random.randint(0,255) for _ in range(length)] def pad(stream, bitlength, t...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Berlin/crypto/twin/chall.py
ctfs/nullconHackIM/2023-Berlin/crypto/twin/chall.py
from Crypto.PublicKey import RSA from Crypto.Util.number import bytes_to_long from binascii import hexlify from secret import flag key1 = RSA.import_key(open('key1.pem','rb').read()) key2 = RSA.import_key(open('key2.pem','rb').read()) c1 = pow(bytes_to_long(flag), key1.e, key1.n) c2 = pow(bytes_to_long(flag), key2.e...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Berlin/crypto/learn_from_your_errors/chall.py
ctfs/nullconHackIM/2023-Berlin/crypto/learn_from_your_errors/chall.py
import numpy as np from hashlib import sha256 from Crypto.Random import random import sys import json from secret import flag class OverheatingError(Exception): pass # PARAMS n = 256 TRIGGER_CHANCE = 0.95 MAX_HEAT = 256 # CODE def random_vector(a,b,n): return np.array([random.randrange(a,b+1) for _ in range(n)],...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Berlin/crypto/breaking_news/chall.py
ctfs/nullconHackIM/2023-Berlin/crypto/breaking_news/chall.py
from Crypto.PublicKey import RSA from secret import flag from Crypto.Cipher import PKCS1_OAEP from Crypto.Util.number import inverse from binascii import hexlify key1 = RSA.import_key(open('key1.pem','rb').read()) key2 = RSA.import_key(open('key2.pem','rb').read()) msg1 = flag[:len(flag)//2] msg2 = flag[len(flag)//2:...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Berlin/crypto/noble_collector/chall.py
ctfs/nullconHackIM/2023-Berlin/crypto/noble_collector/chall.py
from Crypto.PublicKey import RSA from Crypto.Util.number import bytes_to_long import random from secret import invitation # Parameters N = 2048 male = open('malenames-usa-top1000.txt','r').read().splitlines() female = open('femalenames-usa-top1000.txt','r').read().splitlines() family = open('familynames-usa-top1000....
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Berlin/crypto/bmpass/encrypt.py
ctfs/nullconHackIM/2023-Berlin/crypto/bmpass/encrypt.py
#!/usr/bin/env python3 from Crypto.Cipher import AES import os, sys img_in = open(sys.argv[1], "rb").read() img_in += b'\00' * (16 - (len(img_in) % 16)) cipher = AES.new(os.urandom(16), AES.MODE_ECB) img_out = cipher.encrypt(img_in) open(sys.argv[1] + ".enc", "wb+").write(img_out)
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Berlin/web/reguest/code/backend.py
ctfs/nullconHackIM/2023-Berlin/web/reguest/code/backend.py
import os from flask import Flask, request, Response app = Flask(__name__) @app.route('/whoami') def whoami(): role = request.cookies.get('role','guest') really = request.cookies.get('really', 'no') if role == 'admin': if really == 'yes': resp = 'Admin: ' + os.environ['FLAG'] else: resp = 'Guest: Nope' ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Berlin/web/reguest/code/app.py
ctfs/nullconHackIM/2023-Berlin/web/reguest/code/app.py
from flask import Flask, Response, request import requests import io app = Flask(__name__) @app.route('/') def index(): s = requests.Session() cookies = {'role': 'guest'} output = io.StringIO() output.write("Usage: Look at the code ;-)\n\n") try: output.write("Overwriting cookies with default value! This mus...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Berlin/web/zpr/code/serve.py
ctfs/nullconHackIM/2023-Berlin/web/zpr/code/serve.py
from functools import partial import http.server import re PORT = 8088 HOST = "0.0.0.0" http.server.SimpleHTTPRequestHandler._orig_list_directory = http.server.SimpleHTTPRequestHandler.list_directory def better_list_directory(self, path): if not re.match(r"^/tmp/data/[0-9a-f]{32}", path): return None else: ret...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Berlin/web/zpr/code/app.py
ctfs/nullconHackIM/2023-Berlin/web/zpr/code/app.py
from flask import Flask, Response, request from werkzeug.utils import secure_filename from subprocess import check_output import io import hashlib import secrets import zipfile import os import random import glob app = Flask(__name__) app.config['MAX_CONTENT_LENGTH'] = 1.5 * 1000 # 1kb @app.route('/', methods=['GET']...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2018/pwn2-box/exploit.py
ctfs/nullconHackIM/2018/pwn2-box/exploit.py
#!/usr/bin/env python from pwn import * with context.quiet: p = process('./program', env = {'LD_PRELOAD': './libc-2.23.so'}) ''' generated from exploit.asm nasm -f bin -o sc exploit.asm ndisasm -b64 sc ''' shellcode = '\x48\x8B\x1C\x25\x60\x20\x60\x00\x48\x81\xEB\x50\x72\x0F\x0...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2025-Berlin/crypto/Field_trip/chall.py
ctfs/nullconHackIM/2025-Berlin/crypto/Field_trip/chall.py
#!/bin/python3 from hashlib import sha256 from Crypto.Util import number from Crypto.Cipher import AES BITS = 224 f = 26959946667150639794667015087019630673637144422540572481103610249993 g = 7 def reduce(a): while (l := a.bit_length()) > 224: a ^= f << (l - 225) return a def mul(a,b): res = 0 for i in range(b...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2025-Berlin/crypto/decryption_execution_service/chall.py
ctfs/nullconHackIM/2025-Berlin/crypto/decryption_execution_service/chall.py
from Crypto.Cipher import AES import os import json class PaddingError(Exception): pass flag = open('flag.txt','r').read().strip() key = os.urandom(16) def unpad(msg : bytes): pad_byte = msg[-1] if pad_byte == 0 or pad_byte > 16: raise PaddingError for i in range(1, pad_byte+1): if msg[-i] != pad_byte: raise P...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2025-Berlin/crypto/Power_tower/chall.py
ctfs/nullconHackIM/2025-Berlin/crypto/Power_tower/chall.py
from Crypto.Cipher import AES from Crypto.Util import number # n = number.getRandomNBitInteger(256) n = 107502945843251244337535082460697583639357473016005252008262865481138355040617 primes = [p for p in range(100) if number.isPrime(p)] int_key = 1 for p in primes: int_key = p**int_key key = int.to_bytes(int_key % n...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2025-Berlin/crypto/PKCS/chall.py
ctfs/nullconHackIM/2025-Berlin/crypto/PKCS/chall.py
from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_v1_5 BIT_LEN = 1024 k = RSA.generate(BIT_LEN, e = 3) flag = open('flag.txt','r').read().encode() encrypter = PKCS1_v1_5.new(k) cipher1 = encrypter.encrypt(flag).hex() cipher2 = encrypter.encrypt(flag).hex() print(len(flag)) print(k.n) print(cipher1) p...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2025-Berlin/crypto/Simple_ECDSA/ec.py
ctfs/nullconHackIM/2025-Berlin/crypto/Simple_ECDSA/ec.py
#!/usr/bin/env python3 def inverse(a,n): return pow(a,-1,n) class EllipticCurve(object): def __init__(self, p, a, b, order = None): self.p = p self.a = a self.b = b self.n = order def __str__(self): return 'y^2 = x^3 + %dx + %d modulo %d' % (self.a, self.b, self.p) def __eq__(self, other): return (se...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2025-Berlin/crypto/Simple_ECDSA/chall.py
ctfs/nullconHackIM/2025-Berlin/crypto/Simple_ECDSA/chall.py
#!/usr/bin/env python3 import os import sys import hashlib from ec import * def bytes_to_long(a): return int(a.hex(),16) #P-256 parameters p = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff a = -3 b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b n = 0xffffffff00000000fffffff...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2025-Berlin/crypto/A_slice_of_keys/chall.py
ctfs/nullconHackIM/2025-Berlin/crypto/A_slice_of_keys/chall.py
from Crypto.PublicKey import RSA from Crypto.Cipher import AES flag = open('flag.txt','r').read().strip().encode() pad = (16 - len(flag)) % 16 flag = flag + pad * int(16).to_bytes() key = RSA.generate(2048, e = 1337) n = key.n e = key.e d = key.d AES_key = int(bin(d)[2:258:2],2).to_bytes(16) crypter = AES.new(AES_ke...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Goa/crypto/Sebastians_Secret_Sharing/sss.py
ctfs/nullconHackIM/2023-Goa/crypto/Sebastians_Secret_Sharing/sss.py
#!/usr/bin/env python3 import random from decimal import Decimal,getcontext class SeSeSe: def __init__(self, s, n, t): self.s = int.from_bytes(s.encode()) self.l = len(s) self.n = n self.t = t self.a = self._a() def _a(self): c = [self.s] for i in range(self.t-1): a = Decimal(random.randint(self....
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Goa/crypto/Counting/counting.py
ctfs/nullconHackIM/2023-Goa/crypto/Counting/counting.py
#!/usr/bin/env python3 from Crypto.PublicKey import RSA from Crypto.Util import number from Crypto.Util.number import bytes_to_long, long_to_bytes import sys from secret import flag MAX_COUNT = 128 key = RSA.generate(2048, e = 1337) def loop(): print('My public modulus is:\n%d' % key.n) print('Let me count how lo...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Goa/crypto/Curvy_Decryptor_2/ec.py
ctfs/nullconHackIM/2023-Goa/crypto/Curvy_Decryptor_2/ec.py
#!/usr/bin/env python3 from Crypto.Util.number import inverse class EllipticCurve(object): def __init__(self, p, a, b, order = None): self.p = p self.a = a self.b = b self.n = order def __str__(self): return 'y^2 = x^3 + %dx + %d modulo %d' % (self.a, self.b, self.p) def __eq__(self, other): return (s...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Goa/crypto/Curvy_Decryptor_2/utils.py
ctfs/nullconHackIM/2023-Goa/crypto/Curvy_Decryptor_2/utils.py
def modular_sqrt(a, p): """ Find a quadratic residue (mod p) of 'a'. p must be an odd prime. Solve the congruence of the form: x^2 = a (mod p) And returns x. Note that p - x is also a root. 0 is returned is no square root exists for these a and p. The Tonelli-Shanks algorithm is used (except for some sim...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Goa/crypto/Curvy_Decryptor_2/curvy_decryptor.py
ctfs/nullconHackIM/2023-Goa/crypto/Curvy_Decryptor_2/curvy_decryptor.py
#!/usr/bin/env python3 import os import sys import string from Crypto.Util import number from Crypto.Util.number import bytes_to_long, long_to_bytes from Crypto.Cipher import AES from binascii import hexlify from ec import * from utils import * from secret import flag1, flag2 #P-256 parameters p = 0xffffffff000000010...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Goa/crypto/Euclidean_RSA/euclidean-RSA.py
ctfs/nullconHackIM/2023-Goa/crypto/Euclidean_RSA/euclidean-RSA.py
#!/usr/bin/env python3 from Crypto.PublicKey import RSA from Crypto.Util.number import bytes_to_long from secret import flag, magic while True: try: key = RSA.generate(2048) a,b,c,d = magic(key) break except: pass assert a**2 + b**2 == key.n assert c**2 + d**2 == key.n for _ in [a,b,c,d]: print(_) cipher = ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Goa/crypto/Curvy_Decryptor/ec.py
ctfs/nullconHackIM/2023-Goa/crypto/Curvy_Decryptor/ec.py
#!/usr/bin/env python3 from Crypto.Util.number import inverse class EllipticCurve(object): def __init__(self, p, a, b, order = None): self.p = p self.a = a self.b = b self.n = order def __str__(self): return 'y^2 = x^3 + %dx + %d modulo %d' % (self.a, self.b, self.p) def __eq__(self, other): return (s...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Goa/crypto/Curvy_Decryptor/utils.py
ctfs/nullconHackIM/2023-Goa/crypto/Curvy_Decryptor/utils.py
def modular_sqrt(a, p): """ Find a quadratic residue (mod p) of 'a'. p must be an odd prime. Solve the congruence of the form: x^2 = a (mod p) And returns x. Note that p - x is also a root. 0 is returned is no square root exists for these a and p. The Tonelli-Shanks algorithm is used (except for some sim...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Goa/crypto/Curvy_Decryptor/curvy_decryptor.py
ctfs/nullconHackIM/2023-Goa/crypto/Curvy_Decryptor/curvy_decryptor.py
#!/usr/bin/env python3 import os import sys import string from Crypto.Util import number from Crypto.Util.number import bytes_to_long, long_to_bytes from Crypto.Cipher import AES from binascii import hexlify from ec import * from utils import * from secret import flag1, flag2 #P-256 parameters p = 0xffffffff000000010...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2023-Goa/crypto/PS/ps.py
ctfs/nullconHackIM/2023-Goa/crypto/PS/ps.py
#!/usr/bin/env python3 from Crypto.PublicKey import RSA from Crypto.Util import number from Crypto.Util.number import bytes_to_long, long_to_bytes import sys from secret import flag key = RSA.generate(2048, e = 3) def encrypt(msg : bytes, key) -> int: m = bytes_to_long(msg) if m.bit_length() + 128 > key.n.bit_leng...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2022/crypto/time/decryptor.py
ctfs/nullconHackIM/2022/crypto/time/decryptor.py
#!/usr/bin/env sage from Crypto.Util.number import bytes_to_long, long_to_bytes from Crypto.PublicKey import RSA import time import sys from secret import flag key = RSA.importKey(open('privkey.pem','r').read()) def int_to_str(n): if n == 0: return '' return int_to_str(n // 256) + chr(n % 256) def str_to_int(s)...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2022/crypto/cookie_lover_reloaded/ec.py
ctfs/nullconHackIM/2022/crypto/cookie_lover_reloaded/ec.py
#!/usr/bin/env python3 from Crypto.Util.number import bytes_to_long, long_to_bytes, inverse from Crypto.Util import number class EllipticCurve(object): def __init__(self, p, a, b, order = None): self.p = p self.a = a self.b = b self.n = order def __str__(self): return 'y^2 = x^3 + %dx + %d modulo %d' % (s...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/nullconHackIM/2022/crypto/cookie_lover_reloaded/cookie_lover_reloaded.py
ctfs/nullconHackIM/2022/crypto/cookie_lover_reloaded/cookie_lover_reloaded.py
#!/usr/bin/env python3 import os import sys import hashlib from ec import * from secret import flag #P-256 parameters p = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff a = -3 b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b n = 0xffffffff00000000ffffffffffffffffbce6faada7179...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/misc/Emacro_wave_cooking/chall.py
ctfs/Potluck/2023/misc/Emacro_wave_cooking/chall.py
#!/usr/bin/python3 import subprocess import os import pty import base64 recipe = input("Give me your favourite macrowave cooking recipe! ") filename = f"/tmp/recipe-{os.urandom(32).hex()}.org" with open(filename, "wb") as f: f.write(base64.b64decode(recipe)) m, s = pty.openpty() subprocess.run(["timeout", "15", ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/misc/tacocat/main.py
ctfs/Potluck/2023/misc/tacocat/main.py
#!/usr/local/bin/python while True:# x = input("palindrome? ")# assert "#" not in x, "comments are bad"# assert all(ord(i) < 128 for i in x), "ascii only kthx"# assert x == x[::-1], "not a palindrome"# assert len(x) < 36, "palindromes can't be more than 35 characters long, this is a well known fact....
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/crypto/lima_beans_with_lemon_and_lime/final.py
ctfs/Potluck/2023/crypto/lima_beans_with_lemon_and_lime/final.py
#!/usr/bin/env python3 from Crypto.Util.number import getPrime, bytes_to_long from secrets import randbelow, randbits from FLAG import flag beanCount = 8 beanSize = 2048 lemonSize = beanSize // 2 * beanCount killerBean = getPrime(beanSize) queries = 17 def pkcs16(limaBeans): filledLimaBeans = [0 for _ in range(bean...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/crypto/Cookmaster_1/get_token.py
ctfs/Potluck/2023/crypto/Cookmaster_1/get_token.py
#!/usr/bin/env python3 # Adapted from https://github.com/balsn/proof-of-work import hashlib import sys import requests def is_valid(digest, zeros, difficulty): if sys.version_info.major == 2: digest = [ord(i) for i in digest] bits = ''.join(bin(i)[2:].zfill(8) for i in digest) return bits[:difficu...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/crypto/Cookmaster_1/interface/main.py
ctfs/Potluck/2023/crypto/Cookmaster_1/interface/main.py
import binascii from hashlib import sha256 from ecdsa import SigningKey from contextlib import asynccontextmanager from starlette.applications import Starlette from starlette.requests import Request from starlette.responses import JSONResponse from starlette.routing import Route, WebSocketRoute, Mount from starlette.ex...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/crypto/Cookmaster_1/interface/cleanup.py
ctfs/Potluck/2023/crypto/Cookmaster_1/interface/cleanup.py
#!/usr/bin/env python3 import sqlite3 import time import os from src.container import container_state DB_PATH=os.environ.get('DB_PATH', '/data/team_info.db') if __name__ == '__main__': while True: try: con = sqlite3.connect(DB_PATH) print('Cleaning instances') cursor ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/crypto/Cookmaster_1/interface/src/container.py
ctfs/Potluck/2023/crypto/Cookmaster_1/interface/src/container.py
import subprocess import os import docker def create_can_interface(team_id): client = docker.from_env() containers =client.containers.list(filters={"name": f"team_{team_id}-heater"}) if len(containers) != 1: raise Exception("Problem with container filtering") container = containers[0] ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/crypto/Cookmaster_1/interface/src/__init__.py
ctfs/Potluck/2023/crypto/Cookmaster_1/interface/src/__init__.py
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/crypto/Upside_down_Cake/upside_down_cake.py
ctfs/Potluck/2023/crypto/Upside_down_Cake/upside_down_cake.py
#!/usr/bin/env python3 # # Upside-down Cake by Neobeo # written for PotluckCTF 2023 # ----------- # Ingredients # You'll need 44 eggs. It's considered good luck to write letters on the eggs something or something. FLAG = b'potluck{???????????????????????????????????}' assert len(FLAG) == 44 # ----------- # Preparati...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/crypto/Cookmaster_2/get_token.py
ctfs/Potluck/2023/crypto/Cookmaster_2/get_token.py
#!/usr/bin/env python3 # Adapted from https://github.com/balsn/proof-of-work import hashlib import sys import requests def is_valid(digest, zeros, difficulty): if sys.version_info.major == 2: digest = [ord(i) for i in digest] bits = ''.join(bin(i)[2:].zfill(8) for i in digest) return bits[:difficu...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/crypto/Cookmaster_2/interface/main.py
ctfs/Potluck/2023/crypto/Cookmaster_2/interface/main.py
import binascii from hashlib import sha256 from ecdsa import SigningKey from contextlib import asynccontextmanager from starlette.applications import Starlette from starlette.requests import Request from starlette.responses import JSONResponse from starlette.routing import Route, WebSocketRoute, Mount from starlette.ex...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/crypto/Cookmaster_2/interface/cleanup.py
ctfs/Potluck/2023/crypto/Cookmaster_2/interface/cleanup.py
#!/usr/bin/env python3 import sqlite3 import time import os from src.container import container_state DB_PATH=os.environ.get('DB_PATH', '/data/team_info.db') if __name__ == '__main__': while True: try: con = sqlite3.connect(DB_PATH) print('Cleaning instances') cursor ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/crypto/Cookmaster_2/interface/src/container.py
ctfs/Potluck/2023/crypto/Cookmaster_2/interface/src/container.py
import subprocess import os import docker def create_can_interface(team_id): client = docker.from_env() containers =client.containers.list(filters={"name": f"team_{team_id}-heater"}) if len(containers) != 1: raise Exception("Problem with container filtering") container = containers[0] ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Potluck/2023/crypto/Cookmaster_2/interface/src/__init__.py
ctfs/Potluck/2023/crypto/Cookmaster_2/interface/src/__init__.py
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2021/crypto/treasure/treasure.py
ctfs/DownUnderCTF/2021/crypto/treasure/treasure.py
#!/usr/bin/python3 import re from Crypto.Util.number import long_to_bytes from Crypto.Random import random from secret import REAL_COORDS, FLAG_MSG FAKE_COORDS = 5754622710042474278449745314387128858128432138153608237186776198754180710586599008803960884 p = 133185411498479241810599477816269445781161832444535693854281...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2021/crypto/Break_Me/aes-ecb.py
ctfs/DownUnderCTF/2021/crypto/Break_Me/aes-ecb.py
#!/usr/bin/python3 import sys import os from Crypto.Cipher import AES from base64 import b64encode bs = 16 # blocksize flag = open('flag.txt', 'rb').read().strip() key = open('key.txt', 'r').read().strip().encode() # my usual password def enc(pt): cipher = AES.new(key, AES.MODE_ECB) ct = cipher.encrypt(pad(pt...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2021/web/Notepad/app.py
ctfs/DownUnderCTF/2021/web/Notepad/app.py
import datetime as dt import hashlib import os import random import secrets import aioredis import quart import quart_rate_limiter from quart_rate_limiter.redis_store import RedisStore import requests SECRET_KEY = os.environ['SECRET_KEY'] REDIS_HOST = os.environ['REDIS_HOST'] redis = aioredis.from_url(f"redis://...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2021/web/Jasons_Proxy/proxy.py
ctfs/DownUnderCTF/2021/web/Jasons_Proxy/proxy.py
#!/usr/bin/python3 import os import socketserver import urllib.request from os.path import abspath from http.server import SimpleHTTPRequestHandler from urllib.parse import unquote, urlparse, urljoin PORT = 9097 whitelist = ["http://127.0.0.1/static/images/", "http://localhost/static/images/"] blacklist = ["admin","...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2021/web/Jasons_Proxy/app.py
ctfs/DownUnderCTF/2021/web/Jasons_Proxy/app.py
#!/usr/bin/python3 import os from requests import get from base64 import b64encode, b64decode from flask import Flask, request, render_template app = Flask(__name__) class JSON(object): def __init__(self): self.forbidden = ["'","\"","{","}","[","]",",","(",")","\\",";","%"] self.checked = [] def _forbidden_ch...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2024/crypto/three_line/encrypt.py
ctfs/DownUnderCTF/2024/crypto/three_line/encrypt.py
import os, sys q, y = os.urandom(16), 0 for x in sys.stdin.buffer.read(): sys.stdout.buffer.write(bytes([q[y % 16] ^ x])); y = x
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2024/crypto/shufflebox/shufflebox.py
ctfs/DownUnderCTF/2024/crypto/shufflebox/shufflebox.py
import random PERM = list(range(16)) random.shuffle(PERM) def apply_perm(s): assert len(s) == 16 return ''.join(s[PERM[p]] for p in range(16)) for line in open(0): line = line.strip() print(line, '->', apply_perm(line))
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2024/crypto/super_party_computation/server.py
ctfs/DownUnderCTF/2024/crypto/super_party_computation/server.py
#!/usr/bin/env python3 from Crypto.PublicKey import ECC from Crypto.Signature import DSS from Crypto.Hash import SHA256 from Crypto.Math.Numbers import Integer from Crypto.Util.number import bytes_to_long, long_to_bytes, getPrime, inverse, GCD import json import secrets import os FLAG = os.getenv("FLAG", "DUCTF{testfl...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2024/crypto/kyber_decryption_oracle/kyber-decryption-oracle.py
ctfs/DownUnderCTF/2024/crypto/kyber_decryption_oracle/kyber-decryption-oracle.py
#!/usr/bin/env python3 import ctypes, os, signal import hashlib MAX_QUERIES = 56 FLAG = os.getenv('FLAG', 'DUCTF{testflag}').encode() kyber_lib = ctypes.CDLL('./libpqcrystals_kyber512_ref.so') class Kyber: def __init__(self): self.pk_buf = ctypes.c_buffer(800) self.sk_buf = ctypes.c_buffer(768)...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2024/crypto/decrypt_then_eval/decrypt-then-eval.py
ctfs/DownUnderCTF/2024/crypto/decrypt_then_eval/decrypt-then-eval.py
#!/usr/bin/env python3 from Crypto.Cipher import AES import os KEY = os.urandom(16) IV = os.urandom(16) FLAG = os.getenv('FLAG', 'DUCTF{testflag}') def main(): while True: ct = bytes.fromhex(input('ct: ')) aes = AES.new(KEY, AES.MODE_CFB, IV, segment_size=128) try: print(eval(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2024/crypto/my_array_generator/challenge.py
ctfs/DownUnderCTF/2024/crypto/my_array_generator/challenge.py
#!/usr/bin/env python3 import random import os KEY = b"DUCTF{XXXXXXXXXXXXXXXXXXXXXXXXX}" KEY_SIZE = 32 F = 2**14 class MyArrayGenerator: def __init__(self, key: bytes, n_registers: int = 128): self.key = key self.n_registers = n_registers def prepare(self): self.registers = [0 for _ ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2024/crypto/V_for_Vieta/server.py
ctfs/DownUnderCTF/2024/crypto/V_for_Vieta/server.py
#!/usr/bin/env python3 import os import random import json from enum import Enum FLAG = os.getenv("FLAG", "DUCTF{dummy_flag}") class State(Enum): INITIAL = 1 TEST = 2 QUIT = 3 class Server: def __init__(self): self.level = 2048 self.target = 2048 self.finish = 8 se...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2023/misc/mini_dns_server/mini_dns_server.py
ctfs/DownUnderCTF/2023/misc/mini_dns_server/mini_dns_server.py
import time from dnslib.server import DNSServer, BaseResolver from dnslib import RR, TXT, QTYPE, RCODE class Resolver(BaseResolver): def resolve(self, request, handler): reply = request.reply() reply.header.rcode = RCODE.reverse['REFUSED'] if len(handler.request[0]) > 72: retu...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2023/misc/daas/daas.py
ctfs/DownUnderCTF/2023/misc/daas/daas.py
#!/usr/local/bin/python3.8 import subprocess import sys import tempfile import base64 print("Welcome to my .pyc decompiler as a service!") try: pyc = base64.b64decode(input('Enter your pyc (base64):\n')) except: print('There was an error with your base64 :(') exit(1) with tempfile.NamedTemporaryFile(suffix=...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2023/misc/impossible/app/main.py
ctfs/DownUnderCTF/2023/misc/impossible/app/main.py
from flask import Flask, request, render_template from utils import decrypt app = Flask( __name__, static_url_path='/', static_folder='static/' ) @app.route('/', methods=['GET']) def index(): if not "key" in request.args: return render_template('index.html') key_hex = request.args.get...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2023/misc/impossible/app/__init__.py
ctfs/DownUnderCTF/2023/misc/impossible/app/__init__.py
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2023/misc/impossible/app/utils/crypto.py
ctfs/DownUnderCTF/2023/misc/impossible/app/utils/crypto.py
from Crypto.Protocol.KDF import PBKDF2 from Crypto.Hash import SHA512 from Crypto.Random import get_random_bytes from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad import binascii # lol u thought it would be easy that i gave you these values in the sauce code # i have changed them all on the chal...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2023/misc/impossible/app/utils/__init__.py
ctfs/DownUnderCTF/2023/misc/impossible/app/utils/__init__.py
from utils.crypto import decrypt
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2023/pwn/vroom_vroom/run.py
ctfs/DownUnderCTF/2023/pwn/vroom_vroom/run.py
#!/usr/bin/env python3 import sys import tempfile import os def main(): print('V8 version 11.6.205') print('> ', end='') sys.stdout.flush() data = sys.stdin.readline().encode() with tempfile.NamedTemporaryFile() as f: f.write(data) f.flush() os.system(f'./d8 {f.name}') ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2023/rev/pyny/pyny.py
ctfs/DownUnderCTF/2023/rev/pyny/pyny.py
#coding: punycode def _(): pass ('Correct!' if ('Enter the flag: ') == 'DUCTF{%s}' % _.____ else 'Wrong!')-gdd7dd23l3by980a4baunja1d4ukc3a3e39172b4sagce87ciajq2bi5atq4b9b3a3cy0gqa9019gtar0ck
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2023/crypto/lcg_card_gimmicks/lcg-card-gimmicks.py
ctfs/DownUnderCTF/2023/crypto/lcg_card_gimmicks/lcg-card-gimmicks.py
#!/usr/bin/env python3 from secrets import randbelow import signal DECK = [f'{val}{suit}' for suit in 'CDHS' for val in ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']] + ['RJ', 'BJ'] M = 2**64 class LCG: def __init__(self, seed, A=None, C=None): self.M = M if A is None: ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2023/crypto/dilithium/signer.py
ctfs/DownUnderCTF/2023/crypto/dilithium/signer.py
import ctypes import random dilithium_lib = ctypes.CDLL('./libpqcrystals_dilithium2_ref.so') def sign(msg, sk_buf): sm_buf = ctypes.c_buffer(1268 + len(msg)) msg_buf = ctypes.c_buffer(msg) sm_len = ctypes.pointer(ctypes.c_size_t()) dilithium_lib.pqcrystals_dilithium2_ref(sm_buf, sm_len, msg_buf, len(m...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DownUnderCTF/2023/crypto/dilithium/verifier.py
ctfs/DownUnderCTF/2023/crypto/dilithium/verifier.py
#!/usr/bin/env python3 import ctypes dilithium_lib = ctypes.CDLL('./libpqcrystals_dilithium2_ref.so') def verify(sm, pk): if len(sm) < 1268: return False msg_buf = ctypes.c_buffer(len(sm)) msg_len = ctypes.c_size_t() sm_buf = ctypes.c_buffer(sm) pk_buf = ctypes.c_buffer(pk) verified =...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false