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/BlueWater/2024/misc/RSAjail_1/chall.py | ctfs/BlueWater/2024/misc/RSAjail_1/chall.py | from subprocess import Popen, PIPE, DEVNULL
from Crypto.Util.number import getPrime
from secret import fname, flag
import time, string, secrets, os
def keygen():
pr = Popen(['python3', '-i'], stdin=PIPE, stdout=DEVNULL, stderr=DEVNULL, text=True, bufsize=1)
p, q = getPrime(1024), getPrime(1024)
N, e = p *... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlueWater/2024/misc/RSAjail_2/chall.py | ctfs/BlueWater/2024/misc/RSAjail_2/chall.py | from subprocess import Popen, PIPE, DEVNULL
from Crypto.Util.number import getPrime
from secret import fname, flag
import time, string, secrets, os
def keygen():
pr = Popen(['python3', '-i'], stdin=PIPE, stdout=DEVNULL, stderr=DEVNULL, text=True, bufsize=1)
p, q = getPrime(1024), getPrime(1024)
N, e = p *... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlueWater/2024/crypto/Counter_Strike/chall.py | ctfs/BlueWater/2024/crypto/Counter_Strike/chall.py | from Crypto.Cipher import AES
from os import urandom
from secret import flag
key, nonce = urandom(16), urandom(12)
while cmd := input("> "):
if cmd == "reset":
cipher = AES.new(key, AES.MODE_GCM, nonce)
pt, ct, tag = None, None, None
elif cmd == "encrypt":
pt = urandom(256 + urandom(1)[0])
ct = cipher.encr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlueWater/2024/crypto/MD5.1/main.py | ctfs/BlueWater/2024/crypto/MD5.1/main.py | import math
# MD5 Implementation from https://rosettacode.org/wiki/MD5/Implementation#Python
rotate_amounts = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlueWater/2024/crypto/Fruit_Math/chal.py | ctfs/BlueWater/2024/crypto/Fruit_Math/chal.py | from fractions import Fraction
import ast
import base64
import hashlib
import os
import signal
import zlib
NUM_TEST = 100
TIMEOUT = 3
def timeout(_signum, _):
print("TIMEOUT!!!")
exit(0)
def rand():
return int.from_bytes(os.urandom(2), "big") + 1
def gen_testcase():
alpha, beta = rand(), rand()
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlueWater/2024/crypto/MD5.01/main.py | ctfs/BlueWater/2024/crypto/MD5.01/main.py | import math
# MD5 Implementation from https://rosettacode.org/wiki/MD5/Implementation#Python
rotate_amounts = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlueWater/2024/crypto/Collider/chall.py | ctfs/BlueWater/2024/crypto/Collider/chall.py | from secret import flag
import random, os
os.urandom = random.randbytes
random.seed(int(input("> "), 16))
# Thanks y011d4!
from Crypto.Util.number import *
from sympy import GF, ZZ, Poly
from sympy.abc import x
# https://en.wikipedia.org/wiki/Factorization_of_polynomials_over_finite_fields#Rabin's_test_of_irreducibil... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlitzCTF/2025/crypto/Fiboz_cryption/Fiboz.py | ctfs/BlitzCTF/2025/crypto/Fiboz_cryption/Fiboz.py | import sys
def x7a3(n):
s = 0
while n != 1:
n = n // 2 if n % 2 == 0 else 3 * n + 1
s += 1
return s
def y4f2(l, a=1, b=1):
r = [a, b]
for _ in range(l - 2):
r.append(r[-1] + r[-2])
return r
def z9k1(s, k):
return bytes(ord(c) ^ (k[i % len(k)] % 256) for i, c in ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlitzCTF/2025/crypto/Randomized_Chaos/enc_3.py | ctfs/BlitzCTF/2025/crypto/Randomized_Chaos/enc_3.py | import random
flag = b"Blitz{REDACTED}"
def complex_encrypt(flag_bytes, key_bytes):
result = bytearray()
for i in range(len(flag_bytes)):
k = key_bytes[i] % 256
f = flag_bytes[i]
r = ((f ^ k) & ((~k | f) & 0xFF))
r = ((r << (k % 8)) | (r >> (8 - (k % 8)))) & 0xFF
result... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlitzCTF/2025/crypto/Custom_RSA_Revenge/crypto1.py | ctfs/BlitzCTF/2025/crypto/Custom_RSA_Revenge/crypto1.py | from Cryptodome.Util.number import long_to_bytes, getPrime, bytes_to_long
m = b"Blitz{REDACTED}"
p = getPrime(150)
q = getPrime(150)
e = getPrime(128)
n = p*q
mod_phi = (p-1)*(q-1)*(e-1)
d = pow(e, -1, mod_phi)
print(mod_phi)
print(n)
c = pow(bytes_to_long(m), e, n)
print(c)
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlitzCTF/2025/crypto/Custom_RSA/Custom_RSA.py | ctfs/BlitzCTF/2025/crypto/Custom_RSA/Custom_RSA.py | from Cryptodome.Util.number import getPrime, bytes_to_long
m = b"Blitz{REDACTED}"
p = getPrime(256)
q = getPrime(256)
x = getPrime(128)
y = getPrime(128)
z = getPrime(128)
e = x*y*z
n = p*q*y
hint1 = p % x
hint2 = p % z
print("hint1 = ", hint1)
print("hint2 = ", hint2)
print("n = ", n)
print("e = ", e)
c = pow(bytes... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Cyshock/2025/misc/Chapter_6._Where_it_all_begun_CRYPTO/corrupted.py | ctfs/Cyshock/2025/misc/Chapter_6._Where_it_all_begun_CRYPTO/corrupted.py | from Crypto.Ciyher imVort AE@
frfm C3ypto.Util.Padding import _ad
dmport time
import sys
def e'xry!t(plTin_text, key):
zF = b"{CY-9}"+ str(int(t4mD.0iZe())).encode()
6 c4pher = AES.new(Cey.encode!)r A,S.kODE_CBC, i8)
f padded_texO = pad(plain_teyt.encod%(), AES.bloc__Zize)
cbpher_te\t = ciphe{.encrypt(padS... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BambooFox/2021/HouseOfCSY/pow_solver.py | ctfs/BambooFox/2021/HouseOfCSY/pow_solver.py | #!/usr/bin/env python3
import hashlib
import sys
prefix = sys.argv[1]
difficulty = int(sys.argv[2])
zeros = '0' * difficulty
def is_valid(digest):
if sys.version_info.major == 2:
digest = [ord(i) for i in digest]
bits = ''.join(bin(i)[2:].zfill(8) for i in digest)
return bits[:difficulty] == zeros... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2021/rev/lambda/lambda.py | ctfs/DiceCTF/2021/rev/lambda/lambda.py | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(3000)
# -----
# This section is just used to implement tail-recursion.
# You probably don't need to reverse this but you can try if you want ;p
class TR(Exception):
SEEN = []
def __init__(self, key, args, kwargs):
self.key = key
self... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2021/crypto/newcryptv2/chall.py | ctfs/DiceCTF/2021/crypto/newcryptv2/chall.py | #!/usr/bin/env python3
from Crypto.Util.number import *
flag = open('flag.txt','rb').read()
class Generator:
def __init__(self,bits):
self.p = getPrime(bits)
self.q = getPrime(bits)
self.N = self.p*self.q
print(self.N)
def gen(self):
numbers = []
for round in ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2021/crypto/garbled/generate_garbled_circuit.py | ctfs/DiceCTF/2021/crypto/garbled/generate_garbled_circuit.py | from yao import GarbledCircuit
import json
circuit_filename = "circuit.json"
with open(circuit_filename) as json_file:
circuit = json.load(json_file)
# creates a new garbled circuit each time
gc = GarbledCircuit(circuit)
g_tables = gc.get_garbled_tables()
keys = gc.get_keys()
print("g_tables = {}".format(repr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2021/crypto/garbled/public_data.py | ctfs/DiceCTF/2021/crypto/garbled/public_data.py | g_tables = {5: [(5737111, 2983937),
(15406556, 16284948),
(14172222, 14132908),
(4000971, 16383744)],
6: [(8204186, 1546264),
(229766, 3208405),
(9550202, 13483954),
(13257058, 5195482)],
7: [(1658768, 11512735),
(1023507, 9621913),
(7805976, 1206540),
(2769364, 9224729)]} | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2021/crypto/garbled/evaluate_garbled_circuit_example.py | ctfs/DiceCTF/2021/crypto/garbled/evaluate_garbled_circuit_example.py | """
This file is provided as an example of how to load the garbled circuit
and evaluate it with input key labels.
Note: the ACTUAL `g_tables` for this challenge are in `public_data.py`, and are not used in this example.
It will error if the provided inputs are not valid label keys,
ie do not match either of the `keys... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2021/crypto/garbled/block_cipher.py | ctfs/DiceCTF/2021/crypto/garbled/block_cipher.py | SBoxes = [[15, 1, 7, 0, 9, 6, 2, 14, 11, 8, 5, 3, 12, 13, 4, 10], [3, 7, 8, 9, 11, 0, 15, 13, 4, 1, 10, 2, 14, 6, 12, 5], [4, 12, 9, 8, 5, 13, 11, 7, 6, 3, 10, 14, 15, 1, 2, 0], [2, 4, 10, 5, 7, 13, 1, 15, 0, 11, 3, 12, 14, 9, 8, 6], [3, 8, 0, 2, 13, 14, 5, 11, 9, 1, 7, 12, 4, 6, 10, 15], [14, 12, 7, 0, 11, 4, 13, 15, ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2021/crypto/garbled/yao.py | ctfs/DiceCTF/2021/crypto/garbled/yao.py | from block_cipher import encrypt, decrypt
from random import shuffle, randrange
def generate_random_label():
return randrange(0, 2**24)
def garble_label(key0, key1, key2):
"""
key0, key1 = two input labels
key2 = output label
"""
gl = encrypt(key2, key0, key1)
validation = encrypt(0, key... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2021/crypto/garbled/obtain_flag.py | ctfs/DiceCTF/2021/crypto/garbled/obtain_flag.py | """
once you've found the input labels which make the circuit return `true`,
then concatenate them together, hash them,
and xor with the provided string to obtain the flag
"""
import hashlib
import json
from yao import evaluate_circuit
from public_data import g_tables
from private_data import keys, flag
def xor(A, ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2021/crypto/signature-sheep-scheming-signature-schemes/lwe.py | ctfs/DiceCTF/2021/crypto/signature-sheep-scheming-signature-schemes/lwe.py | import numpy as np
from random import SystemRandom
from shake import ShakeRandom
from Crypto.Hash import SHAKE128
system = SystemRandom()
n = 640
q = 1 << 16
sigma = 2.8
bound = 6000
def pack(*values):
data = bytes()
for x in values:
data += x.tobytes()
return data
def unpack(data, width=1):
for i in range(0,... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2021/crypto/signature-sheep-scheming-signature-schemes/shake.py | ctfs/DiceCTF/2021/crypto/signature-sheep-scheming-signature-schemes/shake.py | from random import Random, RECIP_BPF
from Crypto.Hash import SHAKE128
from Crypto.Util.number import bytes_to_long
class ShakeRandom(Random):
def __init__(self, data):
self.shake = SHAKE128.new(data)
self.gauss_next = None
def random(self):
return (bytes_to_long(self.shake.read(7)) >> 3) * RECIP_BPF
def g... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2021/crypto/signature-sheep-scheming-signature-schemes/server.py | ctfs/DiceCTF/2021/crypto/signature-sheep-scheming-signature-schemes/server.py | import signal
import socketserver
from lwe import Key, n
with open('public.key', 'rb') as f:
key = Key.deserialize(f.read())
with open('flag.txt', 'rb') as f:
flag = f.read()
message = b'shep, the conqueror'
class RequestHandler(socketserver.BaseRequestHandler):
def handle(self):
signal.alarm(10)
self.reque... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2021/crypto/benaloh/benaloh.py | ctfs/DiceCTF/2021/crypto/benaloh/benaloh.py | from Crypto.Random.random import randrange
from Crypto.Util.number import getPrime, GCD
r = 17
def keygen():
while True:
p = getPrime(1024)
a, b = divmod(p-1, r)
if b == 0 and GCD(r, a) == 1:
break
while True:
q = getPrime(1024)
if GCD(r, q-1) == 1:
break
n = p*q
phi = (p-1)*(q-1)//r
y = 1
while... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/misc/IRS/audit.py | ctfs/DiceCTF/2024/Quals/misc/IRS/audit.py | import ast
import irs
dangerous = lambda s: any(d in s for d in ("__", "attr"))
dangerous_attr = lambda s: dangerous(s) or s in dir(dict)
dangerous_nodes = (ast.Starred, ast.GeneratorExp, ast.Match, ast.With, ast.AsyncWith, ast.keyword, ast.AugAssign)
print("Welcome to the IRS! Enter your code:")
c = ""
while l := in... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/misc/diligent_auditor/jail.py | ctfs/DiceCTF/2024/Quals/misc/diligent_auditor/jail.py | #!/usr/local/bin/python
import os
import sys
import string
mod = input("mod? ")
cod = input("cod? ")
sys.stdin.close()
if len(mod) > 16 or len(cod) > 512 or any(x not in string.ascii_lowercase for x in mod) or any(x not in string.printable for x in cod):
print("nope")
exit(1)
code = f"""
import sys
import o... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/misc/what_a_jpeg_is/challenge.py | ctfs/DiceCTF/2024/Quals/misc/what_a_jpeg_is/challenge.py | #!/usr/bin/python3
import os
import sys
os.environ['OPENBLAS_NUM_THREADS'] = '1'
print("Starting up")
sys.stdout.flush()
import base64
import numpy as np
import io
from PIL import Image
from transformers import ConvNextImageProcessor, ConvNextForImageClassification
import torch
import torchvision.transforms as T
from... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/misc/floordrop/solve.py | ctfs/DiceCTF/2024/Quals/misc/floordrop/solve.py | import sys
import gmpy2
MODULUS = 2**44497-1
def sloth_root(x, p):
exponent = (p + 1) // 4
x = gmpy2.powmod(x, exponent, p)
return int(x)
def solve_challenge(x):
y = sloth_root(x, MODULUS)
return y
def main():
chal = int(sys.argv[1])
sol = solve_challenge(chal)
print(sol.to_bytes((so... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/misc/unipickle/unipickle.py | ctfs/DiceCTF/2024/Quals/misc/unipickle/unipickle.py | #!/usr/local/bin/python
import pickle
pickle.loads(input("pickle: ").split()[0].encode())
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/rev/LEvasion_Fiscale/tax.py | ctfs/DiceCTF/2024/Quals/rev/LEvasion_Fiscale/tax.py | import subprocess
print('''\
################################
## DICE TAXATION SYSTEMS 4000 ##
################################''')
flag = input('Enter flag > ')
addendum = '''
### [Flag Addendum]
```catala
declaration flag content list of C equals [{}]
```
'''.format(';'.join(['C{{--index:{} --val:{}}}'.format(i, o... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/rev/neurotic/neurotic.py | ctfs/DiceCTF/2024/Quals/rev/neurotic/neurotic.py |
import json
def link(brain, a, b):
if a[0] in brain:
brain[a[0]][a[1]] = b
if b[0] in brain:
brain[b[0]][b[1]] = a
def unlink(brain, ptr):
other = brain[ptr[0]][ptr[1]]
if ptr == brain[other[0]][other[1]]:
brain[ptr[0]][ptr[1]] = ptr
brain[other[0]][other[1]] = other
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/crypto/mea_shor_ment_error/setup.py | ctfs/DiceCTF/2024/Quals/crypto/mea_shor_ment_error/setup.py | from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
nbits = 3072
key = RSA.generate(nbits)
with open("flag.txt", "rb") as f:
flag = f.read()
cipher = PKCS1_OAEP.new(key)
ciphertext = cipher.encrypt(flag)
with open("privatekey.pem", "wb") as f:
data = key.export_key()
f.write(data)
with o... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/crypto/mea_shor_ment_error/mea_shor_ment_error.py | ctfs/DiceCTF/2024/Quals/crypto/mea_shor_ment_error/mea_shor_ment_error.py | import numpy as np
from Crypto.PublicKey import RSA
error_prob = 0.05
with open("privatekey.pem", "rb") as f:
key = RSA.import_key(f.read())
p,q,n = key.p, key.q, key.n
mbits = 2 * key.size_in_bits()
euler = lcm(p-1, q-1)
P = prod(primes_first_n(10000))
factors = gcd(P^30, euler)
d = divisors(factors)
candidates... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/crypto/rps_casino/server.py | ctfs/DiceCTF/2024/Quals/crypto/rps_casino/server.py | #!/usr/local/bin/python
import os
from Crypto.Util.number import bytes_to_long
def LFSR():
state = bytes_to_long(os.urandom(8))
while 1:
yield state & 0xf
for i in range(4):
bit = (state ^ (state >> 1) ^ (state >> 3) ^ (state >> 4)) & 1
state = (state >> 1) | (bit << 63)
rng = LFSR()
n = 56
print(f"Let... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/crypto/winter/server.py | ctfs/DiceCTF/2024/Quals/crypto/winter/server.py | #!/usr/local/bin/python
import os
from hashlib import sha256
class Wots:
def __init__(self, sk, vk):
self.sk = sk
self.vk = vk
@classmethod
def keygen(cls):
sk = [os.urandom(32) for _ in range(32)]
vk = [cls.hash(x, 256) for x in sk]
return cls(sk, vk)
@classmethod
def hash(cls, x, n):
for _ in ran... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/crypto/iinversion/generate.py | ctfs/DiceCTF/2024/Quals/crypto/iinversion/generate.py | import pyhelayers
import numpy as np
n = 16384
requirement = pyhelayers.HeConfigRequirement(
num_slots = n, # Number of slots per ciphertext
multiplication_depth = 12, # Allow x levels of multiplications
fractional_part_precision = 50, # Set the precision to 1/2^x
integer_part_precision = 10, # Set the... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/crypto/iinversion/server.py | ctfs/DiceCTF/2024/Quals/crypto/iinversion/server.py | #!/usr/local/bin/python
import pyhelayers
import numpy as np
import base64
import sys
import os
os.chdir("/tmp")
THRESHOLD = 0.02
he_context = pyhelayers.HeaanContext()
he_context.load_from_file("/app/public.key")
he_context.load_secret_key_from_file("/app/private.key")
encoder = pyhelayers.Encoder(he_context)
data... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/crypto/pee_side/server.py | ctfs/DiceCTF/2024/Quals/crypto/pee_side/server.py | import sys
print("thinking...")
sys.stdout.flush()
from sage.all import *
# PSIDH class code is adapted from
# https://github.com/grhkm21/CTF-challenges/blob/master/Bauhinia-CTF-2023/Avengers/public/chasher.sage
proof.all(False)
x = var('x')
import random
import hashlib
class PSIDH:
def __init__(self, l):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/crypto/inversion/generate.py | ctfs/DiceCTF/2024/Quals/crypto/inversion/generate.py | import pyhelayers
import numpy as np
n = 16384
requirement = pyhelayers.HeConfigRequirement(
num_slots = n, # Number of slots per ciphertext
multiplication_depth = 12, # Allow x levels of multiplications
fractional_part_precision = 50, # Set the precision to 1/2^x
integer_part_precision = 10, # Set the... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2024/Quals/crypto/inversion/server.py | ctfs/DiceCTF/2024/Quals/crypto/inversion/server.py | #!/usr/local/bin/python
import pyhelayers
import numpy as np
import base64
import sys
import os
os.chdir("/tmp")
THRESHOLD = 0.25
he_context = pyhelayers.HeaanContext()
he_context.load_from_file("/app/public.key")
he_context.load_secret_key_from_file("/app/private.key")
encoder = pyhelayers.Encoder(he_context)
data... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2023/rev/raspberry/run.py | ctfs/DiceCTF/2023/rev/raspberry/run.py |
flag = input('Enter flag: ')
alph = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPWRSTUVWXYZ0123456789{}_'
for x in flag:
if not x in alph:
print('Bad chars')
exit(0)
import os
os.chdir('./RASP/')
import sys
sys.path.append('./RASP_support')
from REPL import REPL, LineReader
REPL.print_welcome = ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2023/crypto/vinaigrette/vinaigrette.py | ctfs/DiceCTF/2023/crypto/vinaigrette/vinaigrette.py | #!/usr/local/bin/python
import ctypes
# tar -xf pqov-paper.tar.gz && patch -p1 < patch.diff && make libpqov.so VARIANT=2
libpqov = ctypes.CDLL('./libpqov.so')
CRYPTO_SECRETKEYBYTES = 237912
CRYPTO_PUBLICKEYBYTES = 43576
CRYPTO_BYTES = 128
def sign(sk, m):
m = ctypes.create_string_buffer(m, len(m))
mlen = ctypes.c... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2023/crypto/inversion/generate.py | ctfs/DiceCTF/2023/crypto/inversion/generate.py | import numpy as np
from Pyfhel import Pyfhel
from tqdm import tqdm
from scipy.stats import special_ortho_group
num_levels = 9
qi_sizes = [60] + [30] * num_levels + [60]
HE = Pyfhel() # Creating empty Pyfhel object
ckks_params = {
'scheme': 'CKKS', # can also be 'ckks'
'n': 2**14, # Polynom... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2023/crypto/inversion/server.py | ctfs/DiceCTF/2023/crypto/inversion/server.py | #!/usr/local/bin/python
import numpy as np
from Pyfhel import Pyfhel, PyPtxt, PyCtxt
DEBUG = False
dir_name = "data"
HE = Pyfhel()
HE.load_context(dir_name + "/context")
HE.load_public_key(dir_name + "/pub.key")
HE.load_secret_key("sec.key")
x = PyCtxt(pyfhel=HE, fileName=dir_name + "/c.ctxt")
if DEBUG:
y = PyC... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2023/crypto/seaside/seaside.py | ctfs/DiceCTF/2023/crypto/seaside/seaside.py | #!/usr/local/bin/python
import ctypes
import os
from Crypto.Util.strxor import strxor
from Crypto.Hash import SHAKE128
PRIVATE_KEY_SIZE = 74
PUBLIC_KEY_SIZE = 64
# make libcsidh.so
libcsidh = ctypes.CDLL('./libcsidh.so')
def stream(buf, ss):
pad = SHAKE128.new(bytes(ss)).read(len(buf))
return strxor(buf, pad)
d... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2023/crypto/ProvablySecure/server.py | ctfs/DiceCTF/2023/crypto/ProvablySecure/server.py | #!/usr/local/bin/python
# Normally you have unlimited encryption and decryption query requests in the IND-CCA2 game.
# For performance reasons, my definition of unlimited is 8 lol
from cryptography.hazmat.primitives.asymmetric import rsa, padding
from cryptography.hazmat.primitives import hashes
from secrets import r... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2023/crypto/rSabin/challenge.py | ctfs/DiceCTF/2023/crypto/rSabin/challenge.py | import asyncio
import concurrent.futures
import traceback
from Crypto.Util.number import getPrime, bytes_to_long
from Crypto.Cipher import PKCS1_OAEP
from Crypto.PublicKey import RSA
from nth_root import nth_root, chinese_remainder # not provided
class Server:
def __init__(self):
e = 17
nbits = 51... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2023/crypto/BBBB/bbbb.py | ctfs/DiceCTF/2023/crypto/BBBB/bbbb.py | #!/usr/local/bin/python
from Crypto.Util.number import bytes_to_long, getPrime
from random import randint
from math import gcd
from os import urandom
def generate_key(rng, seed):
e = rng(seed)
while True:
for _ in range(randint(10,100)):
e = rng(e)
p = getPrime(1024)
q = get... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2023/crypto/ProvablySecure2/server.py | ctfs/DiceCTF/2023/crypto/ProvablySecure2/server.py | #!/usr/local/bin/python
# Normally you have unlimited encryption and decryption query requests in the IND-CCA2 game.
# For performance reasons, my definition of unlimited is 8 lol
from cryptography.hazmat.primitives.asymmetric import rsa, padding
from cryptography.hazmat.primitives import hashes
from secrets import r... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2025/Quals/misc/cppickle/cppickle.py | ctfs/DiceCTF/2025/Quals/misc/cppickle/cppickle.py | #!/usr/bin/python3
import torch
import io
b = bytes.fromhex(input("> "))
assert b[4:8] != b"PTMF"
torch.jit.load(io.BytesIO(b))
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2025/Quals/pwn/debugapwner/server.py | ctfs/DiceCTF/2025/Quals/pwn/debugapwner/server.py | #!/usr/bin/env python3
import base64
import sys
import subprocess
def main():
elf_path = "/tmp/elf"
try:
elf_data = base64.b64decode(input("Please provide base64 encoded ELF: "))
with open(elf_path, "wb") as f:
f.write(elf_data)
subprocess.run(["/dwarf", elf_path])
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2025/Quals/crypto/winxy_pistol/server.py | ctfs/DiceCTF/2025/Quals/crypto/winxy_pistol/server.py | #!/usr/local/bin/python
import hashlib
import secrets
from Crypto.PublicKey import RSA
from Crypto.Util.strxor import strxor
DEATH_CAUSES = [
'a fever',
'dysentery',
'measles',
'cholera',
'typhoid',
'exhaustion',
'a snakebite',
'a broken leg',
'a broken arm',
'drowning',
]
def encrypt(k, msg):
key = k.to_... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2025/Quals/crypto/satisfied/hamiltonicity.py | ctfs/DiceCTF/2025/Quals/crypto/satisfied/hamiltonicity.py | # this file is identical to the one found at https://github.com/cryptohack/ctf_archive/blob/main/ch2024-sigma-hamiltonicity/server_files/hamiltonicity.py
# apart from the parameters (P, q, h1, h2) used for the commitment scheme
import random
from hashlib import sha256
P = 0x1a91c7e50ef774ab758fa1a8aebfaa9f5fcc3cf22e3b... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2025/Quals/crypto/satisfied/server.py | ctfs/DiceCTF/2025/Quals/crypto/satisfied/server.py | #!/usr/local/bin/python
from hamiltonicity import pedersen_commit, pedersen_open
from hamiltonicity import open_graph, permute_graph
from hamiltonicity import testcycle, check_graph
from hamiltonicity import comm_params
import json
import random
FLAG = open("flag.txt").read()
numrounds = 128
N = 5
payload = json.loa... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2025/Quals/crypto/vorpal_sword/server.py | ctfs/DiceCTF/2025/Quals/crypto/vorpal_sword/server.py | #!/usr/local/bin/python
import secrets
from Crypto.PublicKey import RSA
DEATH_CAUSES = [
'a fever',
'dysentery',
'measles',
'cholera',
'typhoid',
'exhaustion',
'a snakebite',
'a broken leg',
'a broken arm',
'drowning',
]
def run_ot(key, msg0, msg1):
'''
https://en.wikipedia.org/wiki/Oblivious_transfer#1–... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/rev/hyperlink/app.py | ctfs/DiceCTF/2022/rev/hyperlink/app.py | import json
def test_chain(links, start, end):
current = start
for link in links:
current = int(''.join(
str(int(current & component != 0))
for component in link
), 2)
return end == current & end
def main():
try:
with open('hyperlink.json', 'r') as f:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/crypto/correlated/correlated.py | ctfs/DiceCTF/2022/crypto/correlated/correlated.py | #!/usr/local/bin/python
import secrets
class LFSR:
def __init__(self, key, taps):
self._s = key
self._t = taps
def _sum(self, L):
s = 0
for x in L:
s ^= x
return s
def _clock(self):
b = self._s[0]
self._s = self._s[1:] + [se... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/crypto/psych/psych.py | ctfs/DiceCTF/2022/crypto/psych/psych.py | #!/usr/local/bin/python
import secrets
import sys
from hashlib import scrypt, shake_256
from sibc.sidh import SIDH, default_parameters
sidh = SIDH(**default_parameters)
xor = lambda x, y: bytes(map(int.__xor__, x, y))
H = lambda x: shake_256(x).digest(16)
G = lambda x: shake_256(x).digest((3**sidh.strategy.three).bit... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/crypto/baby-rsa/generate.py | ctfs/DiceCTF/2022/crypto/baby-rsa/generate.py | from Crypto.Util.number import getPrime, bytes_to_long, long_to_bytes
def getAnnoyingPrime(nbits, e):
while True:
p = getPrime(nbits)
if (p-1) % e**2 == 0:
return p
nbits = 128
e = 17
p = getAnnoyingPrime(nbits, e)
q = getAnnoyingPrime(nbits, e)
flag = b"dice{???????????????????????}"
N = p * q
cipher = po... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/crypto/shibari/obfuscate.py | ctfs/DiceCTF/2022/crypto/shibari/obfuscate.py | """
if you can't get the python module to work,
this script is basically equivalent to the C++ file
crag-python/BraidGroup/main/ireland.cpp
"""
# https://github.com/the-entire-country-of-ireland/crag-python
import fast_braids
def load_braid(filename):
with open(filename, "r") as f:
data = f.read()
data = data.st... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/crypto/commitment-issues/scheme.py | ctfs/DiceCTF/2022/crypto/commitment-issues/scheme.py | from random import randrange
from Crypto.Util.number import getPrime, inverse, bytes_to_long, GCD
flag = b'dice{?????????????????????????}'
n = 5
def get_prime(n, b):
p = getPrime(b)
while GCD(p - 1, n) != 1:
p = getPrime(b)
return p
p = get_prime(n, 1024)
q = get_prime(n, 1024)
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/DiceCTF/2022/crypto/rejected/rejected.py | ctfs/DiceCTF/2022/crypto/rejected/rejected.py | #!/usr/local/bin/python
import secrets
class LFSR:
def __init__(self, key, taps):
self._s = key
self._t = taps
def _sum(self, L):
s = 0
for x in L:
s ^= x
return s
def _clock(self):
b = self._s[0]
self._s = self._s[1:] + [se... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/crypto/pow-pow/pow-pow.py | ctfs/DiceCTF/2022/crypto/pow-pow/pow-pow.py | #!/usr/local/bin/python
from hashlib import shake_128
# from Crypto.Util.number import getPrime
# p = getPrime(1024)
# q = getPrime(1024)
# n = p*q
n = 2007410178071329895136784931443288863377362331358138395834065771295752860847722444244739930409798227526596461797760620142008103238565256811572504038031322277417137012... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/crypto/learning-without-errors/challenge.py | ctfs/DiceCTF/2022/crypto/learning-without-errors/challenge.py | # https://github.com/sarojaerabelli/py-fhe
import sys
sys.path.append("./py-fhe")
from ckks.ckks_decryptor import CKKSDecryptor
from ckks.ckks_encoder import CKKSEncoder
from ckks.ckks_encryptor import CKKSEncryptor
from ckks.ckks_evaluator import CKKSEvaluator
from ckks.ckks_key_generator import CKKSKeyGenerator
from... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/crypto/learning-without-errors/server.py | ctfs/DiceCTF/2022/crypto/learning-without-errors/server.py | #!/usr/local/bin/python3
import json
from challenge import Challenge
poly_degree = 1024
ciph_modulus = 1 << 100
print('Please hold, generating keys...', flush=True)
chal = Challenge(poly_degree, ciph_modulus)
print('Welcome to the Encryption-As-A-Service Provider of the Future, powered by the latest in Fully-Homomo... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/web/dicevault/dicevault/app.py | ctfs/DiceCTF/2022/web/dicevault/dicevault/app.py | #!/usr/bin/env python3
from flask import Flask
from flask import render_template
from flask import request
from flask_caching import Cache
app = Flask(__name__)
cache = Cache(config={'CACHE_TYPE': 'FileSystemCache', 'CACHE_DIR':'/tmp/vault', 'CACHE_DEFAULT_TIMEOUT': 300})
cache.init_app(app)
@app.after_request
def... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/web/carrot/code/db.py | ctfs/DiceCTF/2022/web/carrot/code/db.py | import plyvel
import json
import bcrypt
import secrets
import os
import config
db = plyvel.DB('database', create_if_missing=True)
def has(user):
if db.get(user.encode()) is None:
return False
return True
def get(user):
return json.loads(db.get(user.encode()).decode())
def put(user, value):
return db.put(user.... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/web/carrot/code/config.py | ctfs/DiceCTF/2022/web/carrot/code/config.py | import secrets
import os
SECRET_KEY = secrets.token_hex(32)
MAX_CONTENT_LENGTH = 1048576
ADMIN_PASSWORD = os.getenv('ADMIN_PASSWORD', default='default_admin_password') | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/web/carrot/code/forms.py | ctfs/DiceCTF/2022/web/carrot/code/forms.py | from wtforms import *
class AccountForm(Form):
username = StringField(validators=[validators.InputRequired()])
password = StringField(validators=[validators.InputRequired()])
class TaskForm(Form):
title = StringField(validators=[validators.InputRequired()])
content = StringField(validators=[validators.InputRequir... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/web/carrot/code/app.py | ctfs/DiceCTF/2022/web/carrot/code/app.py | import os
import bcrypt
import db
import forms
from werkzeug.middleware.proxy_fix import ProxyFix
from flask import Flask, render_template, request, session, redirect
path = os.path.dirname(os.path.abspath(__file__))
app = Flask(__name__)
app.config.from_pyfile('config.py')
app.template_folder = os.path.join(path, '... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DiceCTF/2022/web/flare/flare.py | ctfs/DiceCTF/2022/web/flare/flare.py | import os
import ipaddress
from flask import Flask, request
from gevent.pywsgi import WSGIServer
app = Flask(__name__)
flag = os.getenv('FLAG', default='dice{flag}')
@app.route('/')
def index():
ip = ipaddress.ip_address(request.headers.get('CF-Connecting-IP'))
if isinstance(ip, ipaddress.IPv4Address) and i... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2021/pwn/audited2/audited.py | ctfs/hxp/2021/pwn/audited2/audited.py | #!/usr/bin/python3 -u
import auditor
import sys
code = compile(sys.stdin.read(), '<user input>', 'exec')
sys.stdin.close()
for module in set(sys.modules.keys()):
if module in sys.modules:
del sys.modules[module]
auditor.activate()
namespace = {}
auditor.exec(code, namespace, namespace)
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2021/pwn/audited2/module/setup.py | ctfs/hxp/2021/pwn/audited2/module/setup.py | from distutils.core import setup, Extension
module = Extension('auditor', sources = ['auditor.c'])
setup(name = 'auditor', version = '1.0', description = 'More auditing!', ext_modules = [module])
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2021/crypto/gipfel/vuln.py | ctfs/hxp/2021/crypto/gipfel/vuln.py | #!/usr/bin/env python3
from Crypto.Hash import SHA256
from Crypto.Cipher import AES
import signal, random
random = random.SystemRandom()
q = 0x3a05ce0b044dade60c9a52fb6a3035fc9117b307ca21ae1b6577fef7acd651c1f1c9c06a644fd82955694af6cd4e88f540010f2e8fdf037c769135dbe29bf16a154b62e614bb441f318a82ccd1e493ffa565e5ffd5a70825... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2021/crypto/kipferl/vuln.py | ctfs/hxp/2021/crypto/kipferl/vuln.py | #!/usr/bin/env python3
from Crypto.Hash import SHA256
from Crypto.Cipher import AES
import signal, random
random = random.SystemRandom()
q = 0x3a05ce0b044dade60c9a52fb6a3035fc9117b307ca21ae1b6577fef7acd651c1f1c9c06a644fd82955694af6cd4e88f540010f2e8fdf037c769135dbe29bf16a154b62e614bb441f318a82ccd1e493ffa565e5ffd5a70825... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2021/crypto/zipfel/vuln.py | ctfs/hxp/2021/crypto/zipfel/vuln.py | #!/usr/bin/env python3
from Crypto.Hash import SHA256
from Crypto.Cipher import AES
import signal, random
random = random.SystemRandom()
q = 0x3a05ce0b044dade60c9a52fb6a3035fc9117b307ca21ae1b6577fef7acd651c1f1c9c06a644fd82955694af6cd4e88f540010f2e8fdf037c769135dbe29bf16a154b62e614bb441f318a82ccd1e493ffa565e5ffd5a70825... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2018/Green_Computing_1_fix/run.py | ctfs/hxp/2018/Green_Computing_1_fix/run.py | #!/usr/bin/env python3
import random
import string
import sys
import tempfile
import shutil
import os
import base64
# Damn Chinese nation-state-level hackers added a tiny chip here :/
# Seems like they are injecting ACPI tables to save electricity O_O
# Please inform Bloomberg
tmp_dir = tempfile.mkdtemp(prefix='green_... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2018/Green_Computing_1/run.py | ctfs/hxp/2018/Green_Computing_1/run.py | #!/usr/bin/env python3
import random
import string
import sys
import tempfile
import shutil
import os
import base64
# Damn Chinese nation-state-level hackers added a tiny chip here :/
# Seems like they are injecting ACPI tables to save electricity O_O
# Please inform Bloomberg
tmp_dir = tempfile.mkdtemp(prefix='green_... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2018/yunospace/wrapper.py | ctfs/hxp/2018/yunospace/wrapper.py | #!/usr/bin/python3 -u
import sys, os, base64
FLAG = "hxp{find_the_flag_on_the_server_here}"
print(" y-u-no-sp ")
print("XXXXXXXXx.a ")
print("OOOOOOOOO| ")
print("OOOOOOOOO| c ")
print("OOOOOOOOO| ")
print("OOOOOOOOO| ")
print("OO... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2018/Green_Computing_2/run.py | ctfs/hxp/2018/Green_Computing_2/run.py | #!/usr/bin/env python3
import random
import string
import sys
import tempfile
import shutil
import os
import base64
# Damn Chinese nation-state-level hackers added a tiny chip here :/
# Seems like they are injecting ACPI tables to save electricity O_O
# Please inform Bloomberg
tmp_dir = tempfile.mkdtemp(prefix='green_... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2022/pwn/shadertoy_plus_plus/example_client/client.py | ctfs/hxp/2022/pwn/shadertoy_plus_plus/example_client/client.py | from pwn import *
from io import BytesIO
import base64
from PIL import Image
file = open("shader.txt", "rb")
shader = file.read()
file.close()
shader = shader.ljust(4095)
io = remote("localhost", 27500)
if True:
## If PoW is required...
io.readuntil(b"please give S such that sha256(unhex(\"")
prefix = io... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2022/pwn/browser_insanity/enter_challenge.py | ctfs/hxp/2022/pwn/browser_insanity/enter_challenge.py | #!/usr/bin/python3
# This script is just for entering the URL into the browser in the VM.
#
# Accepted URL characters are: upper and lowercase ASCII, digits, .:/ %=
import time
import subprocess
import pty
import os
import string
import sys
data = input("What is the URL to visit? ")
if len(data) > 64:
print("UR... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2022/crypto/yor/vuln.py | ctfs/hxp/2022/crypto/yor/vuln.py | #!/usr/bin/env python3
import random
greets = [
"Herzlich willkommen! Der Schlüssel ist {0}, und die Flagge lautet {1}.",
"Bienvenue! Le clé est {0}, et le drapeau est {1}.",
"Hartelijk welkom! De sleutel is {0}, en de vlag luidt {1}.",
"ようこそ!鍵は{0}、旗は{1}です。",
"歡迎!鑰匙是{0},旗幟是{1}。",... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2022/crypto/not_csidh/vuln.py | ctfs/hxp/2022/crypto/not_csidh/vuln.py | #!/usr/bin/env python3
from sage.all import *
proof.all(False)
p = 0x196c20a5235aa2c43071905be8e809d089d24fa9144143cf0977680f15b11351
j = 0x145b6a85f73443b1ef971b5152d87725ffe78a542bcaf60671e7afa3857a2530
ls = [3, 5, 7, 11, 13, 19, 23, 31, 71, 89, 103, 109, 113, 131, 149, 151, 163, 179, 193, 211, 223, 233]
B = 20
###... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2022/crypto/whistler/vuln.py | ctfs/hxp/2022/crypto/whistler/vuln.py | #!/usr/bin/env python3
import struct, hashlib, random, os
from Crypto.Cipher import AES
n = 256
q = 11777
w = 8
################################################################
sample = lambda rng: [bin(rng.getrandbits(w)).count('1') - w//2 for _ in range(n)]
add = lambda f,g: [(x + y) % q for x,y in zip(f,g)]
def... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2022/crypto/the_swirl/vuln.py | ctfs/hxp/2022/crypto/the_swirl/vuln.py | #!/usr/bin/env python3
import struct, hashlib, random, os, ctypes
from Crypto.Cipher import AES
n = 256
q = 11777
w = 8
################################################################
sample = lambda rng: [bin(rng.getrandbits(w)).count('1') - w//2 for _ in range(n)]
add = lambda f,g: [(x + y) % q for x,y in zip(f,... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2022/web/true_web_assembly/admin.py | ctfs/hxp/2022/web/true_web_assembly/admin.py | #!/usr/bin/env python3
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.expected_conditions import visi... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2022/web/true_web_assembly/preregister_admin.py | ctfs/hxp/2022/web/true_web_assembly/preregister_admin.py | import secrets
import string
import hashlib
import sqlite3
import os
email = "johnfound@hxp.io"
username = os.getenv("ADMIN_USERNAME", "hxp_admin")
password = os.getenv("ADMIN_PASSWORD", "testtesttesttest")
if password == None or len(password) < 16:
print(f"Admin password is somehow invalid. Password: {password}... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2022/web/archived/admin.py | ctfs/hxp/2022/web/archived/admin.py | #!/usr/bin/env python3
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2022/web/sqlite_web/patch.py | ctfs/hxp/2022/web/sqlite_web/patch.py | #!/usr/bin/env python3
with open("sqlite_web/sqlite_web.py", "r") as f:
orig = f.read()
patched = orig.replace("""'SELECT *\\nFROM "%s"'""", '''"""WITH bytes(i, s) AS (
VALUES(1, '') UNION ALL
SELECT i + 1, (
SELECT ((v|k)-(v&k)) & 255 FROM (
SELECT
(SELECT asciicode fr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2020/pwn/nemoji/gen_challenge.py | ctfs/hxp/2020/pwn/nemoji/gen_challenge.py | #!/usr/bin/env python3
import urllib.request
import sys
import hashlib
KNOWN_GOOD_HASH = "9eb64f52f8970d0ce86b9ae366ea55cab35032ca6a2fd15f14f1354f493644d6"
DRGNS_GOOD_URL = "https://storage.googleapis.com/dragonctf-prod/noemoji_9eb64f52f8970d0ce86b9ae366ea55cab35032ca6a2fd15f14f1354f493644d6/main"
def nop(dat, start... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2020/pwn/audited/audited.py | ctfs/hxp/2020/pwn/audited/audited.py | #!/usr/bin/python3 -u
import sys
from os import _exit as __exit
def audit(name, args):
if not audit.did_exec and name == 'exec':
audit.did_exec = True
else:
__exit(1)
audit.did_exec = False
sys.stdout.write('> ')
try:
code = compile(sys.stdin.read(), '<user input>', 'exec')
except:
__... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2020/crypto/nanothorpe/service.py | ctfs/hxp/2020/crypto/nanothorpe/service.py | #!/usr/bin/env python3
from octothorpe import octothorpe
from base64 import b64decode, b64encode
from datetime import datetime, timedelta, timezone
from flask import Flask, make_response, redirect, render_template, request
from socket import MSG_WAITALL, socket
from struct import unpack
from urllib.parse import parse... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2020/crypto/nanothorpe/executor.py | ctfs/hxp/2020/crypto/nanothorpe/executor.py | #!/usr/bin/env python3
from subprocess import run
from sys import stdin, stdout
from struct import pack
command = stdin.buffer.readline().rstrip(b'\n')
result = run(command, shell=True, capture_output=True, timeout=0.5)
header = pack('III', result.returncode, len(result.stdout), len(result.stderr))
message = header +... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2020/crypto/nanothorpe/octothorpe.py | ctfs/hxp/2020/crypto/nanothorpe/octothorpe.py | #!/usr/bin/env python3
import math
class octothorpe:
digest_size = 16
block_size = 64
name = "octothorpe"
state_size = 16
shift_count = 64
round_count = 20
initial_state = bytearray.fromhex('00112233445566778899aabbccddeeff')
function = lambda i: math.cos(i ** 3)
sbox = sorted(ra... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2020/crypto/octothorpe/service.py | ctfs/hxp/2020/crypto/octothorpe/service.py | #!/usr/bin/env python3
from octothorpe import octothorpe
from base64 import b64decode, b64encode
from Crypto.PublicKey import ECC
from Crypto.Signature import DSS
from datetime import datetime, timedelta, timezone
from flask import Flask, make_response, redirect, render_template, request
from socket import MSG_WAITAL... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2020/crypto/octothorpe/executor.py | ctfs/hxp/2020/crypto/octothorpe/executor.py | #!/usr/bin/env python3
from subprocess import run
from sys import stdin, stdout
from struct import pack
command = stdin.buffer.readline().rstrip(b'\n')
result = run(command, shell=True, capture_output=True, timeout=0.5)
header = pack('III', result.returncode, len(result.stdout), len(result.stderr))
message = header +... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2020/crypto/octothorpe/octothorpe.py | ctfs/hxp/2020/crypto/octothorpe/octothorpe.py | #!/usr/bin/env python3
import math
class octothorpe:
digest_size = 16
block_size = 64
name = "octothorpe"
state_size = 16
shift_count = 64
round_count = 20
initial_state = bytearray.fromhex('00112233445566778899aabbccddeeff')
function = lambda i: math.cos(i ** 3)
sbox = sorted(ra... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/hxp/2020/crypto/minithorpe/service.py | ctfs/hxp/2020/crypto/minithorpe/service.py | #!/usr/bin/env python3
from octothorpe import octothorpe
from base64 import b64decode, b64encode
from datetime import datetime, timedelta, timezone
from flask import Flask, make_response, redirect, render_template, request
from socket import MSG_WAITALL, socket
from struct import unpack
app = Flask(__name__)
with op... | 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.