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/angstromCTF/2018/crypto/gmx/gm.py | ctfs/angstromCTF/2018/crypto/gmx/gm.py | from Crypto.Util.number import *
from gmpy2 import legendre
def generate():
p = getStrongPrime(1024)
q = getStrongPrime(1024)
n = p*q
x = getRandomRange(0, n)
while legendre(x, p) != -1 or legendre(x, q) != -1:
x = getRandomRange(0, n)
return (n, x), (p, q)
def encrypt(m, pk):
n, x = pk
for b in format(int(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2018/crypto/gmx/gen.py | ctfs/angstromCTF/2018/crypto/gmx/gen.py | from Crypto import Random
import aes
import gm
flag = open('flag').read()
key = Random.new().read(16)
pk, sk = gm.generate()
encflag = aes.encrypt(key, flag)
enckey = gm.encrypt(key, pk)
with open('pk', 'w') as f:
f.write('\n'.join([str(x) for x in pk]))
with open('sk', 'w') as f:
f.write('\n'.join([str(x) for ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2018/crypto/gmx/server.py | ctfs/angstromCTF/2018/crypto/gmx/server.py | import base64
import signal
import SocketServer
import aes
import gm
PORT = 3000
message = open('message').read()
with open('sk') as f:
p = int(f.readline())
q = int(f.readline())
sk = (p, q)
class incoming(SocketServer.BaseRequestHandler):
def handle(self):
req = self.request
def receive():
buf = ''
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2018/crypto/gmx/aes.py | ctfs/angstromCTF/2018/crypto/gmx/aes.py | from Crypto import Random
from Crypto.Cipher import AES
def encrypt(k, m):
iv = Random.new().read(16)
cipher = AES.new(k, AES.MODE_CFB, iv)
return iv + cipher.encrypt(m)
def decrypt(k, c):
cipher = AES.new(k, AES.MODE_CFB, c[:16])
return cipher.decrypt(c[16:]) | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2024/misc/pycjail_returns/chall.py | ctfs/angstromCTF/2024/misc/pycjail_returns/chall.py | #!/usr/local/bin/python
import opcode
cod = bytes.fromhex(input("cod? "))
name = input("name? ")
if len(cod) > 20 or len(cod) % 2 != 0 or len(name) > 16:
print("my memory is really bad >:(")
exit(1)
# can't hack me if I just ban every opcode
banned = set(opcode.opmap.values())
for i in range(0, len(cod), 2)... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2024/pwn/presidential/source.py | ctfs/angstromCTF/2024/pwn/presidential/source.py | #!/usr/local/bin/python
import ctypes
import mmap
import sys
flag = "redacted"
print("White House declared Python to be memory safe :tm:")
buf = mmap.mmap(-1, mmap.PAGESIZE, prot=mmap.PROT_READ | mmap.PROT_WRITE | mmap.PROT_EXEC)
ftype = ctypes.CFUNCTYPE(ctypes.c_void_p)
fpointer = ctypes.c_void_p.from_buffer(buf)
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2024/crypto/PHIlosophy/chall.py | ctfs/angstromCTF/2024/crypto/PHIlosophy/chall.py | from Crypto.Util.number import getPrime
from secret import flag
p = getPrime(512)
q = getPrime(512)
m = int.from_bytes(flag.encode(), "big")
n = p * q
e = 65537
c = pow(m, e, n)
phi = (p + 1) * (q + 1)
print(f"n: {n}")
print(f"e: {e}")
print(f"c: {c}")
print(f"\"phi\": {phi}")
"""
n: 86088719452932625928188797700... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2024/crypto/tss1/tss1.py | ctfs/angstromCTF/2024/crypto/tss1/tss1.py | from hashlib import sha256
import fastecdsa.curve
import fastecdsa.keys
import fastecdsa.point
TARGET = b'flag'
curve = fastecdsa.curve.secp256k1
def input_point():
x = int(input('x: '))
y = int(input('y: '))
return fastecdsa.point.Point(x, y, curve=curve)
def input_sig():
c = int(input('c: '))
s = int(input('... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2024/crypto/tss2/tss2.py | ctfs/angstromCTF/2024/crypto/tss2/tss2.py | #!/usr/local/bin/python
from hashlib import sha256
import fastecdsa.curve
import fastecdsa.keys
import fastecdsa.point
TARGET = b'flag'
curve = fastecdsa.curve.secp256k1
def input_point():
x = int(input('x: '))
y = int(input('y: '))
return fastecdsa.point.Point(x, y, curve=curve)
def input_sig():
c = int(input... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2024/crypto/random_rabin/random_rabin.py | ctfs/angstromCTF/2024/crypto/random_rabin/random_rabin.py | from random import SystemRandom
from Crypto.Util.number import getPrime
from libnum import xgcd
random = SystemRandom()
def primegen():
while True:
p = getPrime(512)
if p % 4 == 3:
return p
def keygen():
p = primegen()
q = primegen()
n = p * q
return n, (n, p, q)
def encrypt(pk, m):
n = pk
return pow(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2024/crypto/layers/challenge.py | ctfs/angstromCTF/2024/crypto/layers/challenge.py | import hashlib
import itertools
import os
def xor(key, data):
return bytes([k ^ d for k, d in zip(itertools.cycle(key), data)])
def encrypt(phrase, message, iters=1000):
key = phrase.encode()
for _ in range(iters):
key = hashlib.md5(key).digest()
message = xor(key, message)
return mess... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2024/crypto/Simon_Says/simon_says.py | ctfs/angstromCTF/2024/crypto/Simon_Says/simon_says.py | class Simon:
n = 64
m = 4
z = 0b01100111000011010100100010111110110011100001101010010001011111
def __init__(self, k, T):
self.T = T
self.k = self.schedule(k)
def S(self, x, j):
j = j % self.n
return ((x << j) | (x >> (self.n - j))) & 0xffffffffffffffff
def schedule(self, k):
k = k[:]
for i in rang... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2024/web/pastebin/main.py | ctfs/angstromCTF/2024/web/pastebin/main.py | import hashlib
import html
import os
import secrets
from server import Server
ADMIN_PASSWORD = hashlib.md5(
f'password-{secrets.token_hex}'.encode()
).hexdigest()
pastes = {}
def add_paste(paste_id, content, admin_only=False):
pastes[paste_id] = {
'content': content,
'admin_only': admin_only... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2024/web/winds/app.py | ctfs/angstromCTF/2024/web/winds/app.py | import random
from flask import Flask, redirect, render_template_string, request
app = Flask(__name__)
@app.get('/')
def root():
return render_template_string('''
<link rel="stylesheet" href="/style.css">
<div class="content">
<h1>The windy hills</h1>
<form action="/shout"... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Classy_Cipher/classy_cipher.py | ctfs/angstromCTF/2019/crypto/Classy_Cipher/classy_cipher.py | from secret import flag, shift
def encrypt(d, s):
e = ''
for c in d:
e += chr((ord(c)+s) % 0xff)
return e
assert encrypt(flag, shift) == ':<M?TLH8<A:KFBG@V' | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Lattice_ZKP/otp.py | ctfs/angstromCTF/2019/crypto/Lattice_ZKP/otp.py | import numpy as np
from Crypto.Hash import SHAKE256
from Crypto.Util.strxor import strxor
def encrypt(s, flag):
raw = bytes(np.mod(s, 256).tolist())
shake = SHAKE256.new()
shake.update(raw)
pad = shake.read(len(flag))
return strxor(flag, pad) | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Lattice_ZKP/lwe.py | ctfs/angstromCTF/2019/crypto/Lattice_ZKP/lwe.py | import numpy as np
n = 640
q = 1 << 15
sigma = 2.75
public = lambda: np.random.randint(q, size=(n, n))
secret = lambda: np.random.randint(q, size=n)
error = lambda: np.rint(np.random.normal(0, sigma, n)).astype(int)
def add(x, y):
return np.mod(x+y, q)
def mul(A, x):
return np.mod(np.matmul(A, x), q)
def sample(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Lattice_ZKP/server.py | ctfs/angstromCTF/2019/crypto/Lattice_ZKP/server.py | import binascii
import numpy as np
import socketserver
from Crypto.Util.asn1 import DerSequence
import lwe
welcome = rb'''
__ __ __ _ __
/ /___ _/ /_/ /_(_)_______ ____ / /______
/ / __ `/ __/ __/ / ___/ _ \ /_ / / //_/ __ \
/ / /_/ / /_/ /_/ / /__/ __/ / /_/ ,... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Secret_Sheep_Society/__init__.py | ctfs/angstromCTF/2019/crypto/Secret_Sheep_Society/__init__.py | from .app import app | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Secret_Sheep_Society/manager.py | ctfs/angstromCTF/2019/crypto/Secret_Sheep_Society/manager.py | import base64
import json
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
class Manager:
BLOCK_SIZE = AES.block_size
def __init__(self, key):
self.key = key
def pack(self, session):
cipher = AES.new(self.key, AES.MODE_CBC)
iv = cipher.iv
dec = json.dumps(session).encode()
enc ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Secret_Sheep_Society/app.py | ctfs/angstromCTF/2019/crypto/Secret_Sheep_Society/app.py | from flask import Flask
from flask import request
from flask import redirect, render_template
from .secret import flag, key
from .manager import Manager
app = Flask(__name__)
manager = Manager(key)
@app.route('/')
def index():
try:
token = request.cookies.get('token')
session = manager.unpack(token)
return re... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Random_ZKP/otp.py | ctfs/angstromCTF/2019/crypto/Random_ZKP/otp.py | import numpy as np
from Crypto.Hash import SHAKE256
from Crypto.Util.strxor import strxor
def encrypt(s, flag):
raw = bytes(np.mod(s, 256).tolist())
shake = SHAKE256.new()
shake.update(raw)
pad = shake.read(len(flag))
return strxor(flag, pad) | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Random_ZKP/lwe.py | ctfs/angstromCTF/2019/crypto/Random_ZKP/lwe.py | import numpy as np
import os
from Crypto.Util.number import getRandomInteger
n = 640
b = 15
q = 1 << b
sigma = 2.75
public = lambda: np.array([[getRandomInteger(b) for _ in range(n)] for _ in range(n)])
secret = lambda: np.array([getRandomInteger(b) for _ in range(n)])
def error():
np.random.seed(getRandomInteger(3... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Random_ZKP/server.py | ctfs/angstromCTF/2019/crypto/Random_ZKP/server.py | import binascii
import numpy as np
import signal
import socketserver
from Crypto.Util.asn1 import DerSequence
import lwe
welcome = rb'''
__ __
_________ _____ ____/ /___ ____ ___ ____ / /______
/ ___/ __ `/ __ \/ __ / __ \/ __ `__ \ /_ / / //_/... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Half_and_Half/half_and_half.py | ctfs/angstromCTF/2019/crypto/Half_and_Half/half_and_half.py | from secret import flag
def xor(x, y):
o = ''
for i in range(len(x)):
o += chr(ord(x[i])^ord(y[i]))
return o
assert len(flag) % 2 == 0
half = len(flag)//2
milk = flag[:half]
cream = flag[half:]
assert xor(milk, cream) == '\x15\x02\x07\x12\x1e\x100\x01\t\n\x01"' | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Powerball/server.py | ctfs/angstromCTF/2019/crypto/Powerball/server.py | import socketserver
from Crypto.Util.number import getRandomRange
from secret import flag
welcome = b'''\
************ ANGSTROMCTF POWERBALL ************
Correctly guess all 6 ball values ranging from 0
to 4095 to win the jackpot! As a special deal,
we'll also let you secretly view a ball's value!
'''
with open('... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Paint/paint.py | ctfs/angstromCTF/2019/crypto/Paint/paint.py | import binascii
import random
from secret import flag
image = int(binascii.hexlify(flag), 16)
palette = 1 << 2048
base = random.randint(0, palette) | 1
secret = random.randint(0, palette)
my_mix = pow(base, secret, palette)
print('palette: {}'.format(palette))
print('base: {}'.format(base))
print('my mix: {}'.forma... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Eightball/benaloh.py | ctfs/angstromCTF/2019/crypto/Eightball/benaloh.py | from gmpy2 import div, gcd, invert, powmod
from Crypto.Util.number import getPrime, getRandomRange
def unpack(fn):
with open(fn, 'r') as f:
return tuple([int(x) for x in f.readlines()])
def pack(fn, k):
with open(fn, 'w') as f:
f.write('\n'.join([str(x) for x in k]))
def generate():
r = 257
while True:
p ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/Eightball/server.py | ctfs/angstromCTF/2019/crypto/Eightball/server.py | import binascii
import socketserver
from Crypto.Random.random import choice
from Crypto.Util.asn1 import DerSequence
import benaloh
answers = [
b'It is certain',
b'It is decidedly so',
b'Without a doubt',
b'Yes definitely',
b'You may rely on it',
b'As I see it, yes',
b'Most likely',
b'Outlook good',
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/MAC_Forgery/cbc_mac.py | ctfs/angstromCTF/2019/crypto/MAC_Forgery/cbc_mac.py | from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
from Crypto.Util.Padding import pad
from Crypto.Util.number import long_to_bytes
from Crypto.Util.strxor import strxor
split = lambda s, n: [s[i:i+n] for i in range(0, len(s), n)]
class CBC_MAC:
BLOCK_SIZE = 16
def __init__(self, key):
sel... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/MAC_Forgery/server.py | ctfs/angstromCTF/2019/crypto/MAC_Forgery/server.py | import binascii
import socketserver
from cbc_mac import CBC_MAC
from secret import flag, key
welcome = b'''\
If you provide a message (besides this one) with
a valid message authentication code, I will give
you the flag.'''
cbc_mac = CBC_MAC(key)
def handle(self):
iv, t = cbc_mac.generate(welcome)
self.write(welc... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/crypto/WALL-E/wall-e.py | ctfs/angstromCTF/2019/crypto/WALL-E/wall-e.py | from Crypto.Util.number import getPrime, bytes_to_long, inverse
from secret import flag
assert(len(flag) < 87) # leave space for padding since padding is secure
p = getPrime(1024)
q = getPrime(1024)
n = p*q
e = 3
d = inverse(e,(p-1)*(q-1))
m = bytes_to_long(flag.center(255,"\x00")) # pad on both sides for extra secur... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/web/Madlibbin/__init__.py | ctfs/angstromCTF/2019/web/Madlibbin/__init__.py | from .app import app | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/web/Madlibbin/app.py | ctfs/angstromCTF/2019/web/Madlibbin/app.py | import binascii
import json
import os
import re
import redis
from flask import Flask
from flask import request
from flask import redirect, render_template
from flask import abort
app = Flask(__name__)
app.secret_key = os.environ.get('FLAG')
redis = redis.Redis(host='madlibbin_redis', port=6379, db=0)
generate = lam... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2019/web/NaaS/app.py | ctfs/angstromCTF/2019/web/NaaS/app.py | from flask import Flask, request, redirect, make_response
app = Flask(__name__)
import requests
import json
import subprocess
import random
pastes = {}
html = """<!doctype html>
<html>
<head>
<title>Yet Another Pastebin</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/s... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2023/pwn/SailorsRevenge/solve.py | ctfs/angstromCTF/2023/pwn/SailorsRevenge/solve.py | # sample solve script to interface with the server
from pwn import *
# feel free to change this
account_metas = [
("program", "-r"), # readonly
("user", "sw"), # signer + writable
("vault", "-w"), # writable
("sailor union", "-w"),
("registration", "-w"),
("rich boi", "-r"),
("system progra... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2023/rev/Uncertainty/stego.py | ctfs/angstromCTF/2023/rev/Uncertainty/stego.py | msg = b'REDACTED'
msgb = '0' + bin(int(msg.hex(), 16))[2:]
f = open("uncertainty", "rb").read()
b = list(f)
i = 0
bitnum = 6
for a in range(len(b)):
b[a] = (b[a] & ~(1 << bitnum)) | ((1 if msgb[i] == '1' else 0) << bitnum)
i += 1
if len(msgb) == i: i = 0
open("uncertainty_modified", "wb").write(bytes(b))
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2023/crypto/RoyalSocietyofArts2/rsa2.py | ctfs/angstromCTF/2023/crypto/RoyalSocietyofArts2/rsa2.py | from Crypto.Util.number import getStrongPrime, bytes_to_long, long_to_bytes
f = open("flag.txt").read()
m = bytes_to_long(f.encode())
p = getStrongPrime(512)
q = getStrongPrime(512)
n = p*q
e = 65537
c = pow(m,e,n)
print("n =",n)
print("e =",e)
print("c =",c)
d = pow(e, -1, (p-1)*(q-1))
c = int(input("Text to decrypt... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2023/crypto/millionaires/millionaires.py | ctfs/angstromCTF/2023/crypto/millionaires/millionaires.py | #!/usr/local/bin/python
import private_set_intersection.python as psi
import base64
import secrets
def fake_psi(a, b):
return [i for i in a if i in b]
def zero_encoding(x, n):
ret = []
s = bin(x)[2:].zfill(n)
for i in range(n):
if s[i] == "0":
ret.append(s[:i] + "1")
retur... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2023/crypto/snap-circuits/snap-circuits.py | ctfs/angstromCTF/2023/crypto/snap-circuits/snap-circuits.py | #!/usr/local/bin/python
from collections import namedtuple
from Crypto.Hash import SHAKE128
from Crypto.Random import get_random_bytes, random
from Crypto.Util.strxor import strxor
def get_truth_table(op):
match op:
case 'and':
return [
[0, 0, 0],
[0, 1, 0],
[1, 0, 0],
[1, 1, 1],
]
case 'xo... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2023/crypto/RoyalSocietyofArts/rsa.py | ctfs/angstromCTF/2023/crypto/RoyalSocietyofArts/rsa.py | from Crypto.Util.number import getStrongPrime, bytes_to_long
f = open("flag.txt").read()
m = bytes_to_long(f.encode())
p = getStrongPrime(512)
q = getStrongPrime(512)
n = p*q
e = 65537
c = pow(m,e,n)
print("n =",n)
print("e =",e)
print("c =",c)
print("(p-2)*(q-1) =", (p-2)*(q-1))
print("(p-1)*(q-2) =", (p-1)*(q-2)) | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2023/crypto/LazyLagrange/lazylagrange.py | ctfs/angstromCTF/2023/crypto/LazyLagrange/lazylagrange.py | #!/usr/local/bin/python
import random
with open('flag.txt', 'r') as f:
FLAG = f.read()
assert all(c.isascii() and c.isprintable() for c in FLAG), 'Malformed flag'
N = len(FLAG)
assert N <= 18, 'I\'m too lazy to store a flag that long.'
p = None
a = None
M = (1 << 127) - 1
def query1(s):
if len(s) > 100:
return '... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2023/crypto/tau-as-a-service/taas.py | ctfs/angstromCTF/2023/crypto/tau-as-a-service/taas.py | #!/usr/local/bin/python
from blspy import PrivateKey as Scalar
# order of curve
n = 0x73EDA753299D7D483339D80809A1D80553BDA402FFFE5BFEFFFFFFFF00000001
with open('flag.txt', 'rb') as f:
tau = int.from_bytes(f.read().strip(), 'big')
assert tau < n
while True:
d = int(input('gimme the power: '))
assert 0 < d < n
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2023/crypto/ranch/ranch.py | ctfs/angstromCTF/2023/crypto/ranch/ranch.py | import string
f = open("flag.txt").read()
encrypted = ""
shift = int(open("secret_shift.txt").read().strip())
for i in f:
if i in string.ascii_lowercase:
encrypted += chr(((ord(i) - 97 + shift) % 26)+97)
else:
encrypted += i
print(encrypted) | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2023/crypto/impossible/impossible.py | ctfs/angstromCTF/2023/crypto/impossible/impossible.py | #!/usr/local/bin/python
def fake_psi(a, b):
return [i for i in a if i in b]
def zero_encoding(x, n):
ret = []
for i in range(n):
if (x & 1) == 0:
ret.append(x | 1)
x >>= 1
return ret
def one_encoding(x, n):
ret = []
for i in range(n):
if x & 1:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2023/web/CelesteTunnelingAssociation/server.py | ctfs/angstromCTF/2023/web/CelesteTunnelingAssociation/server.py | # run via `uvicorn app:app --port 6000`
import os
SECRET_SITE = b"flag.local"
FLAG = os.environ['FLAG']
async def app(scope, receive, send):
assert scope['type'] == 'http'
headers = scope['headers']
await send({
'type': 'http.response.start',
'status': 200,
'headers': [
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2023/web/brokenlogin/app.py | ctfs/angstromCTF/2023/web/brokenlogin/app.py | from flask import Flask, make_response, request, escape, render_template_string
app = Flask(__name__)
fails = 0
indexPage = """
<html>
<head>
<title>Broken Login</title>
</head>
<body>
<p style="color: red; fontSize: '28px';">%s</p>
<p>Number of failed logins: {{ fails }}</p>
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2022/crypto/RandomlySampledAlgorithm/rsa.py | ctfs/angstromCTF/2022/crypto/RandomlySampledAlgorithm/rsa.py | from Crypto.Util.number import getStrongPrime
f = [REDACTED]
m = int.from_bytes(f,'big')
p = getStrongPrime(512)
q = getStrongPrime(512)
n = p*q
e = 65537
c = pow(m,e,n)
print("n =",n)
print("e =",e)
print("c =",c)
print("phi =",(p-1)*(q-1))
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2022/crypto/Strike-SlipFault/fault.py | ctfs/angstromCTF/2022/crypto/Strike-SlipFault/fault.py | #!/usr/local/bin/python3
from Crypto.Util.number import getStrongPrime, long_to_bytes, bytes_to_long, inverse
from secrets import randbelow, token_bytes
print("Welcome to my super secret service! (under construction)")
BITS = 4096
p = getStrongPrime(BITS//2)
q = getStrongPrime(BITS//2)
n = p*q
phi = (p-1)*(q-1)
e =... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2022/crypto/VinegarFactory/main.py | ctfs/angstromCTF/2022/crypto/VinegarFactory/main.py | #!/usr/local/bin/python3
import string
import os
import random
with open("flag.txt", "r") as f:
flag = f.read().strip()
alpha = string.ascii_lowercase
def encrypt(msg, key):
ret = ""
i = 0
for c in msg:
if c in alpha:
ret += alpha[(alpha.index(key[i]) + alpha.index(c)) % len(alph... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2022/crypto/RSA-AES/rsaaes.py | ctfs/angstromCTF/2022/crypto/RSA-AES/rsaaes.py | from Crypto.Util.number import bytes_to_long, long_to_bytes
from Crypto.Util.Padding import pad
from Crypto.Random import get_random_bytes
from Crypto.Cipher import AES
from secret import flag, d
assert len(flag) < 256
n = 0xbb7bbd6bb62e0cbbc776f9ceb974eca6f3d30295d31caf456d9bec9b98822de3cb941d3a40a0fba531212f338e767... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2020/crypto/one_time_bad/server.py | ctfs/angstromCTF/2020/crypto/one_time_bad/server.py | import random, time
import string
import base64
import os
def otp(a, b):
r = ""
for i, j in zip(a, b):
r += chr(ord(i) ^ ord(j))
return r
def genSample():
p = ''.join([string.ascii_letters[random.randint(0, len(string.ascii_letters)-1)] for _ in range(random.randint(1, 30))])
k = ''.join([string.ascii_letters... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2020/crypto/Dream_Stream/chall.py | ctfs/angstromCTF/2020/crypto/Dream_Stream/chall.py | from __future__ import print_function
import random,os,sys,binascii
from Crypto.Util.number import isPrime
from decimal import *
try:
input = raw_input
except:
pass
getcontext().prec = 3000
def keystream(key):
random.seed(int(os.environ["seed"]))
p = random.randint(3,30)
while not isPrime(p):
p = random.randint(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2020/crypto/Wacko_Images/image-encryption.py | ctfs/angstromCTF/2020/crypto/Wacko_Images/image-encryption.py | from numpy import *
from PIL import Image
flag = Image.open(r"flag.png")
img = array(flag)
key = [41, 37, 23]
a, b, c = img.shape
for x in range (0, a):
for y in range (0, b):
pixel = img[x, y]
for i in range(0,3):
pixel[i] = pixel[i] * key[i] % 251
img[x][y] = pixel
enc = I... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2020/crypto/RSA-OTP/chall.py | ctfs/angstromCTF/2020/crypto/RSA-OTP/chall.py | from Crypto.Util.number import bytes_to_long
from Crypto.Random.random import getrandbits # cryptographically secure random get pranked
from Crypto.PublicKey import RSA
from secret import d, flag
# 1024-bit rsa is unbreakable good luck
n = 13601850410345074497322690984230206854815209107599205792454210950861918475537676... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2020/crypto/Confused_Streaming/chall.py | ctfs/angstromCTF/2020/crypto/Confused_Streaming/chall.py | from __future__ import print_function
import random,os,sys,binascii
from decimal import *
try:
input = raw_input
except:
pass
getcontext().prec = 1000
def keystream(key):
random.seed(int(os.environ["seed"]))
e = random.randint(100,1000)
while 1:
d = random.randint(1,100)
ret = Decimal('0.'+str(key ** e).split(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2020/web/LeetTube/leettube.py | ctfs/angstromCTF/2020/web/LeetTube/leettube.py | #!/usr/bin/env python
from http.server import HTTPServer, BaseHTTPRequestHandler
import urllib.parse
import os
videos = []
for file in os.listdir('videos'):
os.chmod('videos/'+file, 0o600)
videos.append({'title': file.split('.')[0], 'path': 'videos/'+file, 'content': open('videos/'+file, 'rb').read()})
published = [... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/angstromCTF/2020/web/Secret_Agents/app.py | ctfs/angstromCTF/2020/web/Secret_Agents/app.py | from flask import Flask, render_template, request
#from flask_limiter import Limiter
#from flask_limiter.util import get_remote_address
from .secret import host, user, passwd, dbname
import mysql.connector
dbconfig = {
"host":host,
"user":user,
"passwd":passwd,
"database":dbname
}
app = Flask(__name__)
"""
lim... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2024/misc/Your_papers_please/server.py | ctfs/TBTL/2024/misc/Your_papers_please/server.py | #!/usr/bin/python3
import base64
import datetime
import json
import os
import signal
import humanize
import jwt
# openssl ecparam -name secp521r1 -genkey -noout -out private.key
# openssl ec -in private.key -pubout -out public.pem
PUBLIC_KEY = u'''-----BEGIN PUBLIC KEY-----
MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBGOtyc... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2024/pwn/Squeezing_Tightly_On_Arm/squeezing_tightly_on_arm.py | ctfs/TBTL/2024/pwn/Squeezing_Tightly_On_Arm/squeezing_tightly_on_arm.py | import sys
version = sys.version_info
del sys
FLAG = 'TBTL{...}'
del FLAG
def check(command):
if len(command) > 120:
return False
allowed = {
"'": 0,
'.': 1,
'(': 1,
')': 1,
'/': 1,
'+': 1,
}
for char, count in allowed.items():
if... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2024/pwn/Pwn_From_the_Past/server.py | ctfs/TBTL/2024/pwn/Pwn_From_the_Past/server.py | #!/usr/bin/python3
import base64
import os
import shutil
import signal
import subprocess
import tempfile
def myprint(s):
print(s, flush=True)
def handler(_signum, _frame):
myprint("Time out!")
exit(0)
def main():
signal.signal(signal.SIGALRM, handler)
signal.alarm(10)
myprint("Enter cont... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2024/pwn/A_Day_at_the_Races/server.py | ctfs/TBTL/2024/pwn/A_Day_at_the_Races/server.py | #!/usr/bin/python3
import base64
import hashlib
import io
import signal
import string
import subprocess
import sys
import time
REVIEWED_SOURCES = [
"24bf297fff03c69f94e40da9ae9b39128c46b7fe", # fibonacci.c
"55c53ce7bc99001f12027b9ebad14de0538f6a30", # primes.c
]
def slow_print(s, baud_rate=0.1):
for le... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2024/crypto/University_Paper/chall.py | ctfs/TBTL/2024/crypto/University_Paper/chall.py | from Crypto.Util.number import *
from redacted import FLAG
ESSAY_TEMPLATE = """
On the Estemeed Scientifc Role Model of Mine
============================================
Within the confines of this academic setting, the individual whom
I hold in highest regard not only boasts an engaging smile but also
possesses a re... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2024/crypto/School_Essay/chall.py | ctfs/TBTL/2024/crypto/School_Essay/chall.py | from Crypto.Util.number import *
from redacted import FLAG
ESSAY_TEMPLATE = """
My Favorite Classmate
=====================
My favorite person in this class has a beautiful smile,
great sense of humour, and lots of colorful notebooks.
However, their most distinctive feature is the fact that
you can represent their n... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2024/crypto/Cursed_Decryption/server.py | ctfs/TBTL/2024/crypto/Cursed_Decryption/server.py | #!/usr/bin/python3
from Crypto.Util.number import *
from Crypto.Random import random
from redacted import FLAG
import signal
BANNER = (
" \n"
' ( " ) Just a small dash of OTP\n'
" ( _ * And the FLAG is lost forever!\n"
" * ( / ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2024/crypto/Wikipedia_Signatures/server.py | ctfs/TBTL/2024/crypto/Wikipedia_Signatures/server.py | #!/usr/bin/python3
from redacted import FLAG
from Crypto.Util.number import bytes_to_long
from Crypto.Math.Numbers import Integer
from Crypto.PublicKey import RSA
import signal
TARGET = b'I challenge you to sign this message!'
def myprint(s):
print(s, flush=True)
def handler(_signum, _frame):
myprint("... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2024/crypto/Kung_Fu_Cipher/server.py | ctfs/TBTL/2024/crypto/Kung_Fu_Cipher/server.py | from Crypto.Util.number import *
from sage.all import *
from redacted import FLAG
import random
import signal
BANNER = (
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣦⣤⣖⣶⣒⠦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n"
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣿⣿⣾⣿⣿⣿⣿⣿⣶⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n"
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2024/web/Mexico_City_Tour/app.py | ctfs/TBTL/2024/web/Mexico_City_Tour/app.py | from flask import Flask, render_template, url_for, redirect, request
from neo4j import GraphDatabase
app = Flask(__name__)
URI = "bolt://localhost:7687"
AUTH = ("", "")
def query(input_query):
with GraphDatabase.driver(URI, auth=AUTH) as driver:
driver.verify_connectivity()
session = driver.sess... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2024/web/Rnd_For_Data_Science/generator_app.py | ctfs/TBTL/2024/web/Rnd_For_Data_Science/generator_app.py | from flask import Flask, request
import random as rnd
app = Flask(__name__)
flag = open('flag.txt', 'r').read().rstrip()
@app.route("/", methods=['POST'])
def index():
delimiter = request.form['delimiter']
if len(delimiter) > 1:
return 'ERROR'
num_columns = int(request.form['numColumns'])
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2024/web/Rnd_For_Data_Science/app.py | ctfs/TBTL/2024/web/Rnd_For_Data_Science/app.py | from flask import Flask, request, send_file
from io import StringIO, BytesIO
import pandas as pd
import requests
app = Flask(__name__)
@app.route("/")
def index():
return app.send_static_file('index.html')
@app.route("/generate", methods=['POST'])
def generate():
data = request.form
delimiter_const = '... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2023/pwn/Math_is_hard/calc.py | ctfs/TBTL/2023/pwn/Math_is_hard/calc.py | #!/usr/bin/python3
from math import *
from string import *
USAGE = """PwnCalc -- a simple calculator
$ a=4
>>> a = 4
$ a = 4
>>> a = 4
$ b = 3
>>> b = 3
$ c = sqrt(a*a+b*b)
>>> c = 5.0
$ d = sin(pi/4)
>>> d = 0.7071067811865475
Have fun!
"""
def check_expression(s):
"""Allow only digits, decimal point, lowecase ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2023/crypto/Custom_Cipher/server.py | ctfs/TBTL/2023/crypto/Custom_Cipher/server.py | #!/usr/bin/python3
from Crypto.Cipher import AES
from Crypto.Util.number import bytes_to_long, long_to_bytes
import hashlib
import os
import signal
BANNER = (" \n"
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠟⠛⠛⠛⠛⠛⢦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n"
"⠀⠀⠀⠀⠀⠀⠀⠀⣠⡾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠙⠷⣄⠀⠀⠀⠀⠀⠀⠀⠀\n"
"⠀⠀⠀⠀⠀⠀⠀⢀⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⡆... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2023/crypto/Perfect_Secrecy/challenge.py | ctfs/TBTL/2023/crypto/Perfect_Secrecy/challenge.py | #!/usr/bin/python3
import random
def encrypt(m_bytes):
l = len(m_bytes)
pad = random.getrandbits(l * 8).to_bytes(l, 'big')
return bytes([a ^ b for (a, b) in zip(m_bytes, pad)]).hex()
def main():
flag = open("flag.txt", "rb").read()
assert(flag.startswith(b"Blockhouse{") and flag.endswith(b"}"))... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2023/crypto/Baby_Shuffle/server.py | ctfs/TBTL/2023/crypto/Baby_Shuffle/server.py | #!/usr/bin/python3
from Crypto.Util.number import *
import os
import signal
BABY_FLAG = (" .@@@@@.\n"
" / \\\n"
" / 6 6 \\\n"
" ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2023/crypto/Random_Keys/server.py | ctfs/TBTL/2023/crypto/Random_Keys/server.py | #!/usr/bin/python3
from Crypto.Util.number import *
import os
import signal
BANNER = (" \n"
" ###### \n"
" ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2023/web/No_admin_no_problem/app.py | ctfs/TBTL/2023/web/No_admin_no_problem/app.py | from flask import Flask, request, render_template
from fast_jwt import encode, decode
import uuid
import base64
app = Flask(__name__)
@app.route('/', methods=['GET'])
def index():
return render_template('index.html')
@app.route('/apply', methods=['POST'])
def apply():
token = request.form.get('token')
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2025/pwn/Michael_Scofield/sandbox.py | ctfs/TBTL/2025/pwn/Michael_Scofield/sandbox.py | def check_pattern(user_input):
"""
This function will check if numbers or strings are in user_input.
"""
return '"' in user_input or '\'' in user_input or any(str(n) in user_input for n in range(10))
while True:
user_input = input(">> ")
if len(user_input) == 0:
continue
if len(u... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2025/crypto/Guessy/server.py | ctfs/TBTL/2025/crypto/Guessy/server.py | #!/usr/bin/python3
import math
import signal
import sys
from Crypto.Util.number import getPrime, inverse, getRandomRange
N_BITS = 512
class A:
def __init__(self, bits = N_BITS):
self.p = getPrime(bits // 2)
self.q = getPrime(bits // 2)
self.n = self.p * self.q
self.phi = (self.p ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2025/crypto/Prime_Genes/chall.py | ctfs/TBTL/2025/crypto/Prime_Genes/chall.py | #!/usr/bin/env python3
import math
import secrets
from Crypto.Util.number import *
from redacted import FLAG
PM = 0.05
def genetic_prime_gen(target_size_bits):
population = ['10', '11', '101']
number_large = 0
while True:
a, b = secrets.choice(population), secrets.choice(population)
# ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2025/crypto/Free_Candy/server.py | ctfs/TBTL/2025/crypto/Free_Candy/server.py | #!/usr/bin/python3
import base64
import binascii
import hashlib
import json
import signal
import sys
from sage.all import *
from Crypto.Util.number import *
BANNER = """
███ ▄█ ▄████████ ▄█ ▄█▄ ▄████████ ███ ▄████████ ▄█ █▄ ▄██████▄ ▄███████▄
▀█████████▄ ███ ███ █... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TBTL/2025/web/Jey_is_not_my_son/app.py | ctfs/TBTL/2025/web/Jey_is_not_my_son/app.py | from flask import Flask, render_template, request
from jsonquerylang import jsonquery
import json
import string
app = Flask(__name__)
with open('data.json') as f:
data = json.load(f)
def count_baby_names(name: str, year: int) -> int:
query = f"""
.collection
| filter(.Name... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BroncoCTF/2024/rev/Serpents_Pass/SerpentsServer.py | ctfs/BroncoCTF/2024/rev/Serpents_Pass/SerpentsServer.py | import sys
import errno
import socket
import threading
import math
from functools import lru_cache
def getLine(data: bytes) -> str:
inpData = data[0:data.index(b'\n')]
return str(inpData)[2:-1] # filter out the b''
def gate1():
return pow(10 * 9 + 7 - 2, 2)
def is_square(num: int) -> bool:
int_sq... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/pwn/boring-flag-runner/getprog.py | ctfs/RaRCTF/2021/pwn/boring-flag-runner/getprog.py | import sys
prog = input("enter your program: ").encode("latin-1")
open(f"{sys.argv[1]}", "wb").write(prog[:4000])
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/crypto/mini-A3S/mini.py | ctfs/RaRCTF/2021/crypto/mini-A3S/mini.py | '''
Base-3 AES
Just use SAGE lmao
'''
T_SIZE = 3 # Fixed trits in a tryte
W_SIZE = 3 # Fixed trytes in a word (determines size of matrix)
POLY = (2, 0, 1, 1) # Len = T_SIZE + 1
POLY2 = ((2, 0, 1), (1, 2, 0), (0, 2, 1), (2, 0, 1)) # Len = W_SIZE + 1
CONS = ((1, 2, 0), (2, 0, 1), (1... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/crypto/PsychECC/server.py | ctfs/RaRCTF/2021/crypto/PsychECC/server.py | from collections import namedtuple
import random
def moddiv(x,y,p):
return (x * pow(y, -1, p)) %p
Point = namedtuple("Point","x y")
class EllipticCurve:
INF = Point(0,0)
def __init__(self, a, b, p):
self.a = a
self.b = b
self.p = p
def add(self,P,Q):
if P == self.INF:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/crypto/A3S/a3s.py | ctfs/RaRCTF/2021/crypto/A3S/a3s.py | '''
Base-3 AES
Just use SAGE lmao
'''
T_SIZE = 3 # Fixed trits in a tryte
W_SIZE = 3 # Fixed trytes in a word (determines size of matrix)
POLY = (2, 0, 1, 1) # Len = T_SIZE + 1
POLY2 = ((2, 0, 1), (1, 2, 0), (0, 2, 1), (2, 0, 1)) # Len = W_SIZE + 1
CONS = ((1, 2, 0), (2, 0, 1), (1... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/crypto/snore/script.py | ctfs/RaRCTF/2021/crypto/snore/script.py | from Crypto.Util.number import *
from Crypto.Util.Padding import pad
from Crypto.Cipher import AES
from hashlib import sha224
from random import randrange
import os
p = 148982911401264734500617017580518449923542719532318121475997727602675813514863
g = 2
assert isPrime(p//2) # safe prime
x = randrange(p)
y = pow(g, x,... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/crypto/babycrypt/server.py | ctfs/RaRCTF/2021/crypto/babycrypt/server.py | from Crypto.Util.number import getPrime, bytes_to_long
flag = bytes_to_long(open("/challenge/flag.txt", "rb").read())
def genkey():
e = 0x10001
p, q = getPrime(256), getPrime(256)
if p <= q:
p, q = q, p
n = p * q
pubkey = (e, n)
privkey = (p, q)
return pubkey, privkey
def encrypt(m,... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/crypto/sRSA/script.py | ctfs/RaRCTF/2021/crypto/sRSA/script.py | from Crypto.Util.number import *
p = getPrime(256)
q = getPrime(256)
n = p * q
e = 0x69420
flag = bytes_to_long(open("flag.txt", "rb").read())
print("n =",n)
print("e =", e)
print("ct =",(flag * e) % n)
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/crypto/unrandompad/unrandompad.py | ctfs/RaRCTF/2021/crypto/unrandompad/unrandompad.py | from random import getrandbits
from Crypto.Util.number import getPrime, long_to_bytes, bytes_to_long
def keygen(): # normal rsa key generation
primes = []
e = 3
for _ in range(2):
while True:
p = getPrime(1024)
if (p - 1) % 3:
break
primes.append(p)
return e, primes[0] * primes[1]
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/crypto/rotoRSA/source.py | ctfs/RaRCTF/2021/crypto/rotoRSA/source.py | from sympy import poly, symbols
from collections import deque
import Crypto.Random.random as random
from Crypto.Util.number import getPrime, bytes_to_long, long_to_bytes
def build_poly(coeffs):
x = symbols('x')
return poly(sum(coeff * x ** i for i, coeff in enumerate(coeffs)))
def encrypt_msg(msg, poly, e, N)... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/crypto/Shamirs_Stingy_Sharing/stingy.py | ctfs/RaRCTF/2021/crypto/Shamirs_Stingy_Sharing/stingy.py | import random, sys
from Crypto.Util.number import long_to_bytes
def bxor(ba1,ba2):
return bytes([_a ^ _b for _a, _b in zip(ba1, ba2)])
BITS = 128
SHARES = 30
poly = [random.getrandbits(BITS) for _ in range(SHARES)]
flag = open("/challenge/flag.txt","rb").read()
random.seed(poly[0])
print(bxor(flag, long_to_bytes(r... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/crypto/randompad/randompad.py | ctfs/RaRCTF/2021/crypto/randompad/randompad.py | from random import getrandbits
from Crypto.Util.number import getPrime, long_to_bytes, bytes_to_long
def keygen(): # normal rsa key generation
primes = []
e = 3
for _ in range(2):
while True:
p = getPrime(1024)
if (p - 1) % 3:
break
primes.append(p)
return e, primes[0] * primes[1]
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/crypto/minigen/minigen.py | ctfs/RaRCTF/2021/crypto/minigen/minigen.py | exec('def f(x):'+'yield((x:=-~x)*x+-~-x)%727;'*100)
g=f(id(f));print(*map(lambda c:ord(c)^next(g),list(open('f').read()))) | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/secureuploader/app/app.py | ctfs/RaRCTF/2021/web/secureuploader/app/app.py | from flask import Flask, request, redirect, g
import sqlite3
import os
import uuid
app = Flask(__name__)
SCHEMA = """CREATE TABLE files (
id text primary key,
path text
);
"""
def db():
g_db = getattr(g, '_database', None)
if g_db is None:
g_db = g._database = sqlite3.connect("database.db")
retu... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/FBG/template-solve.py | ctfs/RaRCTF/2021/web/FBG/template-solve.py | import requests
import hashlib
import uuid
import binascii
import os
import sys
def generate():
return uuid.uuid4().hex[:4], uuid.uuid4().hex[:4]
def verify(prefix, suffix, answer, difficulty=6):
hash = hashlib.sha256(prefix.encode() + answer.encode() + suffix.encode()).hexdigest()
return hash.endswith("... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/FBG/chall/pow.py | ctfs/RaRCTF/2021/web/FBG/chall/pow.py | import hashlib
import uuid
import binascii
import os
def generate():
return uuid.uuid4().hex[:4], uuid.uuid4().hex[:4]
def verify(prefix, suffix, answer, difficulty=6):
hash = hashlib.sha256(prefix.encode() + answer.encode() + suffix.encode()).hexdigest()
return hash.endswith("0"*difficulty)
def solve(pr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/FBG/chall/server.py | ctfs/RaRCTF/2021/web/FBG/chall/server.py | from flask import Flask, render_template, request, session, redirect, jsonify
import requests
import random
import time
from binascii import hexlify
import os
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/button')
def button():
title = 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/RaRCTF/2021/web/Electroplating/app/pow.py | ctfs/RaRCTF/2021/web/Electroplating/app/pow.py | import hashlib
import uuid
import binascii
import os
def generate():
return uuid.uuid4().hex[:4], uuid.uuid4().hex[:4]
def verify(prefix, suffix, answer, difficulty=6):
hash = hashlib.sha256(prefix.encode() + answer.encode() + suffix.encode()).hexdigest()
return hash.endswith("0"*difficulty)
def solve(pr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/Electroplating/app/app.py | ctfs/RaRCTF/2021/web/Electroplating/app/app.py | import shutil
from bs4 import BeautifulSoup
import os
import random
import time
import tempfile
from flask import Flask, request, render_template, session, jsonify
from werkzeug.utils import secure_filename
import requests
app = Flask(__name__)
rust_template = """
#![allow(warnings, unused)]
use std::collections::Ha... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.