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/UCTF/2024/crypto/Modal_1/challenge.py | ctfs/UCTF/2024/crypto/Modal_1/challenge.py | from secret import flag
size = len(flag)
for i in range(size-1):
print(ord(flag[i]) + ord(flag[i+1]), end=",") | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UCTF/2024/crypto/Karaball/challenge.py | ctfs/UCTF/2024/crypto/Karaball/challenge.py | from ECC import Curve, Coord
from secrets import randbelow
flag = "uctf{test_flag}"
signatures = {}
valid_hosts = {'uctf.ir'}
a = 0x0
b = 0x7
p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f
Gx = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
Gy = 0x483ada7726a3c4655da4fbfc0e... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UCTF/2024/crypto/Karaball/ECC.py | ctfs/UCTF/2024/crypto/Karaball/ECC.py |
class Coord:
def __init__(self, x, y) -> None:
self.x = x
self.y = y
class Curve:
def __init__(self, a, b, p) -> None:
self.a = a
self.b = b
self.p = p
def addition(self, P, Q):
x3 = -1
y3 = -1
if P.x == 0 and P.x == 0:
x3 = ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SHELL/2021/rev/keygen/keygen.py | ctfs/SHELL/2021/rev/keygen/keygen.py | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false | |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SHELL/2021/crypto/PowerRSA/script.py | ctfs/SHELL/2021/crypto/PowerRSA/script.py | from Crypto.Util.number import getPrime,isPrime,bytes_to_long
from Crypto.PublicKey.RSA import construct
from secret import flag
def getNextPrime(number):
while not isPrime(number):
number+=1
return number
p = getPrime(2048)
q = getNextPrime(p+1)
n = p*q
e = 65537
encrypted_flag = pow(bytes_to_long(f... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SHELL/2021/crypto/Puny_Factors/secret.py | ctfs/SHELL/2021/crypto/Puny_Factors/secret.py | from Crypto.Util.number import getPrime,inverse,long_to_bytes,bytes_to_long
from Crypto.PublicKey import RSA
flag = "shellctf{something_here}"
n = getPrime(4096)
e = 65537
phi = (n-1)*(n-1)
d = inverse(e,phi)
encrypted_flag = pow(bytes_to_long(flag.encode()),e,n)
decrypted_flag = long_to_bytes(pow(encrypted_flag,d,n... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SHELL/2021/crypto/Vuln-AES/encrypt.py | ctfs/SHELL/2021/crypto/Vuln-AES/encrypt.py | #!/usr/bin/env python3
import base64
from Crypto.Cipher import AES
secret_code = "<flag>"
def pad(message):
if len(message) % 16 != 0:
message = message + '0'*(16 - len(message)%16 ) #block-size = 16
return message
def encrypt(key, plain):
cipher = AES.new( key, AES.MODE_ECB )
return ciph... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SHELL/2021/crypto/BruteforceRSA/script.py | ctfs/SHELL/2021/crypto/BruteforceRSA/script.py | from Crypto.Util.number import bytes_to_long,inverse,getPrime,long_to_bytes
from secret import message
import json
p = getPrime(128)
q = getPrime(128)
n = p * q
e = 65537
enc = pow(bytes_to_long(message.encode()),e,n)
print("Encrypted Flag is {}".format(enc))
open('./values.json','w').write(json.dumps({"e":e,"n":n... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SHELL/2021/crypto/arc-cipher/script.py | ctfs/SHELL/2021/crypto/arc-cipher/script.py | text = "<flag>"
key = "MANGEKYOU"
s = []
k = []
for i in key:
k.append(((ord(i))))
for i in range(0,256):
s.append(i) # i.e. s = [0 1 2 3 4 5 6 7 ..]
if i >= len(key):
k.append(k[i%len(key)])
def key_sche(s,k):
j = 0
for i in range(0,256):
j = (j + s[i] + k[i])%256
temp ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SHELL/2021/crypto/Algoric-Shift/script.py | ctfs/SHELL/2021/crypto/Algoric-Shift/script.py | text = 'flag{...}'
key = [3,1,2]
li0 = []
li1 = []
li2 = []
for i in range(0,len(text)):
if i % 3 == 0:
li0.append(text[i])
elif (i - 1) % 3 == 0:
li1.append(text[i])
elif (i - 2) % 3 == 0:
li2.append(text[i])
li = []
for i in range(len(li1)):
li.append(li1[i])
li.append(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SHELL/2021/crypto/Subsi/script.py | ctfs/SHELL/2021/crypto/Subsi/script.py | alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ{}_1234567890'
key = 'QWERTPOIUYASDFGLKJHZXCVMNB{}_1234567890'
text = <flag>
def encrypter(text,key):
encrypted_msg = ''
for i in text:
index = alpha.index(i)
encrypted_msg += key[index]
# print(encrypted_msg)
return encrypted_msg
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SHELL/2022/crypto/OX9OR2/encryption.py | ctfs/SHELL/2022/crypto/OX9OR2/encryption.py | def xor(msg, key):
o = ''
for i in range(len(msg)):
o += chr(ord(msg[i]) ^ ord(key[i % len(key)]))
return o
with open('message', 'r') as f:
msg = ''.join(f.readlines()).rstrip('\n')
with open('key', 'r') as k:
key = ''.join(k.readlines()).rstrip('\n')
assert key.isalnum() and (len(k... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WATCTF/2025/rev/those_who_rev/run.py | ctfs/WATCTF/2025/rev/those_who_rev/run.py | #!/usr/local/bin/python
import sys, os
inpfile = open('/tmp/input', 'w')
while True:
line = input()
if line == "":
break
inpfile.write(line + "\n")
inpfile.close()
os.system('FLAG="$(cat flag.txt)" /k/k chall.k')
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WATCTF/2025/crypto/alice_and_bob/communicate.py | ctfs/WATCTF/2025/crypto/alice_and_bob/communicate.py | #!/usr/local/bin/python
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives.kdf.hkdf import HKDF
from cryptography.hazmat.primitives import serialization as ser
from cryptography.fernet import Fernet
import base64
from secret im... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GPN/2024/crypto/Hackerman_Hash/hackerman-hash/generate.py | ctfs/GPN/2024/crypto/Hackerman_Hash/hackerman-hash/generate.py | import sys
from rich.progress import track
import random
SALT_RANGE = (150000,250000)
Prev_Mod = 426900
CHUNK_SIZE=4
FLAG = open("FLAG").readline().strip()
def keyedAck(key):
def ack(m,n):
if m == 0:
return n+key
if n == 0:
return ack(m-1,1)
return ack(m-1,ack(m,n-1... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/scriptCTF/2025/misc/Div_2/chall.py | ctfs/scriptCTF/2025/misc/Div_2/chall.py | import secrets
import decimal
decimal.getcontext().prec = 50
secret = secrets.randbelow(1 << 127) + (1 << 127) # Choose a 128 bit number
for _ in range(1000):
print("[1] Provide a number\n[2] Guess the secret number")
choice = int(input("Choice: "))
if choice == 1:
num = input('Enter a number: ')
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/scriptCTF/2025/misc/Div/chall.py | ctfs/scriptCTF/2025/misc/Div/chall.py | import os
import decimal
decimal.getcontext().prec = 50
secret = int(os.urandom(16).hex(),16)
num = input('Enter a number: ')
if 'e' in num.lower():
print("Nice try...")
exit(0)
if len(num) >= 10:
print('Number too long...')
exit(0)
fl_num = decimal.Decimal(num)
div = secret / fl_num
if div == 0:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/scriptCTF/2025/misc/Modulo/jail.py | ctfs/scriptCTF/2025/misc/Modulo/jail.py | import ast
print("Welcome to the jail! You're never gonna escape!")
payload = input("Enter payload: ") # No uppercase needed
blacklist = list("abdefghijklmnopqrstuvwxyz1234567890\\;._")
for i in payload:
assert ord(i) >= 32
assert ord(i) <= 127
assert (payload.count('>') + payload.count('<')) <= 1
asser... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/scriptCTF/2025/crypto/Mod/chall.py | ctfs/scriptCTF/2025/crypto/Mod/chall.py | #!/usr/local/bin/python3
import os
secret = int(os.urandom(32).hex(),16)
print("Welcome to Mod!")
num=int(input("Provide a number: "))
print(num % secret)
guess = int(input("Guess: "))
if guess==secret:
print(open('flag.txt').read())
else:
print("Incorrect!")
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/scriptCTF/2025/programming/Back_From_Where/real_server.py | ctfs/scriptCTF/2025/programming/Back_From_Where/real_server.py | import random
import sys
import subprocess
import time
n = 100
grid_lines = []
for _ in range(n):
row = []
for _ in range(n):
flip = random.randint(1, 2)
if flip == 1:
row.append(str(random.randint(1, 696) * 2))
else:
row.append(str(random.randint(1, 696) * 5))
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/scriptCTF/2025/programming/Sums/server.py | ctfs/scriptCTF/2025/programming/Sums/server.py | #!/usr/bin/env python3
import random
import subprocess
import sys
import time
start = time.time()
n = 123456
nums = [str(random.randint(0, 696969)) for _ in range(n)]
print(' '.join(nums), flush=True)
ranges = []
for _ in range(n):
l = random.randint(0, n - 2)
r = random.randint(l, n - 1)
ranges.append... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/scriptCTF/2025/programming/Windows_To_Infinity/server.py | ctfs/scriptCTF/2025/programming/Windows_To_Infinity/server.py | mport random
import subprocess
n = 1000000
window_size = n / 2
"""
You will receive {n} numbers.
Every round, you will need to calculate a specific value for every window.
You will be doing the calculations on the same {n} numbers every round.
For example, in this round, you will need to find the sum of every window.... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/sign_file.py | ctfs/Intent/2021/crypto/SANSA/sign_file.py |
from STARK.rescue_stark import rescue_sign
from STARK.rescue.rescue_hash import rescue
import yaml
from hashlib import blake2s
blake = lambda x: blake2s(x).digest()
PASSWORD = "<REDACTED>"
PASSWORD_HASH = [2019939026277137767,979901374969048238,1067125847181633502,445793449878813313]
def sign_file(path):
"""
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/verify_file.py | ctfs/Intent/2021/crypto/SANSA/verify_file.py | from STARK.rescue_stark import rescue_verify
from STARK.rescue.rescue_hash import rescue
import yaml
from hashlib import blake2s
from logging import *
blake = lambda x: blake2s(x).digest()
PASSWORD_HASH = [2019939026277137767,979901374969048238,1067125847181633502,445793449878813313]
def verify_file(path, signature)... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/index.py | ctfs/Intent/2021/crypto/SANSA/index.py | import os
from flask import Flask, request, render_template
from verify_file import verify_data
import base64
from logging import *
import yaml
import json
app = Flask(__name__, template_folder=".", static_folder="public", static_url_path="/")
app.config['DEBUG'] = True
app.config["SECRET_KEY"] = os.getenv("SECRET_KEY... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/STARK/fri.py | ctfs/Intent/2021/crypto/SANSA/STARK/fri.py | from .permuted_tree import merkelize, mk_branch, verify_branch, mk_multi_branch, verify_multi_branch
from .utils import get_power_cycle, get_pseudorandom_indices
from .poly_utils import PrimeField
# Generate an FRI proof that the polynomial that has the specified
# values at successive powers of the specified root of ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/STARK/permuted_tree.py | ctfs/Intent/2021/crypto/SANSA/STARK/permuted_tree.py | from .merkle_tree import merkelize as _merkelize
from .merkle_tree import mk_branch as _mk_branch
from .merkle_tree import verify_branch as _verify_branch
from .merkle_tree import mk_multi_branch as _mk_multi_branch
from .merkle_tree import verify_multi_branch as _verify_multi_branch
from .merkle_tree import blake
def... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/STARK/rescue_stark.py | ctfs/Intent/2021/crypto/SANSA/STARK/rescue_stark.py | import numpy as np
from math import ceil, log
import time
from .rescue.rescue_constants import MDS_MATRIX, INV_MDS_MATRIX, ROUND_CONSTANTS, PRIME, WORD_SIZE, NUM_ROUNDS, STATE_SIZE
from .poly_utils import PrimeField
from .utils import get_power_cycle, get_pseudorandom_indices, is_a_power_of_2
from .fft import fft
fr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | true |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/STARK/utils.py | ctfs/Intent/2021/crypto/SANSA/STARK/utils.py | from .merkle_tree import blake
# Get the set of powers of R, until but not including when the powers
# loop back to 1
def get_power_cycle(r, modulus):
o = [1, r]
while o[-1] != 1:
o.append((o[-1] * r) % modulus)
return o[:-1]
# Extract pseudorandom indices from entropy
def get_pseudorandom_indices... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/STARK/__init__.py | ctfs/Intent/2021/crypto/SANSA/STARK/__init__.py | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false | |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/STARK/poly_utils.py | ctfs/Intent/2021/crypto/SANSA/STARK/poly_utils.py | # Creates an object that includes convenience operations for numbers
# and polynomials in some prime field
class PrimeField():
def __init__(self, modulus):
assert pow(2, modulus, modulus) == 2
self.modulus = modulus
def add(self, x, y):
return (x+y) % self.modulus
def sub(self, x,... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/STARK/merkle_tree.py | ctfs/Intent/2021/crypto/SANSA/STARK/merkle_tree.py | from hashlib import blake2s
blake = lambda x: blake2s(x).digest()
def merkelize(L):
# L = permute4(L)
nodes = [b''] * len(L) + [x.to_bytes(32, 'big') if isinstance(x, int) else x for x in L]
for i in range(len(L) - 1, 0, -1):
nodes[i] = blake(nodes[i*2] + nodes[i*2+1])
return nodes
def mk_bran... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/STARK/fft.py | ctfs/Intent/2021/crypto/SANSA/STARK/fft.py | def _simple_ft(vals, modulus, roots_of_unity):
L = len(roots_of_unity)
o = []
for i in range(L):
last = 0
for j in range(L):
last += vals[j] * roots_of_unity[(i*j)%L]
o.append(last % modulus)
return o
def _fft(vals, modulus, roots_of_unity):
if len(vals) <= 4:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/STARK/rescue/rescue_hash.py | ctfs/Intent/2021/crypto/SANSA/STARK/rescue/rescue_hash.py | import numpy as np
from .rescue_constants import MDS_MATRIX, NUM_ROUNDS, PRIME, ROUND_CONSTANTS, WORD_SIZE
def pow_mod(vector: np.ndarray, exponent: int, p: int) -> np.ndarray:
"""
Returns a numpy array which, in index i, will be equal to (vector[i] ** exponent % p), where
'**' is the power operator.
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/STARK/rescue/__init__.py | ctfs/Intent/2021/crypto/SANSA/STARK/rescue/__init__.py | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false | |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/STARK/rescue/rescue_constants.py | ctfs/Intent/2021/crypto/SANSA/STARK/rescue/rescue_constants.py | # The MDS matrix used in Rescue, generated by the function generate_mds_matrix() which is located in
# rescue_constants.sage.
MDS_MATRIX = [[823338088869439231, 2117108638373820691, 2229447756518613873,
1267826118149340713, 1914040319882762128, 1517472965193791713,
1517185983240457465, 117... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Intent/2021/crypto/SANSA/STARK/rescue/rescue_hash_test.py | ctfs/Intent/2021/crypto/SANSA/STARK/rescue/rescue_hash_test.py | from .rescue_hash import rescue_hash
def test_rescue_hash():
# The list of constants being compared to the result of rescue_hash was generated by performing
# the hash on [1, 2, 3, 4, 5, 6, 7, 8] with the marvellous_hash function given in
# https://starkware.co/hash-challenge-implementation-reference-code... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Hackappatoi/2023/misc/Poetry_contest/buildd.py | ctfs/Hackappatoi/2023/misc/Poetry_contest/buildd.py | import os
def banner():
pacciani = """\tSe ni’ mondo esistesse un po’ di bene
e ognun si considerasse suo fratello,
ci sarebbe meno pensieri e meno pene
e il mondo ne sarebbe assai più bello."""
eng = """\tIf only a little good existed in the world\t
and each considered himself the other's brother\t
there wou... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Hackappatoi/2022/web/BeerFast/run.py | ctfs/Hackappatoi/2022/web/BeerFast/run.py | import app
from app.bot import run_bot
if __name__ == "__main__":
application, admin_usr, admin_pwd = app.create_app(__name__, config=None)
run_bot(admin_usr, admin_pwd)
application.run(host="0.0.0.0", port=8000, debug=False)
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Hackappatoi/2022/web/BeerFast/miniserver.py | ctfs/Hackappatoi/2022/web/BeerFast/miniserver.py | from flask import Flask
import secrets
import sys
import os
app = Flask(__name__)
@app.route('/')
def index():
raise Exception('test')
if __name__ == '__main__':
# generate stronger pin
if "WERKZEUG_DEBUG_PIN" not in os.environ:
rand_pin = 100000000000000 + secrets.randbelow(999999999999999)
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Hackappatoi/2022/web/BeerFast/app/helper.py | ctfs/Hackappatoi/2022/web/BeerFast/app/helper.py | from datetime import datetime
import time
import os
import secrets
from .models import User
from .globals import Database
from .models import LoginLog
from threading import Thread
import socket
import logging
import subprocess
class LoginHelper:
usr = None
def _constant_time_compare(self, s1, s2):
va... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Hackappatoi/2022/web/BeerFast/app/models.py | ctfs/Hackappatoi/2022/web/BeerFast/app/models.py | from flask_login import UserMixin
from . import globals
class User(globals.Database.Model, UserMixin):
id = globals.Database.Column(globals.Database.Integer, primary_key=True)
username = globals.Database.Column(globals.Database.String(64), nullable=False)
password = globals.Database.Column(globals.Databa... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Hackappatoi/2022/web/BeerFast/app/database.py | ctfs/Hackappatoi/2022/web/BeerFast/app/database.py | from flask_sqlalchemy import SQLAlchemy
from . import globals
import string
import random
def random_string(count=32):
charset = string.digits + string.ascii_lowercase + string.ascii_uppercase
pwd = ""
for _ in range(0, count):
pwd += random.choice(charset)
return pwd
def init_database(app):... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Hackappatoi/2022/web/BeerFast/app/config.py | ctfs/Hackappatoi/2022/web/BeerFast/app/config.py | import os
SESSION_USE_SIGNER = True
SECRET_KEY = os.getenv("SECRET_KEY")
SQLALCHEMY_DATABASE_URI = "sqlite:///database.sqlite"
SQLALCHEMY_TRACK_MODIFICATIONS = False
TEMPLATES_AUTO_RELOAD = True
SESSION_TYPE = "sqlalchemy"
SESSION_SQLALCHEMY_TABLE = 'sessions'
CACHE_TYPE = "SimpleCache"
CACHE_DEFAULT_TIMEOUT = 5
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Hackappatoi/2022/web/BeerFast/app/__init__.py | ctfs/Hackappatoi/2022/web/BeerFast/app/__init__.py | from .app import create_app
__all__ = ["create_app"]
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Hackappatoi/2022/web/BeerFast/app/routes.py | ctfs/Hackappatoi/2022/web/BeerFast/app/routes.py | import base64
import json
import logging
import hashlib
import os
import re
import time
from . import helper
from . import globals as __globals__
from .models import User
from .app import Login
from logging.handlers import RotatingFileHandler
from flask_login import login_user, login_required, logout_user, current_user... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Hackappatoi/2022/web/BeerFast/app/globals.py | ctfs/Hackappatoi/2022/web/BeerFast/app/globals.py | App = None
Database = None
Session = None
Cache = None
__all__ = ["App", "Database", "Session", "Cache"]
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Hackappatoi/2022/web/BeerFast/app/bot.py | ctfs/Hackappatoi/2022/web/BeerFast/app/bot.py | from selenium import webdriver
from selenium.webdriver.common.by import By
# import chromedriver_binary
from threading import Thread
import time
def run_bot(user, password):
thread = Thread(target=run, args=(user, password))
thread.daemon = True
thread.start()
def run(user, password):
time.sleep(2)
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Hackappatoi/2022/web/BeerFast/app/app.py | ctfs/Hackappatoi/2022/web/BeerFast/app/app.py | from flask import Flask
from flask_sessionstore import Session
from flask_login import LoginManager
from flask_caching import Cache
from . import globals
from dotenv import load_dotenv
Login = LoginManager()
def create_app(name, config=None):
load_dotenv()
globals.App = Flask(name)
if config is not None... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Hackappatoi/2022/web/Hackbar/src/vendor/mockery/mockery/docs/conf.py | ctfs/Hackappatoi/2022/web/Hackbar/src/vendor/mockery/mockery/docs/conf.py | # -*- coding: utf-8 -*-
#
# Mockery Docs documentation build configuration file, created by
# sphinx-quickstart on Mon Mar 3 14:04:26 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesCanberra/2021/crypto/Despicable_Key/enc.py | ctfs/BSidesCanberra/2021/crypto/Despicable_Key/enc.py | ## ENCRYPT
## pip install pycryptodomex
from binascii import *
from Cryptodome.Cipher import AES
key = b'cybearscybears20'
import os
n = os.urandom(12)
with open('flag.png', 'rb') as f:
d = f.read()
a = AES.new(key, AES.MODE_GCM, nonce=n)
cipher, tag = a.encrypt_and_digest(d)
with open('flag.png.enc', 'wb') as... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesCanberra/2021/crypto/Rot_Away_Rust/client_initiator.py | ctfs/BSidesCanberra/2021/crypto/Rot_Away_Rust/client_initiator.py | import json
import Crypto.Cipher.AES as aes
import Crypto.Random as rand
from binascii import *
import struct
from pwn import *
import argparse
class ClientInitiator:
def __init__(self, responder_address, responder_port, server_address, server_port, client_id, client_server_key):
self.client_id = client_id... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesCanberra/2021/crypto/Rot_Away_Rust/server.py | ctfs/BSidesCanberra/2021/crypto/Rot_Away_Rust/server.py | #!/usr/bin/python3
import json
import Crypto.Cipher.AES as aes
import Crypto.Random as rand
from binascii import *
import struct
import string
import sys
def debug_print(err):
sys.stderr.write(err)
from RARsecrets import secrets_server
def validate(value, check, minimum=None, maximum=None):
valid_types = ["... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesCanberra/2021/crypto/Rot_Away_Rust/client_responder.py | ctfs/BSidesCanberra/2021/crypto/Rot_Away_Rust/client_responder.py | import json
import Crypto.Cipher.AES as aes
import Crypto.Random as rand
from binascii import *
import struct
import string
import argparse
from RARsecrets import flag
from RARsecrets import secrets_server as ss
def validate(value, check, minimum=None, maximum=None):
valid_types = ["bool", "int", "hex"]
if c... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesCanberra/2021/crypto/Bomb_Disposal/bomb.py | ctfs/BSidesCanberra/2021/crypto/Bomb_Disposal/bomb.py | from secrets import flag
assert(len(flag) > 512//8)
seed = int.from_bytes(flag, byteorder='big')
class BBSnLCG:
def __init__(this, seed):
this.B = int.from_bytes(b'BSides CBR', byteorder='big')
this.C = int.from_bytes(b'cybears', byteorder='big')
this.D = 2020
this.N = 133... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesCanberra/2021/crypto/Empty_Vault/mt_flask.py | ctfs/BSidesCanberra/2021/crypto/Empty_Vault/mt_flask.py | from flask import Flask,render_template, request
app = Flask(__name__)
'''
"What is identity? It is the difference between us. Difference is experienced in the mind, yet the Buddha said this mind creates the world, that this world only exists in the mind and nowhere else."
'''
from hashlib import sha256
import os
fr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesCanberra/2021/crypto/Super_Cool_Facts_Server/EC.py | ctfs/BSidesCanberra/2021/crypto/Super_Cool_Facts_Server/EC.py | import Crypto.Util.number as nt
from binascii import *
#cybears 2020 params
p = 273540544991637969479760315194669352313
a = int(hexlify(b'cybears'), 16)
b = 2020
gx = 27880441596758306727342197655611673569
gy = 214924393757041059014541565759775133463
order = 273540544991637969474690923574060066154
class ec_point:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesCanberra/2021/crypto/Super_Cool_Facts_Server/SuperCoolFactsServer.py | ctfs/BSidesCanberra/2021/crypto/Super_Cool_Facts_Server/SuperCoolFactsServer.py | #!/usr/bin/python3
#Super Cool Facts Server
#author: cybears_cipher
#python3 SuperCoolFactsServer.py
#requirements
#pip3 install pycrypto
## SERVER
# socat TCP-LISTEN:3141,reuseaddr,fork EXEC:"python3 ./SuperCoolFactsServer.py"
##CLIENT
# nc localhost 3141
import os
from random import SystemRandom, choice
import ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Platypwn/2023/crypto/Non_Zero_Knowledge_Proof/server.py | ctfs/Platypwn/2023/crypto/Non_Zero_Knowledge_Proof/server.py | from secrets import randbelow
from hashlib import sha256
from Crypto.Util.number import long_to_bytes
import os
def H(msg):
return sha256(msg).digest()
class NZKP:
def __init__(self):
self.p = 26758122283288400636617299098044383566046025569206625247969009149087529122945186469955025131558423244906400... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/picoCTF/2019/crypto/AES-ABC/aes-abc.py | ctfs/picoCTF/2019/crypto/AES-ABC/aes-abc.py | #!/usr/bin/env python
from Crypto.Cipher import AES
from key import KEY
import os
import math
BLOCK_SIZE = 16
UMAX = int(math.pow(256, BLOCK_SIZE))
def to_bytes(n):
s = hex(n)
s_n = s[2:]
if 'L' in s_n:
s_n = s_n.replace('L', '')
if len(s_n) % 2 != 0:
s_n = '0' + s_n
decoded = s_... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/insomnihack/2024/Quals/blockchain/UnnamedWeb3/webserver-b090a196cf855731600b234535767182f3d838904e2f3cb329469ef06d3b96f4.py | ctfs/insomnihack/2024/Quals/blockchain/UnnamedWeb3/webserver-b090a196cf855731600b234535767182f3d838904e2f3cb329469ef06d3b96f4.py | #!/usr/bin/env python3
from flask import Flask, send_from_directory, render_template, session, request
from flask_limiter import Limiter
from secrets import token_hex
import os
import requests
import helpers
FLAG = os.getenv("FLAG", "INS{fake_flag}")
CHALLENGE_DOMAIN = "insomnihack.flag"
app = Flask(__name__)
app.sec... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/insomnihack/2024/Quals/misc/PPP/ppp.py | ctfs/insomnihack/2024/Quals/misc/PPP/ppp.py | from os import popen
import hashlib, time, math, subprocess, json
def response(res):
print(res + ' | ' + popen('date').read())
exit()
def generate_nonce():
current_time = time.time()
rounded_time = round(current_time / 60) * 60 # Round to the nearest 1 minutes (60 seconds)
return hashlib.sha256(str(int(rounded... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/insomnihack/2024/Quals/misc/Terminal_Pursuit/gui.py | ctfs/insomnihack/2024/Quals/misc/Terminal_Pursuit/gui.py | menu = """
______________________
| __________________ |
| | | |
| | Terminal pursuit | |
| |__________________| |
| |
| What to do? |
| 1) Play |
| 2) Scoreboards |
| 3) Exit |
|______________________|
"""
category = """
______________... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/insomnihack/2024/Quals/misc/Terminal_Pursuit/main.py | ctfs/insomnihack/2024/Quals/misc/Terminal_Pursuit/main.py | #!/usr/bin/env python3
import string
import subprocess
import sys
import os
import gui
alphabet = "abcdefghijklmnopqrstuvwxyz/,:;[]_-."
prefix = "/app/quizzes/"
results = prefix + "pts.txt"
def menu():
print(gui.menu)
choice = int(input("> "))
if choice != 1 and choice != 2:
exit(0)
retur... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/insomnihack/2024/Quals/web/InsoBank/api/exec_transfers.py | ctfs/insomnihack/2024/Quals/web/InsoBank/api/exec_transfers.py | #!/usr/local/bin/python
import psycopg2
import mysql.connector
import sqlite3
import os
MYSQL_DB_HOST = os.getenv("MYSQL_HOST") or 'mysql'
MYSQL_DB_USER = os.getenv("MYSQL_USER") or 'user'
MYSQL_DB_PASSWORD = os.getenv("MYSQL_PASSWORD") or 'password'
MYSQL_DB_DATABASE = os.getenv("MYSQL_DB") or 'inso24'
PG_DB_HOST =... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/insomnihack/2024/Quals/web/InsoBank/api/app.py | ctfs/insomnihack/2024/Quals/web/InsoBank/api/app.py | import os
import shutil
import mysql.connector
from flask import Flask, request, jsonify, send_from_directory, redirect
from werkzeug.utils import secure_filename
from flask_jwt_extended import JWTManager, jwt_required, get_jwt_identity, get_jwt, create_access_token
from flask_cors import CORS
import base64
import time... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/insomnihack/2023/Quals/crypto/GCM/parameters-43dd0692544fb3f248e60cc2f09597974e0aa659e299cfcd2167d624d4e528b4.py | ctfs/insomnihack/2023/Quals/crypto/GCM/parameters-43dd0692544fb3f248e60cc2f09597974e0aa659e299cfcd2167d624d4e528b4.py | m1 = b'ySsIQtp0JKMuoZ2llTPI8PaFPzeYPvY+R87SwM3agHWmBs+Xh3cGFPt3JRSR1V37jXf0vQ5OjPiVRGkCisVNX2jP1U9jFH0+xIm4h3CW2Vb15fHlDFLxXIxiiYd2aBkwvA+2QfWYx1zPad7092tz+srM6E66FlmFEV1RH02evIWipVud5nI9Gt9FuvYCvaF0O02DVhZ/wIoktcN4IdWjIBAIONV+1uRQ6ROqOwzBBa/hcBTpj5a/2arGjp0yjEF7V78fCRESiqY7cC0lGjLjzF9l949ulpQkvyGRlZBhA4YPILnY9UPW4V1... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | true |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/insomnihack/2023/Quals/web/webpix/bot.py | ctfs/insomnihack/2023/Quals/web/webpix/bot.py | #!/usr/bin/python3
from flask import Flask, request
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from waitress import serve
import os
app = Flask(__name__)
def visit(url):
options = Options()
options.add_argument(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/insomnihack/2022/Quals/web/Vault/webapp/app/app.py | ctfs/insomnihack/2022/Quals/web/Vault/webapp/app/app.py | #!/usr/bin/python3
from flask import Flask, render_template, jsonify, request, session
from flask.sessions import SecureCookieSessionInterface
import pyodbc
from flask_session import Session
import os
import re
app = Flask(__name__)
app.secret_key = os.urandom(24)
app.config['SESSION_TYPE'] = 'FileSystemSessionInterfa... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WaniCTF/2023/pwn/shell-basic/solver_template.py | ctfs/WaniCTF/2023/pwn/shell-basic/solver_template.py | from pwn import *
pc = process("./chall")
# pc = remote("",)
shell_code = b"" # PUT YOUR SHELL CODE HERE
pc.sendline(shell_code)
pc.interactive()
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WaniCTF/2023/crypto/fusion/chall.py | ctfs/WaniCTF/2023/crypto/fusion/chall.py | from Crypto.PublicKey import RSA
RSAkeys = RSA.generate(2048)
p = RSAkeys.p
q = RSAkeys.q
n = RSAkeys.n
e = RSAkeys.e
m = b"FAKE{<REDACTED>}"
c = pow(int.from_bytes(m, "big"), e, n)
mask = int("55" * 128, 16)
r = p & mask
mask = mask << 1
r += q & mask
print(f"n = {n}")
print(f"e = {e}")
print(f"c = {c}")
print(f"r ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WaniCTF/2023/crypto/dsa/chall.py | ctfs/WaniCTF/2023/crypto/dsa/chall.py | from Crypto.Util.number import isPrime
from hashlib import sha256
from os import getenv
from random import randbytes
import re
q = 13959513493813712566221316115618135736666773339258604746770995762097523942413289895289722442979925831767810967049634058156493412968893503356781422235897095313290273679131267803862614909132... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WaniCTF/2023/crypto/EZDORSA-Lv2/chall.py | ctfs/WaniCTF/2023/crypto/EZDORSA-Lv2/chall.py | from Crypto.Util.number import bytes_to_long, getPrime, long_to_bytes
p = getPrime(1024)
q = getPrime(1024)
n = p * q
e = 7
m = b"FAKE{DUNMMY_FLAG}"
c = pow(bytes_to_long(m), e, n)
c *= pow(5, 100, n)
print(f"n = {n}")
print(f"e = {e}")
print(f"c = {c}")
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WaniCTF/2023/crypto/pqqp/chall.py | ctfs/WaniCTF/2023/crypto/pqqp/chall.py | import os
from Crypto.Util.number import bytes_to_long, getPrime
flag = os.environb.get(b"FLAG", b"FAKE{THIS_IS_FAKE_FLAG}")
p = getPrime(1024)
q = getPrime(1024)
n = p * q
e = 0x10001
d = pow(e, -1, (p - 1) * (q - 1))
m = bytes_to_long(flag)
c = pow(m, e, n)
s = (pow(p, q, n) + pow(q, p, n)) % n
print(n)
print(e)... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WaniCTF/2023/crypto/EZDORSA-Lv3/chall.py | ctfs/WaniCTF/2023/crypto/EZDORSA-Lv3/chall.py | from Crypto.Util.number import *
e = 65537
n = 1
prime_list = []
while len(prime_list) < 100:
p = getPrime(25)
if not (p in prime_list):
prime_list.append(p)
for i in prime_list:
n *= i
m = b"FAKE{DUMMY_FLAG}"
c = pow(bytes_to_long(m), e, n)
print(f"n = {n}")
print(f"e = {e}")
print(f"c = {c}")... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2024/crypto/Boring_LCG/chall.py | ctfs/CrewCTF/2024/crypto/Boring_LCG/chall.py | import os
from sage.all import *
set_random_seed(1337)
Fp = GF(6143872265871328074704442651454311068421530353607832481181)
a, b = Fp.random_element(), Fp.random_element()
flag = (os.getenv('flag') or 'crew{submit_this_if_desperate}').encode()
s = Fp.from_integer(int.from_bytes(flag[len('crew{'):-len('}')], 'big'))
ou... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2024/crypto/Noisy_Encryption/server.py | ctfs/CrewCTF/2024/crypto/Noisy_Encryption/server.py | import secrets
import sympy
FLAG="crew{fake_flag}"
BITS=512
LIM=pow(2,BITS)
while True:
while (not sympy.isprime(p:=secrets.randbelow(LIM//2)+LIM//2)) or (p-1)%3==0:
pass
while (not sympy.isprime(q:=secrets.randbelow(LIM//2)+LIM//2)) or (q-1)%3==0:
pass
n=p*q
if n>pow(2,1023):
break
phi=(p-1)*(q-1)
e=3
S... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/blockchain/positive/solve-pow.py | ctfs/CrewCTF/2023/blockchain/positive/solve-pow.py | import hashlib,random
x = 100000000+random.randint(0,200000000000)
for i in range(x,x+20000000000):
m = hashlib.sha256()
ticket = str(i)
m.update(ticket.encode('ascii'))
digest1 = m.digest()
m = hashlib.sha256()
m.update(digest1 + ticket.encode('ascii'))
if m.hexdigest().startswith('0000000'):
print(i)
break | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/blockchain/deception/solve-pow.py | ctfs/CrewCTF/2023/blockchain/deception/solve-pow.py | import hashlib,random
x = 100000000+random.randint(0,200000000000)
for i in range(x,x+20000000000):
m = hashlib.sha256()
ticket = str(i)
m.update(ticket.encode('ascii'))
digest1 = m.digest()
m = hashlib.sha256()
m.update(digest1 + ticket.encode('ascii'))
if m.hexdigest().startswith('0000000'):
print(i)
break | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/blockchain/infinite/solve-pow.py | ctfs/CrewCTF/2023/blockchain/infinite/solve-pow.py | import hashlib,random
x = 100000000+random.randint(0,200000000000)
for i in range(x,x+20000000000):
m = hashlib.sha256()
ticket = str(i)
m.update(ticket.encode('ascii'))
digest1 = m.digest()
m = hashlib.sha256()
m.update(digest1 + ticket.encode('ascii'))
if m.hexdigest().startswith('0000000'):
print(i)
break | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/misc/setjail/src/void.py | ctfs/CrewCTF/2023/misc/setjail/src/void.py | """
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⢆⡱⢫⡟⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿⣿⣿⣿⣿⢿⣻⢿⣟⡿⡤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠄⠠⠀⢂⡘⢦⡳⣏⣾⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣞⣿⣳⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠐⠈⣌⢣⡑⢦⣙⢮⣳⢻⡾⣿⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/misc/setjail/src/main.py | ctfs/CrewCTF/2023/misc/setjail/src/main.py | import re
import ast
import void
"""
Example:
( when root object is A )
path: .B.C["D"][1][2][3]
value: "pyjail is fun!"
->
A.B.C["D"][1][2][3] = "pyjail is fun!"
"""
DISALLOWED_WORDS = ["os", "posix"]
ROOT_OBJECT = void
def abort(s):
print(s)
exit(1)
def to_value(s):
return ast.literal_eval(s)
# gift
modu... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/misc/starship-1/sandbox.py | ctfs/CrewCTF/2023/misc/starship-1/sandbox.py | #!/usr/bin/env python3
import re
import sys
class Nobuffers:
def __init__(self, stream):
self.stream = stream
def write(self, data):
self.stream.write(data)
self.stream.flush()
def writelines(self, datas):
self.stream.writelines([f"{data}\n" for data in datas])
sel... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/misc/starship/sandbox.py | ctfs/CrewCTF/2023/misc/starship/sandbox.py | #!/usr/bin/env python
import re
import sys
class Nobuffers:
def __init__(self, stream, limit=1024):
self.stream = stream
self.limit = limit
def write(self, data):
if len(data) > self.limit:
raise ValueError(f"Data exceeds the maximum limit of {self.limit} characters")
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/misc/jailpie/share/chall.py | ctfs/CrewCTF/2023/misc/jailpie/share/chall.py | #!/usr/local/bin/python3
import base64
import types
import dis
def is_valid(code):
whitelist = {
'LOAD_CONST',
'BINARY_OP',
'COMPARE_OP',
'POP_JUMP_BACKWARD_IF_TRUE',
'RETURN_VALUE',
}
for instr in dis.Bytecode(code):
if instr.opname not in whitelist:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/crypto/matrixrsa/server.py | ctfs/CrewCTF/2023/crypto/matrixrsa/server.py | import os
import random
from Crypto.Util.number import getPrime, long_to_bytes, bytes_to_long
from sympy.polys.matrices import DomainMatrix
from sympy import FiniteField
# secret import
from secret import decrypt
from flag import FLAG
size = 1024//8
e = 65537
def pad(data, length):
if len(data) >= length:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/crypto/sspasswd/server.py | ctfs/CrewCTF/2023/crypto/sspasswd/server.py | from Crypto.Util.number import *
# secret import
from param_secret import p, pollst
from ss_config import FLAG, ALICE_PW, BOB_PW
PWCHARSET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@_'
assert len(ALICE_PW) == 12
assert len(BOB_PW) == 12
assert all([ch in PWCHARSET for ch in ALICE_PW])
assert all([ch i... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/crypto/pi_is_3.14/server.py | ctfs/CrewCTF/2023/crypto/pi_is_3.14/server.py | import os
import signal
from flag import FLAG
N = 10000
M = 100
class XorShiftPlus:
A = 10
B = 15
C = 7
L = 23
def __init__(self) -> None:
self.x = int(os.urandom(4).hex(), 16)
self.y = int(os.urandom(4).hex(), 16)
def gen32(self) -> int:
t = self.x
s = self... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/crypto/frsa/server.py | ctfs/CrewCTF/2023/crypto/frsa/server.py | from json import dump as json_dump
from random import randint
from mpmath import mp
from Crypto.Util.number import bytes_to_long, getPrime, GCD
size = 768//8
def pad(data, length):
if len(data) >= length:
raise ValueError("length of data is too large.")
pad_data = bytes([randint(1, 255) 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/CrewCTF/2023/crypto/matrixrsa2/server.py | ctfs/CrewCTF/2023/crypto/matrixrsa2/server.py | import os
import random
from Crypto.Util.number import getPrime, long_to_bytes, bytes_to_long
from sympy.polys.matrices import DomainMatrix
from sympy import FiniteField
# secret import
from secret import decrypt
from flag import FLAG
size = 1024//8
e = 65537
def pad(data, length):
if len(data) >= length:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/web/archive_stat_viewer/web-apps/src/main.py | ctfs/CrewCTF/2023/web/archive_stat_viewer/web-apps/src/main.py | from pathlib import Path
from uuid import uuid4
from secrets import token_hex
from datetime import datetime
import os
import tarfile
import json
import shutil
from flask import Flask, request, session, send_file, render_template, redirect, make_response
app = Flask(__name__)
app.config['SECRET_KEY'] = open('./secret'... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2023/web/sequence_gallery/main.py | ctfs/CrewCTF/2023/web/sequence_gallery/main.py | import os
import sqlite3
import subprocess
from flask import Flask, request, render_template
app = Flask(__name__)
@app.get('/')
def index():
sequence = request.args.get('sequence', None)
if sequence is None:
return render_template('index.html')
script_file = os.path.basename(sequence + '.dc')
if ' ' in scrip... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2025/ppc/rotating_subsequence/chall.py | ctfs/CrewCTF/2025/ppc/rotating_subsequence/chall.py | import signal
import secrets
from check import checker
def TLE(signum, frame):
print("Timeout!")
exit(0)
signal.signal(signal.SIGALRM, TLE)
signal.alarm(200)
print("Let's see if you have what it takes!")
TT=50
nbits=256
for i in range(TT):
N=secrets.randbits(nbits)
K=secrets.randbelow(100)+3
print(f"{N=... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2025/ppc/IOIOIOI/chall.py | ctfs/CrewCTF/2025/ppc/IOIOIOI/chall.py | from solver import Solve
import signal
import secrets
def TLE(signum, frame):
print("Time Limit Exceeded. Try again...")
exit(0)
signal.signal(signal.SIGALRM, TLE)
signal.alarm(300)
params = [ # (N_min, N_max, K_min, K_max)
(1, 15, 0, 15), # Test 1
(1, 1000, 0, 1000), # Test 2
(5 * 10**8, 10... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2025/crypto/Inverse_With_Errors/main.py | ctfs/CrewCTF/2025/crypto/Inverse_With_Errors/main.py | import secrets
import hashlib
from Crypto.Cipher import AES
from Crypto.Util.number import getPrime
from Crypto.Util.Padding import pad
flag = b'crew{*** REDACTED ***}'
N_size = 1024
N = secrets.randbits(N_size) | (1 << N_size)
d = N
while d >= N:
d = getPrime(N_size)
values = []
R = []
for _ in range(30):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2025/crypto/po1337nomial/server.py | ctfs/CrewCTF/2025/crypto/po1337nomial/server.py | #!/usr/bin/env python3
from os import getenv
from random import getrandbits, randbytes, randrange, shuffle
FLAG = getenv('FLAG', 'crew{fake_flag}')
a = [getrandbits(32) for _ in range(1337)]
options = {'1': 'Get coefficients', '2': 'Evaluate', '3': 'Unlock flag'}
while options:
option = input(''.join(f'\n{k}. ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2025/crypto/EPOW/chall.py | ctfs/CrewCTF/2025/crypto/EPOW/chall.py | from sage.all import EllipticCurve, GF, os, is_prime
# Doing PoW's with elliptic curves!
Nm = 10
for TT in range(Nm):
m = os.urandom(7)
print(f"Entering proof #{TT + 1} of {Nm}, the salt is: {m.hex()}")
X = bytes.fromhex(input("> "))
A = int.from_bytes(X + m)
p = int(input("> "))
E = Elliptic... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrewCTF/2025/crypto/Smol_Aes/chall.py | ctfs/CrewCTF/2025/crypto/Smol_Aes/chall.py | from sage.all import *
import secrets
import os
BLOCK_LEN = 8
SECRETS = 30
def create_sbox():
sbox = [i for i in range(256)]
for i in range(256 - 1, -1, -1):
U = secrets.randbelow(i + 1)
sbox[i], sbox[U] = sbox[U], sbox[i]
return sbox
def create_sbox_layer(sz):
return [create_sbox(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MapleCTF/2023/misc/cjail2/jail.py | ctfs/MapleCTF/2023/misc/cjail2/jail.py | import os, re
lines = input("input c: ")
while True:
line = input()
lines += "\n"
lines += line
if line == "": break
if re.search(r'[{][^}]', lines) or re.search(r'[^{][}]', lines):
quit() # disallow function declarations
elif re.search(r';', lines):
quit() # disallow function calls
elif re.se... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MapleCTF/2023/misc/flakey_ci/ci.py | ctfs/MapleCTF/2023/misc/flakey_ci/ci.py | import os
from socket import socket
import socketserver
import select
import subprocess
NIXOWOS = r"""
_______ ____________ _______
/ \ \ \ / \
\ \ \ \ ... | 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.