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/hxp/2020/crypto/minithorpe/executor.py | ctfs/hxp/2020/crypto/minithorpe/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/minithorpe/octothorpe.py | ctfs/hxp/2020/crypto/minithorpe/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/web/hackme/admin.py | ctfs/hxp/2020/web/hackme/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/ByteBandits/2023/blockchain/GuessTheName/get_ticket.py | ctfs/ByteBandits/2023/blockchain/GuessTheName/get_ticket.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/ByteBandits/2023/crypto/CryptoMasquerade/chal.py | ctfs/ByteBandits/2023/crypto/CryptoMasquerade/chal.py | import base64
import random
import math
from Crypto.Util import number
from cryptography.fernet import Fernet
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
BIT_L = 2**8
with open("flag.txt", ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ByteBandits/2023/crypto/VisionaryCipher/chal.py | ctfs/ByteBandits/2023/crypto/VisionaryCipher/chal.py | from string import ascii_lowercase, digits
from random import choices
from hashlib import md5
with open("flag.txt", "r") as f:
FLAG = f.read()
alphabets = ascii_lowercase + digits + "_{}"
key = "".join(choices(alphabets, k=10))
def pos(ch):
return alphabets.find(ch)
def encrypt(text, key):
k, n, l = l... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2024/crypto/leaky_prime/de1fc7e127672e610447b36afe96d7db.py | ctfs/BreakTheSyntax/2024/crypto/leaky_prime/de1fc7e127672e610447b36afe96d7db.py | from secret import flag
from Crypto.Util.number import getPrime, bytes_to_long, long_to_bytes
PRIMESIZE = 512
e = 65537
p = getPrime(PRIMESIZE)
q = getPrime(PRIMESIZE)
n = p*q
c = bytes_to_long(flag)
ct = pow(c,e,n)
msb = bin(p >> 20)[2:]
print(ct)
print(n)
print(msb) | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2024/crypto/letter/005d5290c5e960026765cf5cabd55176.py | ctfs/BreakTheSyntax/2024/crypto/letter/005d5290c5e960026765cf5cabd55176.py | from string import ascii_uppercase, digits
from itertools import permutations
from random import sample, seed, randint, choice
from os import urandom
from letter import letter
alphabet = ascii_uppercase + digits
seed(urandom(32))
keys_s = ["".join(sample(alphabet, len(alphabet))) for _ in range(3)]
key_x = "".join([... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2024/crypto/backup/8e1cc9f39494494b81d5dd876ec6c1ad.py | ctfs/BreakTheSyntax/2024/crypto/backup/8e1cc9f39494494b81d5dd876ec6c1ad.py | from sage.all import *
from hashlib import sha256 as sha
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
from secrets import token_bytes
from time import time
# preshared secret
preshared_secret = token_bytes(16)
# generate a strong prime
def strong_prime(bits):
while True:
p = random_p... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2023/pwn/Build-A-Jail/challenge.py | ctfs/BreakTheSyntax/2023/pwn/Build-A-Jail/challenge.py | #!/usr/bin/env python
from mesonbuild.ast.visitor import AstVisitor
from mesonbuild.mparser import Parser, FunctionNode, StringNode
from tempfile import TemporaryDirectory
from os import system, chdir
from shutil import copytree
from pathlib import Path
from sys import stdin
FORBIDDEN_FUNCTIONS = ["run_command",
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2023/crypto/Guacamole/8b66f23496e6a5602419991de934bd43.py | ctfs/BreakTheSyntax/2023/crypto/Guacamole/8b66f23496e6a5602419991de934bd43.py | from guacamole import *
from hashlib import md5
from os import urandom
with open('flag', 'r') as f:
flag = f.read()
destinations = []
key = urandom(16)
iv_len = 96
flag_iv = urandom(96//8)
flag_ct, flag_t = aes_gua_encrypt(pt=flag.encode(), key=key, iv=flag_iv, additional_data=b"flag", t=136)
def connect(destin... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2023/crypto/Guacamole/1221ef33d9f955fedde3496c3212ea39.py | ctfs/BreakTheSyntax/2023/crypto/Guacamole/1221ef33d9f955fedde3496c3212ea39.py | from Crypto.Cipher import AES
import math
def xor(bytes_a: bytes, bytes_b: bytes, block_len: int = 128) -> bytes:
return bytes([a ^ b for (a, b) in zip(bytes_a, bytes_b)])
def b_and(bytes_a: bytes, bytes_b: bytes, block_len: int = 128) -> bytes:
return bytes([a & b for (a, b) in zip(bytes_a, bytes_b)])
def ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2023/crypto/Ed_Edd_n_Eddy/2f111c615d12391545a7ec07082a84dc.py | ctfs/BreakTheSyntax/2023/crypto/Ed_Edd_n_Eddy/2f111c615d12391545a7ec07082a84dc.py | from sympy import GF
from hashlib import sha256
from dataclasses import dataclass
from hashlib import sha512
def H(message: str) -> bytes:
return int.from_bytes(sha512(message.encode()).digest(), 'big') % q
# Ed448 curve
p = 2 ** 448 - 2 ** 224 - 1
# group order
q = 2 ** 446 - 0x8335dc163bb124b65129c96fde933d8d7... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2023/crypto/Ed_Edd_n_Eddy/fdfaf30d47a2ce2be09a240b5e4361cf.py | ctfs/BreakTheSyntax/2023/crypto/Ed_Edd_n_Eddy/fdfaf30d47a2ce2be09a240b5e4361cf.py | from ed448 import *
from os import urandom
# important
with open('ed', 'r') as f:
eds_face = f.read()
with open('flag', 'r') as f:
flag = f.read()
def generate_key():
sk = int(H(urandom(114).hex()))
B = Point(B_x, B_y)
pk = sk * B
return sk, pk
class EddyVerifier:
def __init__(self, pk)... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2023/crypto/Textbook/f4254d3801a2b78e272bda65abd9c887.py | ctfs/BreakTheSyntax/2023/crypto/Textbook/f4254d3801a2b78e272bda65abd9c887.py | from Crypto.Util.number import getPrime, GCD, getRandomRange
from collections import namedtuple
with open('flag', 'r') as f:
flag = f.read()
public = namedtuple('public', 'n g')
secret = namedtuple('secret', 'n phi mu')
sig = namedtuple('sig', 's1 s2')
b = 1024
p = getPrime(b)
q = getPrime(b)
assert p != q
n ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2023/crypto/Textbook_2/6fc5ec8da17d4fff885e6d4dd52f78d3.py | ctfs/BreakTheSyntax/2023/crypto/Textbook_2/6fc5ec8da17d4fff885e6d4dd52f78d3.py | from Crypto.Util.number import getPrime, GCD, getRandomRange
from collections import namedtuple
with open('flag', 'r') as f:
flag = f.read()
public = namedtuple('public', 'n g')
secret = namedtuple('secret', 'n phi mu')
sig = namedtuple('sig', 's1 s2')
b = 1024
p = getPrime(b)
q = getPrime(b)
assert p != q
n ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2023/crypto/Break_PSI/2e0f6f7b0a5c6e6e3430484ebbefa819.py | ctfs/BreakTheSyntax/2023/crypto/Break_PSI/2e0f6f7b0a5c6e6e3430484ebbefa819.py | from Crypto.Hash import SHA256
from Crypto.Util.number import long_to_bytes
import random
FLAG = open("flag", "r")
A = []
B = []
Ahash = []
Bhash = []
Ainv = {}
Binv = {}
limit = 32
setSize = 17
reps = 8
def intersection(A, B):
return [v for v in A if v in B]
def F(x):
h = SHA256.new(data=long_to_bytes(x... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2023/web/Curly_Fries/c4b482fe51bcf8c5dd986580cfc87569.py | ctfs/BreakTheSyntax/2023/web/Curly_Fries/c4b482fe51bcf8c5dd986580cfc87569.py | import datetime
import functools
import random
import subprocess
from urllib.parse import quote_plus, urlencode
from .db import get_tasks, get_user, register_user
from flask import redirect, render_template, request, url_for, Blueprint
from flask_jwt_extended import create_access_token, jwt_required
from flask_jwt_ext... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2022/crypto/identity3/server.py | ctfs/BreakTheSyntax/2022/crypto/identity3/server.py | #!/ust/bin/env python3
import random
import json
import signal
prime_p = 1360628774777720214439639868214668224239283066367257059551892952651715311946305394979330224124211776274887164732272751200232717153970345468041758793498771689815826022514249246993407854486830748078064079362673837989495947723650851693406839429440854... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2022/crypto/identity2/server.py | ctfs/BreakTheSyntax/2022/crypto/identity2/server.py | #!/ust/bin/env python3
import random
import json
import signal
prime_p = 1360628774777720214439639868214668224239283066367257059551892952651715311946305394979330224124211776274887164732272751200232717153970345468041758793498771689815826022514249246993407854486830748078064079362673837989495947723650851693406839429440854... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BreakTheSyntax/2022/crypto/identity/chal.py | ctfs/BreakTheSyntax/2022/crypto/identity/chal.py | #!/ust/bin/env python3
import json
import signal
prime_p = 177722061268479172618036265876397003509269048504268861767046046115994443156284488651055714387194800232244730303458489864174073986896097610603558449505871398422283548997781783328299833985053166443389417018452145117134522568709774729520563358860355765070837814475... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/NewportBlakeCTF/2023/misc/Myjail/chall.py | ctfs/NewportBlakeCTF/2023/misc/Myjail/chall.py | #!/usr/bin/env python3
# Thanks CSAW2023 for the inspiration
import ast
import sys
BANNED = {
#def not
ast.Import,
ast.ImportFrom,
ast.With,
ast.alias,
ast.Attribute,
ast.Constant,
#should be fine?
ast.Subscript,
ast.Assign,
ast.AnnAssign,
ast.AugAssign,
ast.For,
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/NewportBlakeCTF/2023/algo/sudoku_revenge/sudoku-revenge.py | ctfs/NewportBlakeCTF/2023/algo/sudoku_revenge/sudoku-revenge.py | #!/usr/local/bin/python
from random import *
from flag import flag
t = 20
print(t)
min_n = 100
for _ in range(t):
n = randint(min_n, min_n * 2)
print(n)
a = []
for i in range(n):
a.append(i + 1)
shuffle(a)
for i in range(n):
print(a[i], end="")
if i < n - 1:
print(" ", end="")
print(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/NewportBlakeCTF/2023/algo/sudoku/sudoku.py | ctfs/NewportBlakeCTF/2023/algo/sudoku/sudoku.py | #!/usr/local/bin/python
from random import *
from flag import flag
t = 20
print(t)
min_n = 100
for _ in range(t):
n = randint(min_n, min_n * 2)
print(n)
a = []
for i in range(n):
a.append(i + 1)
shuffle(a)
for i in range(n):
print(a[i], end="")
if i < n - 1:
print(" ", end="")
print(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/NewportBlakeCTF/2023/rev/Crisscross/main.py | ctfs/NewportBlakeCTF/2023/rev/Crisscross/main.py | import random
key1 = random.choices(range(256), k=20)
key2 = list(range(256))
random.shuffle(key2)
flag = open('flag.txt', 'rb').read()
def enc(n):
q = key2[n]
w = key1[q % 20]
n ^= q
return n, w
x = 0
for i, c in enumerate(flag):
x <<= 8
n, w = enc(c)
if i % 2:
n, w = w, n
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/NewportBlakeCTF/2023/crypto/Spinning_my_way_to_Straight_Lines_REVENGE/chall.py | ctfs/NewportBlakeCTF/2023/crypto/Spinning_my_way_to_Straight_Lines_REVENGE/chall.py | from Crypto.Util.number import *
import os
def xor(a, b):
return bytes(i^j for i, j in zip(a,b))
sbox = [239, 209, 87, 244, 56, 155, 29, 190, 230, 69, 8, 96, 172, 15, 137, 42,
52, 154, 28, 191, 115, 208, 86, 245, 173, 14, 136, 43, 231, 134, 194, 97,
228, 71, 193, 98, 174, 13, 139, 40, 112, 211, 85, 246, 58, 2... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/NewportBlakeCTF/2023/crypto/Too_Little_Information/chall.py | ctfs/NewportBlakeCTF/2023/crypto/Too_Little_Information/chall.py | from Crypto.Util.number import *
p = getPrime(512)
q = getPrime(512)
n = p*q
e = 65537
m = bytes_to_long(b"nbctf{[REDACTED]}")
ct = pow(m,e,n)
print(f"{ct = }")
print(f"{e = }")
print(f"{n = }")
hint = (p+q) >> 200 # I can't be giving you that much!
print(f"{hint = }")
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/NewportBlakeCTF/2023/crypto/Spinning_my_way_to_Straight_Lines/chall.py | ctfs/NewportBlakeCTF/2023/crypto/Spinning_my_way_to_Straight_Lines/chall.py | from Crypto.Util.number import *
import os
def xor(a, b):
return bytes(i^j for i, j in zip(a,b))
sbox = [239, 209, 87, 244, 56, 155, 29, 190, 230, 69, 8, 96, 172, 15, 137, 42,
52, 154, 28, 191, 115, 208, 86, 245, 173, 14, 136, 43, 231, 134, 194, 97,
228, 71, 193, 98, 174, 13, 139, 40, 112, 211, 85, 246, 58, 2... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/NewportBlakeCTF/2023/crypto/SBG_ABWs_Insanity/chall.py | ctfs/NewportBlakeCTF/2023/crypto/SBG_ABWs_Insanity/chall.py | from Crypto.Util.number import getPrime, bytes_to_long, isPrime, long_to_bytes
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
import hashlib
m = bytes_to_long(b'we give you this as a gift!')
p = getPrime(1096)
q1 = getPrime(1096)
q2 = getPrime(1096)
n1 = p*q1
n2 = p*q2
e = 11
ct1 = pow(m,e,n1)
ct... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/NewportBlakeCTF/2023/crypto/Rivest_Shamir_forgot_Adleman/chall.py | ctfs/NewportBlakeCTF/2023/crypto/Rivest_Shamir_forgot_Adleman/chall.py | from Crypto.Util.number import *
p = getPrime(1024)
q = getPrime(1024)
n = p*q
e = 123589168751396275896312856328164328381265978316578963271231567137825613822284638216416
m = bytes_to_long(b"nbctf{[REDACTED]}")
ct = (m^e) % n
print("n = ", n)
print("e = ", e)
print("ct = ", ct) | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/NewportBlakeCTF/2023/web/secret_tunnel/main.py | ctfs/NewportBlakeCTF/2023/web/secret_tunnel/main.py | #!/usr/local/bin/python
from flask import Flask, render_template, request, Response
import requests
app = Flask(__name__,
static_url_path='',
static_folder="static")
@app.route("/fetchdata", methods=["POST"])
def fetchdata():
url = request.form["url"]
if "127" in url:
return ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/NewportBlakeCTF/2023/web/secret_tunnel/flag.py | ctfs/NewportBlakeCTF/2023/web/secret_tunnel/flag.py | from flask import Flask, Response
app = Flask(__name__)
flag = open("flag.txt", "r").read()
@app.route("/flag", methods=["GET"])
def index():
return Response(flag, mimetype="text/plain")
if __name__ == "__main__":
app.run(port=1337)
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/NewportBlakeCTF/2023/web/Galleria/app.py | ctfs/NewportBlakeCTF/2023/web/Galleria/app.py | from flask import Flask, render_template, request, redirect, url_for, send_file
import os
from pathlib import Path
from werkzeug.utils import secure_filename
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = 'uploads'
@app.route('/')
def index():
return render_template('index.html')
def allowed_file(filename... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Engineer/2022/pwn/HeckerBeluga/pass_validator.py | ctfs/Engineer/2022/pwn/HeckerBeluga/pass_validator.py | def ValidatePassword(password):
valid = False
print("Attempting to validate password...")
if(len(password[::-2]) != 8):
print("Nah, you're not even close!!")
return False
pwlen = len(password)
chunk1 = 'key'.join([chr(0x98 - ord(password[c]))
for c in r... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/3kCTF/2021/pwn/klibrary/upload.py | ctfs/3kCTF/2021/pwn/klibrary/upload.py | #!/usr/bin/python3.8
from pwn import *
EXPLOIT_PATH = '/tmp/exploit'
SERVER = 178.62.107.48
PORT = 9994
SHELL_PROMPT = '$ '
def get_splitted_encoded_exploit():
split_every = 256
# Change the name to your exploit path
with open('exploit', 'rb') as exploit_file:
exploit = base64.b64encode(explo... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/3kCTF/2021/pwn/echo/upload.py | ctfs/3kCTF/2021/pwn/echo/upload.py | #!/usr/bin/python3.8
from pwn import *
EXPLOIT_PATH = '/tmp/exploit'
SERVER = 167.99.39.211
PORT = 9995
SHELL_PROMPT = '$ '
def get_splitted_encoded_exploit():
split_every = 256
# Change the name to your exploit path
with open('exploit', 'rb') as exploit_file:
exploit = base64.b64encode(explo... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/3kCTF/2021/crypto/crypto_warmup/challenge.py | ctfs/3kCTF/2021/crypto/crypto_warmup/challenge.py | import random
import math
n = 24
def make_stuff():
A = []; b = [1, 10]
for i in range(n):
A.append(random.randint(*b))
b[False] = sum(A) + 1
b[True] = int(b[False] << 1)
c = random.randint(sum(A), sum(A) << 1)
while True:
d = random.randint(sum(A), sum(A) << 1)
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/3kCTF/2021/crypto/ASR/app.py | ctfs/3kCTF/2021/crypto/ASR/app.py | import binascii
import hashlib
import random
import os
import string
import OpenSSL.crypto as crypto
rsa_p_not_prime_pem = """\n-----BEGIN RSA PRIVATE KEY-----\nMBsCAQACAS0CAQcCAQACAQ8CAQMCAQACAQACAQA=\n-----END RSA PRIVATE KEY-----\n"""
invalid_key = crypto.load_privatekey(crypto.FILETYPE_PEM, rsa_p_not_prime_pem)
e... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/3kCTF/2021/crypto/SMS/sms.py | ctfs/3kCTF/2021/crypto/SMS/sms.py | SBOX = [0xb9, 0xb3, 0x49, 0x94, 0xf9, 0x3, 0xd0, 0xfc, 0x67, 0xa3, 0x72, 0xb5,
0x45, 0x82, 0x54, 0x93, 0x5b, 0x88, 0x5c, 0xe0, 0x96, 0x41, 0xc7, 0xa,
0xdb, 0x7f, 0x77, 0x29, 0x9, 0xb, 0x8d, 0x80, 0x2d, 0xaf, 0xe1, 0x4a,
0x38, 0x73, 0x3a, 0x6a, 0xf2, 0xb6, 0xdc, 0xbd, 0x79, 0x2a, 0xcb, 0x55,
0x10, 0x61, 0x63, 0x... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/3kCTF/2021/crypto/Digital/digital.py | ctfs/3kCTF/2021/crypto/Digital/digital.py | from Crypto.Util.number import inverse
import hashlib
import os
rol = lambda val, r_bits, max_bits: (val << r_bits%max_bits) & (2**max_bits-1) | ((val & (2**max_bits-1)) >> (max_bits-(r_bits%max_bits)))
class Random():
def __init__(self, seed):
self.state = seed
self.bits = self.state.bit_length()
def next(sel... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/3kCTF/2021/crypto/secure_roots/app.py | ctfs/3kCTF/2021/crypto/secure_roots/app.py | from Crypto.Util.number import getPrime, long_to_bytes
import hashlib, os, signal
def xgcd(a, b):
if a == 0:
return (b, 0, 1)
else:
g, y, x = xgcd(b % a, a)
return (g, x - (b // a) * y, y)
def getprime():
while True:
p = getPrime(1024)
if p % 4 == 3:
return p
class Server():
def __init__(self):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/3kCTF/2021/web/3K_SIGNER/app.py | ctfs/3kCTF/2021/web/3K_SIGNER/app.py | from flask import Flask, request, jsonify, make_response
from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
import uuid
import jwt
import datetime
from functools import wraps
import os
import time
import re
import argparse
import tempfile
import PyPDF2
impo... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/3kCTF/2021/web/online_compiler/app.py | ctfs/3kCTF/2021/web/online_compiler/app.py | from flask import Flask, redirect, url_for, request
from flask_cors import CORS, cross_origin
from pathlib import Path
from subprocess import PIPE, Popen
import string
import random
def get_random_string(length):
letters = string.ascii_lowercase
result_str = ''.join(random.choice(letters) for i in range(length... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/3kCTF/2021/web/pawnshop/apache/elastic_init.py | ctfs/3kCTF/2021/web/pawnshop/apache/elastic_init.py | from elasticsearch import Elasticsearch
import random
import string
def id_generator(size=6, chars=string.ascii_lowercase+ string.digits):
return ''.join(random.choice(chars) for _ in range(size))
es_client = Elasticsearch(['http://172.30.0.7:9200'])
FLAG = '3k{*REDACTED*}'
entries=[]
entries.append({"id":1,"pict... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/3kCTF/2021/web/pawnshop/apache/src/admin.py | ctfs/3kCTF/2021/web/pawnshop/apache/src/admin.py | #!/usr/bin/python3
from funcs import *
form = cgi.FieldStorage()
action = form.getvalue('action')
if action=='list':
list_items()
elif action=='lookup':
mail = form.getvalue('mail')
if(mail != None):
verify_email(mail)
api({'msg':lookupSeller(mail)})
api({'msg':'error'})
elif action=='edit':
api({'msg':'... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/3kCTF/2021/web/pawnshop/apache/src/funcs.py | ctfs/3kCTF/2021/web/pawnshop/apache/src/funcs.py | #!/usr/bin/python3
import cgi, cgitb ,json
from elasticsearch import Elasticsearch
from email.utils import parseaddr
import json
import re
es_client = Elasticsearch(['http://172.30.0.7:9200'])
def api(jsonv):
print("Content-type: application/json\r\n\r\n")
print(json.dumps(jsonv))
exit()
def verify_email(mail):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/3kCTF/2021/web/pawnshop/apache/src/index.py | ctfs/3kCTF/2021/web/pawnshop/apache/src/index.py | #!/usr/bin/python3
from funcs import *
form = cgi.FieldStorage()
action = form.getvalue('action')
if action=='list':
list_items()
elif action=='bid':
mail = form.getvalue('mail')
item_id = form.getvalue('item_id')
amount = form.getvalue('amount')
if(mail != None and item_id != None and amount != None):
ve... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/rev/Linear_Programming/crackme.py | ctfs/SEETF/2023/rev/Linear_Programming/crackme.py | import re
# https://python-mip.readthedocs.io/en/latest/
# Change SCIP to CBC if you don't have it, it's slower but this script
# can still run to completion
from mip import Model, SCIP, BINARY
ALLOWED_CHARS = set([*b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?#$%&-_"])
def bytes_to_bits(pt):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | true |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/rev/Woodchecker/cpu.py | ctfs/SEETF/2023/rev/Woodchecker/cpu.py | # https://github.com/radical-semiconductor/woodpecker#processor-description
class CPU:
def __init__(self):
self.mem = bytearray(1 << 29)
self.addr = 0
self.store = 0
def execute(self, instr):
match instr.strip().upper():
case 'INC': self.addr += 1
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/OpenEndedRSA/chall.py | ctfs/SEETF/2023/crypto/OpenEndedRSA/chall.py | from Crypto.Util.number import *
from gmpy2 import iroot # this helps with super accurate square root calculations!
flag = b'????????????????????????'
m = bytes_to_long(flag)
e = 0x10001
pp = bytes_to_long(b'????????????????')
s = 1
assert isPrime(pp)
while not isPrime(s):
p = getPrime(512)
s = p**2 + pp**2
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/Non-neutrality/non-neutrality.py | ctfs/SEETF/2023/crypto/Non-neutrality/non-neutrality.py | from secrets import randbits
from Crypto.Util.number import bytes_to_long
import os
flag = os.environ.get('FLAG', 'SEE{not_the_real_flag}').encode()
# get a one-time-pad in which not exactly half the bits are set
def get_xorpad(bitlength):
xorpad = randbits(bitlength)
return xorpad if bin(xorpad).count('1') !... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/Shard/shard.py | ctfs/SEETF/2023/crypto/Shard/shard.py | from Crypto.Util.number import getPrime
from Crypto.Util.Padding import pad
from Crypto.Cipher import AES
from secrets import randbelow
from hashlib import sha256
from math import isqrt
import os
flag = os.environ.get('FLAG', 'SEE{not_the_real_flag}').encode()
p, q = getPrime(512), getPrime(512)
n = (p * q)**3
a = ra... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/No_Subbox/element.py | ctfs/SEETF/2023/crypto/No_Subbox/element.py | import numpy as np
from functools import reduce
_cache = {
"mul": {},
"add": {}
}
class Element:
A,B,C,D = [*map(lambda x: np.matrix(x, dtype=np.uint32), ([[1,0,0,0], [0,1,0,0], [0,0,0,1], [297,0,336,336]], [[1,269,0,0], [5,335,0,0], [0,8,0,1], [297,8,336,336]], [[8,0,0,0], [40,329,0,0], [232,0,295,0... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/No_Subbox/chal.py | ctfs/SEETF/2023/crypto/No_Subbox/chal.py | from aes import encrypt_block, Element, N_BYTES
from secrets import randbelow
key = bytes([randbelow(Element.sz) for _ in range(N_BYTES)])
pt = bytes([randbelow(Element.sz) for _ in range(N_BYTES)])
ct = encrypt_block(key, pt)
print(f"pt = {pt.hex()}")
print(f"ct = {ct.hex()}")
print("flag = SEE{%s}"%key.hex())
### ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/No_Subbox/aes.py | ctfs/SEETF/2023/crypto/No_Subbox/aes.py | # Modified from https://github.com/boppreh/aes/blob/master/aes.py
from element import Element
RCON = [*map(Element, (
0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40,
0x80, 0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A,
0x2F, 0x5E, 0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A,
0xD4, 0xB3, 0x7D, 0xFA, 0xEF, 0xC5, 0x91... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/Hard_To_Write/cipher_build.py | ctfs/SEETF/2023/crypto/Hard_To_Write/cipher_build.py | from numba import jit, uint64, byte
from numba.pycc import CC
cc = CC('_cipher')
import numpy as np
PERM = np.array([0, 16, 32, 48, 1, 17, 33, 49, 2, 18, 34, 50, 3, 19, 35, 51, 4, 20, 36, 52, 5, 21, 37, 53, 6, 22, 38, 54, 7, 23, 39, 55, 8, 24, 40, 56, 9, 25, 41, 57, 10, 26, 42, 58, 11, 27, 43, 59, 12, 28, 44, 60, 13... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/Hard_To_Write/server_secrets.py | ctfs/SEETF/2023/crypto/Hard_To_Write/server_secrets.py | FLAG = "SEE{XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}" | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/Hard_To_Write/cipher.py | ctfs/SEETF/2023/crypto/Hard_To_Write/cipher.py | import numpy as np
from _cipher import *
def decrypt(pt:bytes, key:int) -> bytes:
return internal_decrypt(np.frombuffer(pt, dtype=np.uint8), key).tobytes()
def encrypt(pt:bytes, key:int) -> bytes:
return internal_encrypt(np.frombuffer(pt, dtype=np.uint8), key).tobytes() | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/Hard_To_Write/server.py | ctfs/SEETF/2023/crypto/Hard_To_Write/server.py | from server_secrets import FLAG # only server has this!
import re
import os
import sys
import numpy as np
from cipher import byte2int, encrypt
m = re.match(r"^SEE\{(.+)\}$", FLAG)
assert m
naked_flag = m.groups()[0].encode()
key = byte2int(np.frombuffer(os.urandom(8), dtype=np.uint8))
print("Encrypted flag:", encryp... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/Qskates/chall.py | ctfs/SEETF/2023/crypto/Qskates/chall.py | #!/usr/bin/env python3
from qiskit import QuantumCircuit, Aer
from numpy.random import randint
from Crypto.Util.number import long_to_bytes
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
import os
import hashlib
def encode_message(bits, bases):
message = []
for i in range(n):
qc = QuantumCircui... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/Dumb_Chall/main.py | ctfs/SEETF/2023/crypto/Dumb_Chall/main.py | import random
import time
from Crypto.Util.number import bytes_to_long, isPrime
from secret import FLAG
def fail():
print("You have disappointed the pigeon.")
exit(-1)
def generate_prime_number(bits: int = 128) -> int:
num = random.getrandbits(bits)
while not isPrime(num):
num += 1
retu... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/Semaphore/semaphore.py | ctfs/SEETF/2023/crypto/Semaphore/semaphore.py | import ecdsa # https://pypi.org/project/ecdsa/
import os
flag = os.environ.get('FLAG', 'SEE{not_the_real_flag}').encode()
sk = ecdsa.SigningKey.generate()
for nibble in flag.hex():
signature = sk.sign(flag + nibble.encode())
print(signature.hex())
# Code ends here. The output is printed below.
'''
04a2266484... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/BabyRC4/chall.py | ctfs/SEETF/2023/crypto/BabyRC4/chall.py | from Crypto.Cipher import ARC4
from os import urandom
key = urandom(16)
flag = b'SEE{?????????????????????????????????}'[::-1]
def enc(ptxt):
cipher = ARC4.new(key)
return cipher.encrypt(ptxt)
print(f"c0 = bytes.fromhex('{enc(flag).hex()}')")
print(f"c1 = bytes.fromhex('{enc(b'a'*36).hex()}')")
"""
c0 = byte... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/crypto/Romeo_and_Juliet/romeo_and_juliet.py | ctfs/SEETF/2023/crypto/Romeo_and_Juliet/romeo_and_juliet.py | from Crypto.Util.number import getPrime, bytes_to_long
import os
flag = os.environ.get('FLAG', 'SEE{not_the_real_flag}').encode()
class Person:
def __init__(self):
p, q = getPrime(512), getPrime(512)
self.e = 65537
self.d = pow(self.e, -1, (p-1)*(q-1))
self.n = p * q
def hear(s... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/web/file_uploader_2/init.py | ctfs/SEETF/2023/web/file_uploader_2/init.py | import sqlite3
con = sqlite3.connect("user.db", check_same_thread=False)
con.isolation_level = None
cur = con.cursor()
cur.execute("""
DROP TABLE IF EXISTS users;
""")
cur.execute("""
CREATE TABLE IF NOT EXISTS users (
dXNlcm5hbWVpbmJhc2U2NA TEXT NOT NULL PRIMARY KEY,
cGFzc3dvcmRpbmJhc2U2NA TEX... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/web/file_uploader_2/app.py | ctfs/SEETF/2023/web/file_uploader_2/app.py | from flask import Flask, render_template, render_template_string, request, redirect, url_for, session, send_from_directory
import sqlite3
import os
import uuid
import re
from waitress import serve
app = Flask(__name__)
app.secret_key = os.environ['secret_key']
app.config['TEMPLATES_AUTO_RELOAD'] = True
con = sqlite3.... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/web/file_uploader_1/app.py | ctfs/SEETF/2023/web/file_uploader_1/app.py | from flask import Flask, render_template, render_template_string, request, redirect, url_for, session, send_from_directory
import os
import uuid
import re
import sys
from waitress import serve
app = Flask(__name__)
app.secret_key = os.environ['secret_key']
UPLOAD_FOLDER = './static'
ALLOWED_EXTENSIONS = {'pdf', 'png',... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/web/Throw_your_malware_here/app.py | ctfs/SEETF/2023/web/Throw_your_malware_here/app.py | from typing import Optional
import zipfile
import random
import shutil
import string
import subprocess
from pathlib import Path
import pefile
from fastapi import FastAPI, HTTPException, UploadFile
from fastapi.responses import JSONResponse
FILE_CACHE = Path("/app/cache")
FLOSS_PATH = Path("/usr/local/bin/floss")
ap... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2023/web/PlantUML/server.py | ctfs/SEETF/2023/web/PlantUML/server.py | import requests
BASE_URL = "http://plantuml:8080/"
url = input(f"URL: {BASE_URL}")
requests.get(f"{BASE_URL}{url}")
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/pwn/wayyang/wayyang.py | ctfs/SEETF/2022/pwn/wayyang/wayyang.py | #!/usr/local/bin/python
import os
FLAG_FILE = "FLAG"
def get_input() -> int:
print(''' ,#####,
#_ _#
|a` `a|
| u | ________________________
\ = / | WAYYANG |
|\___/| ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/crypto/neutrality/neutrality.py | ctfs/SEETF/2022/crypto/neutrality/neutrality.py | from secrets import randbits
from Crypto.Util.number import bytes_to_long
# get a one-time-pad in which exactly half the bits are set
def get_xorpad(bitlength):
xorpad = randbits(bitlength)
return xorpad if bin(xorpad).count('1') == bitlength // 2 else get_xorpad(bitlength)
def leak_encrypted_flag():
from... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/crypto/probability/probability.py | ctfs/SEETF/2022/crypto/probability/probability.py | import random
def play_round():
p1 = 0
while True:
drawn = random.random()
p1 += drawn
print(f'You draw a [{drawn}]. (p1 = {p1})')
if p1 >= 1:
print('You have gone bust. Dealer wins!')
return 1
if input('Do you want to hit or stand? ').lower() in ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/crypto/dlp/params.py | ctfs/SEETF/2022/crypto/dlp/params.py | g = 2015396303001729919228156288393303410061051071865788063380037014090425897729493301829934320750474906145633828841231002303814710345847310021499418592443013756285611643590907347178916293244009158428575031862799028094052154358394991651127332451946240293096173870291124070860340181726783938312770776902984900707372260990... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/crypto/dlp/dlp.py | ctfs/SEETF/2022/crypto/dlp/dlp.py | from Crypto.Util.number import getPrime
from random import randint
from math import gcd
from functools import reduce
from hashlib import sha256
from typing import List, Tuple
def product(l: List[int]) -> int:
return reduce(lambda a, b: a*b, l)
def gen_params() -> Tuple[int, Tuple[List[int], List[int]]]:
w... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/crypto/modifiability/modifiability.py | ctfs/SEETF/2022/crypto/modifiability/modifiability.py | from Crypto.Cipher import AES
import os
key = os.urandom(16)
iv = os.urandom(16)
modes = {
'CBC': lambda:AES.new(key, AES.MODE_CBC, iv=iv),
'CFB': lambda:AES.new(key, AES.MODE_CFB, iv=iv),
'OFB': lambda:AES.new(key, AES.MODE_OFB, iv=iv),
'CTR': lambda:AES.new(key, AES.MODE_CTR, nonce=b'', initial_valu... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/crypto/rc4/rc4.py | ctfs/SEETF/2022/crypto/rc4/rc4.py | import os
def rc4(key:bytes, pt:bytes) -> bytes:
s = [*range(0x100)]
j = 0
for i in range(len(key)):
j = (j + s[i] + key[i]) & 0xff
s[i], s[j] = s[j], s[i]
i = 0
j = 0
ret = []
for c in pt:
i = (i + 1) & 0xff
j = (j + s[i]) & 0xff
s[i], s[j]... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/crypto/close_enough/encrypt.py | ctfs/SEETF/2022/crypto/close_enough/encrypt.py | from Crypto.Util.number import getPrime, bytes_to_long
from Crypto.PublicKey import RSA
from secret import flag, getNextPrime
p = getPrime(1024)
q = getNextPrime(p)
n = p * q
e = 65537
key = RSA.construct((n, e)).export_key().decode()
with open("key", "w") as f:
f.write(key)
m = bytes_to_long(flag.encode())
c =... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/crypto/lost_modulus/encrypt.py | ctfs/SEETF/2022/crypto/lost_modulus/encrypt.py | from Crypto.Util.number import getPrime, long_to_bytes, bytes_to_long
with open("flag.txt", "rb") as f:
FLAG = f.read()
n = bytes_to_long(FLAG)
#make sure i have a big modulus
while n.bit_length() < 2048:
n *= n
def encrypt(m1, m2):
e = getPrime(256)
assert m1.bit_length() >= 1600 and long_to_bytes(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/crypto/the_true_ecc/ecc.py | ctfs/SEETF/2022/crypto/the_true_ecc/ecc.py | # python ecc.py > out.py
from random import randint
from os import urandom
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
from hashlib import sha1
from typing import Tuple
class Ellipse:
"""Represents the curve x^2 + ay^2 = 1 mod p"""
def __init__(self, a: int, p: int):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/crypto/the_true_ecc/out.py | ctfs/SEETF/2022/crypto/the_true_ecc/out.py | alice_pub = (2138196312148079184382240325330500803425686967483863166176111074666553873369606997586883533252879522314508512610120185663459330505669976143538280185135503158, 1350098408534349199229781714086607605984656432458083815306756044307591092126215092360795039519565477039721903019874871683998662788499599535946383133... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/crypto/universality/univeRSAlity.py | ctfs/SEETF/2022/crypto/universality/univeRSAlity.py | import math, json
from secrets import token_urlsafe
from Crypto.Util.number import isPrime, bytes_to_long, long_to_bytes
def main():
try:
# create token
token = token_urlsafe(8)
js = json.dumps({'token': token})
# select primes
print(f'Welcome to the RSA testing ser... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/web/ssrf/app.py | ctfs/SEETF/2022/web/ssrf/app.py | from flask import Flask, request, render_template
import os
import advocate
import requests
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
url = request.form['url']
# Prevent SSRF
try:
advocate.get(url)
excep... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/web/charlottes_web/app/app.py | ctfs/SEETF/2022/web/charlottes_web/app/app.py | from flask import Flask, request
from flask_httpauth import HTTPBasicAuth
import os
app = Flask(__name__)
auth = HTTPBasicAuth()
users = {'admin': os.environ.get('SECRET')}
@auth.verify_password
def verify_password(username, password):
if username in users and password == users.get(username):
return use... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/web/the_pigeon_files/app/app.py | ctfs/SEETF/2022/web/the_pigeon_files/app/app.py | from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
if __name__ == '__main__':
app.run()
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/web/xspwn/app/app.py | ctfs/SEETF/2022/web/xspwn/app/app.py | from flask import Flask, render_template, request
import socket
import os
app = Flask(__name__)
admin_ip = socket.gethostbyname("admin")
@app.route('/')
def index():
return render_template('index.html')
@app.route('/flag')
def flag():
if request.remote_addr == admin_ip:
return os.environ["FLAG"]
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/web/username_generator/app/app.py | ctfs/SEETF/2022/web/username_generator/app/app.py | from flask import Flask, render_template, request
import socket
import os
app = Flask(__name__)
admin_ip = socket.gethostbyname("admin")
@app.route('/')
def index():
return render_template('index.html')
@app.route('/flag')
def flag():
if request.remote_addr == admin_ip:
return os.environ["FLAG"]
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SEETF/2022/web/flagportal/backend/server.py | ctfs/SEETF/2022/web/flagportal/backend/server.py | from waitress import serve
from flask import Flask, request
import os, requests
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello World!'
@app.route('/flag-count')
def flag_count():
return '2'
@app.route('/flag-plz', methods=['POST'])
def flag():
if request.headers.get('ADMIN_KEY') == os... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HackTheVote/2020/pycry/run.py | ctfs/HackTheVote/2020/pycry/run.py |
print "+===================================+"
print "+ Primality Tester Lite v0.17 +"
print "+===================================+"
print ""
def primtest():
print "What number would you like to test?"
num = raw_input()
try:
num = long(num)
except:
print "invalid number..."
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HackTheVote/2020/snap_election/server/server.py | ctfs/HackTheVote/2020/snap_election/server/server.py | #!/usr/bin/env python3
import os
import json
import tempfile
import subprocess
from flask import Flask, request, abort, jsonify, send_file
from werkzeug.utils import secure_filename
DEVNULL = open(os.devnull,'w')
app = Flask(__name__)
# Set max file size
app.config['MAX_CONTENT_LENGTH'] = 8 * 1024 * 1024
# Create... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HackTheVote/2020/fileshare/cleaner.py | ctfs/HackTheVote/2020/fileshare/cleaner.py | import os, time, shutil
def get_used_dirs():
pids = [p for p in os.listdir("/proc") if p.isnumeric()]
res = set()
for p in pids:
try:
path = os.path.realpath("/proc/%s/cwd"%p)
if path.startswith("/tmp/fileshare."):
res.add(path)
except:
pa... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Defenit/2020/input_test_driver/pow_check.py | ctfs/Defenit/2020/input_test_driver/pow_check.py | #!/usr/bin/env python3
import os
import random
import hashlib
def getRand(length=4):
table = '0123456789abcdef'
return ''.join([random.choice(table) for i in range(length)])
def getPow():
return hashlib.sha256(getRand().encode()).hexdigest()[-6:]
def checkPow(inp, out):
if hashlib.sha256(inp.encode(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CyberGrabs/2021/crypto/The_Ancient_Temple/the_ancient_temple.py | ctfs/CyberGrabs/2021/crypto/The_Ancient_Temple/the_ancient_temple.py | M, s, l, C = 7777771, [], 1337, []
n=[]
flag = "REDACTED"
k = [list(map(int, list(' '.join(bin(ord(i))[2:]).split()))) for i in flag]
def num_gen(first, last):
o = [[1]]
cnt = 1
while cnt <= last:
if cnt >= first:
yield o[-1][0] ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CyberGrabs/2021/crypto/Not_RSA/Not_RSA1.py | ctfs/CyberGrabs/2021/crypto/Not_RSA/Not_RSA1.py | from math import sqrt
import random
from Crypto.Util.number import bytes_to_long
N = 2433984714450860961589027518159810370561856716063956157321856705975948489337570445957833120668443867975490363019335530343179129689501017626817947777263721
c = 13782970089294924357624701809534162380813028197503270891836972811609385043... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CyberGrabs/2021/crypto/Old_Monks_Password/Old_Monk_pass.py | ctfs/CyberGrabs/2021/crypto/Old_Monks_Password/Old_Monk_pass.py | enc = b'\x0cYUV\x02\x13\x16\x1a\x01\x04\x05C\x00\twcx|z(((%.)=K%(>'
enc1 = b'\x0bPPS\r\x0b\x02\x0f\x12\r\x03_G\t\x08yb}v+--*+*8=W,>'
enc2 = b'\x07A[\x06\\\r\x15\t\x04\x07\x18VG]U]@\x02\x08&9&%\' 41".;'
import codecs
import random
class pass_w:
x = "hjlgyjgyj10hadanvbwdmkw00OUONBADANKHM;IMMBMZCNihaillm"
def en... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CyberGrabs/2022/crypto/asrysae/chall.py | ctfs/CyberGrabs/2022/crypto/asrysae/chall.py | from Crypto.Util.number import *
import gmpy2
from secret import flag
import binascii
p = getPrime(512)
q = getPrime(512)
e = 65537
m = bytes_to_long(flag)
ciphertext = pow(m, e, p*q)
ciphertext = long_to_bytes(ciphertext)
obj1 = open("ciphertext.txt",'w')
obj1.write(f"p={p}\n\n")
obj1.write(f"q={q}\n\n")
obj1.writ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CyberGrabs/2022/crypto/t0t13nt/source_1.py | ctfs/CyberGrabs/2022/crypto/t0t13nt/source_1.py | from sympy import totient
flag = REDACTED
def functor(n):
val = 0
for j in tqdm(range(1,n+1)):
for i in range(1,j+1):
val += j//i * totient(i)
return val
lest = []
for i in flag:
lest.append(functor(ord(i)*6969696969))
print(lest)
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CyberGrabs/2022/crypto/Unbr34k4bl3/source.py | ctfs/CyberGrabs/2022/crypto/Unbr34k4bl3/source.py | from Crypto.Util.number import *
from secret import *
assert (x>2 and x%2 == 0)
assert (isPrime(e1) and isPrime(e2))
def functor():
val1 , val2 = 0,0
for i in range(x+1):
val1 += pow(e1,i)
for j in range(3):
val2 += pow(e2,j)
assert (val1 == val2)
def keygen():
while True:
p,q = [getStrongPrime(1024) for... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WannaGameChampionship/2023/crypto/Among_SUS/utils.py | ctfs/WannaGameChampionship/2023/crypto/Among_SUS/utils.py | from Crypto.Cipher import AES
import struct
import math
class InvalidTagError(Exception):
def __init__(self, message="Invalid Authentication Tag"):
self.message = message
super().__init__(self.message)
class MAC:
MASK_R = 0x1337fffc0ffffffc0ffffffc0fff1337
MASK_S = 0xffffffffffffffffffffff... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WannaGameChampionship/2023/crypto/Among_SUS/server.py | ctfs/WannaGameChampionship/2023/crypto/Among_SUS/server.py | from cryptography.hazmat.primitives.kdf.hkdf import HKDF
from cryptography.hazmat.primitives import hashes
from utils import AEMC, InvalidTagError
import binascii
import secrets
import base64
import random
import signal
import json
TIMEOUT = 720
FLAG = open("/flag", "r").read()
INFO = b"W3llc0m3 t0 W4nn... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WannaGameChampionship/2023/crypto/ezCurve/chall.py | ctfs/WannaGameChampionship/2023/crypto/ezCurve/chall.py | from sage.all import *
from Crypto.Util.number import bytes_to_long
from secrets import SystemRandom
from secret import flag
class Point:
def __init__(self, x, y) -> None:
self.x = int(x)
self.y = int(y)
def __str__(self) -> str:
return f"({self.x},{self.y})"
class Curve:
def __ini... | 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.