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/RaRCTF/2021/web/MAAS/app/app.py | ctfs/RaRCTF/2021/web/MAAS/app/app.py | from flask import Flask, render_template, request, session, redirect, jsonify
import requests
import jsonschema
import os
import json
import sys
app = Flask(__name__)
ERR_MISSING = "Missing required parameters"
@app.route('/')
def index():
html = """<html><head><title>MAAS</title></head>
<body><a href=/calcula... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/MAAS/manager/app.py | ctfs/RaRCTF/2021/web/MAAS/manager/app.py | from flask import Flask, request, jsonify
import requests
import redis
import os
from binascii import hexlify
app = Flask(__name__)
@app.before_first_request
def setup():
red = redis.Redis(host="manager_users")
red.set("current", 0)
add_user("admin", hexlify(os.urandom(16)).decode())
def get_user(name... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/MAAS/calculator/app.py | ctfs/RaRCTF/2021/web/MAAS/calculator/app.py | from flask import Flask, request
import requests
app = Flask(__name__)
@app.route('/checkers', methods=["POST"])
def checkers():
if request.form.get('even'):
r = requests.get(f'http://checkers:3000/is_even?n={request.form.get("value")}')
elif request.form.get('odd'):
r = requests.get(f'http://... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/MAAS/notes/app.py | ctfs/RaRCTF/2021/web/MAAS/notes/app.py | from flask import Flask, request, jsonify, render_template_string
import redis
import requests
import re
import json
import sys
app = Flask(__name__)
@app.route('/getid/<username>')
def getid(username):
red = redis.Redis(host="redis_users")
return red.get(username).decode()
@app.route('/useraction', methods... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/MAAS/notes/redis_userdata/app.py | ctfs/RaRCTF/2021/web/MAAS/notes/redis_userdata/app.py | from flask import Flask, request, jsonify
import redis
import random
import os
import os
app = Flask(__name__)
@app.route('/adduser')
def adduser():
port = random.randint(50000, 60000)
if os.system(f"redis-server --port {port} --daemonize yes --protected-mode no") == 0:
return str(port), 200
else... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/maas2/app/app.py | ctfs/RaRCTF/2021/web/maas2/app/app.py | from flask import Flask, render_template, request, session, redirect, jsonify
import requests
import jsonschema
import os
import json
import sys
app = Flask(__name__)
ERR_MISSING = "Missing required parameters"
@app.route('/')
def index():
html = """<html><head><title>MAAS</title></head>
<body><a href=/calcula... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/maas2/manager/app.py | ctfs/RaRCTF/2021/web/maas2/manager/app.py | from flask import Flask, request, jsonify
import requests
import redis
import jsonschema
import json
import os
from binascii import hexlify
app = Flask(__name__)
@app.before_first_request
def setup():
red = redis.Redis(host="manager_users")
red.set("current", 0)
add_user("admin", hexlify(os.urandom(16))... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/maas2/calculator/app.py | ctfs/RaRCTF/2021/web/maas2/calculator/app.py | from flask import Flask, request
import requests
app = Flask(__name__)
import builtins
@app.route('/checkers', methods=["POST"])
def checkers():
if request.form.get('even'):
r = requests.get(f'http://checkers:3000/is_even?n={request.form.get("value")}')
elif request.form.get('odd'):
r = request... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/maas2/notes/app.py | ctfs/RaRCTF/2021/web/maas2/notes/app.py | from flask import Flask, request, jsonify, render_template_string
import redis
import requests
import re
import json
import sys
app = Flask(__name__)
@app.route('/getid/<username>')
def getid(username):
red = redis.Redis(host="redis_users")
return red.get(username).decode()
@app.route('/useraction', methods... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/maas2/notes/redis_userdata/app.py | ctfs/RaRCTF/2021/web/maas2/notes/redis_userdata/app.py | from flask import Flask, request, jsonify
import redis
import random
import os
import os
app = Flask(__name__)
@app.route('/adduser')
def adduser():
port = random.randint(50000, 60000)
if os.system(f"redis-server --port {port} --daemonize yes --protected-mode no") == 0:
return str(port), 200
else... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/lemonthinker/app/generate.py | ctfs/RaRCTF/2021/web/lemonthinker/app/generate.py | import os
from PIL import Image, ImageDraw, ImageFont
import sys
font = ImageFont.truetype('static/generator/comic-sans.ttf', size=48)
outfile = sys.argv[1]
text = sys.argv[2]
if len(text) > 1000: # Too much text :lemonthink:
text = "Too long!"
width, height = 512, 562
img = Image.new('RGB', (width, height), colo... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RaRCTF/2021/web/lemonthinker/app/app.py | ctfs/RaRCTF/2021/web/lemonthinker/app/app.py | from flask import Flask, request, redirect, url_for
import os
import random
import string
import time # lemonthink
clean = time.time()
app = Flask(__name__)
chars = list(string.ascii_letters + string.digits)
@app.route('/')
def main():
return open("index.html").read()
@app.route('/generate', methods=['POST'])
de... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTFZone/2018/Quals/SignatureServer/server.py | ctfs/CTFZone/2018/Quals/SignatureServer/server.py | #!/usr/bin/python
import sys
import hashlib
import logging
import SocketServer
import base64
from flag import secret
from checksum_gen import WinternizChecksum
logger = logging.getLogger()
logger.setLevel(logging.INFO)
ch = logging.StreamHandler(sys.stdout)
ch.setFormatter(logging.Formatter("%(asctime)s - %(levelname... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTFZone/2018/Quals/FederationWorkflowSystem/client.py | ctfs/CTFZone/2018/Quals/FederationWorkflowSystem/client.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import socket
from time import sleep
from Crypto.Cipher import AES
from base64 import standard_b64decode
class SecureClient:
def __init__(self):
self.msg_end = '</msg>'
self.msg_wrong_pin = 'BAD_PIN'
self.aes_key = 'aes.key'
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTFZone/2018/Quals/FederationWorkflowSystem/server.py | ctfs/CTFZone/2018/Quals/FederationWorkflowSystem/server.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import hmac
import socket
from hashlib import sha1
from Crypto.Cipher import AES
from struct import pack, unpack
from threading import Thread, Lock
from base64 import standard_b64encode
from time import time, sleep, strftime
class SecureServer:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTFZone/2018/Quals/BuggyPWN/buggy_pwn.py | ctfs/CTFZone/2018/Quals/BuggyPWN/buggy_pwn.py | #!/usr/bin/python
from ctypes import c_byte,c_ubyte,c_short,c_ushort,c_int,c_uint,c_long,c_ulong
from array import array
from time import sleep
from random import randrange
import SocketServer
from flag import secret
from curses.ascii import isprint
PORT = 1337
def delete_not_printable(s):
return ''.join([x if isp... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTFZone/2023/Quals/crypto/Wise_sage/server.py | ctfs/CTFZone/2023/Quals/crypto/Wise_sage/server.py | import random as rnd
import logging
import re
import socketserver
from hashlib import blake2b
from Crypto.Cipher import AES
from gmpy2 import isqrt
from py_ecc.fields import optimized_bn128_FQ
from py_ecc.optimized_bn128.optimized_curve import (
Optimized_Point3D,
normalize,
G1,
multiply,
curve_orde... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTFZone/2023/Quals/crypto/Wise_sage/flag.py | ctfs/CTFZone/2023/Quals/crypto/Wise_sage/flag.py | flag = "ctfzone{XXXXXXXXXXXXXXXXXXXXX}"
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTFZone/2023/Quals/crypto/Right_Decision/src/main.py | ctfs/CTFZone/2023/Quals/crypto/Right_Decision/src/main.py | import random
import string
import Crypto.Util.number as number
import numpy as np
import json
import socketserver
import galois
from hashlib import md5
PORT = 31339
with open('params.txt') as f:
params = json.load(f)
p = params['galois_p']
k = params['k']
n = params['RSA_n']
gf = galois.GF(p,verify=False,primit... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTFZone/2023/Quals/crypto/Right_Decision/src/generate_secrets.py | ctfs/CTFZone/2023/Quals/crypto/Right_Decision/src/generate_secrets.py | import random
import Crypto.Util.number as number
import numpy as np
import json
import sys
import galois
p = number.getPrime(2050)
f = galois.GF(p,verify=False,primitive_element=2)
k=8
num = 12
secret = sys.argv[1]
a = [random.randint(0,f.order) for _ in range(k-1)]
a.append(secret)
a = f(a)
def poly(a,x):
r... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTFZone/2023/Quals/crypto/Messenger_zone/server/handler.py | ctfs/CTFZone/2023/Quals/crypto/Messenger_zone/server/handler.py | import tornado
from models import RegistrationHandler, SendMessageHandler, GetMessageHandler, KeyExchangeHandler, GetPublicValuesHandler, GeKeysHandler
def make_app():
return tornado.web.Application([
(r"/register", RegistrationHandler),
(r"/send", SendMessageHandler),
(r"/get", GetMessage... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTFZone/2023/Quals/crypto/Messenger_zone/server/db.py | ctfs/CTFZone/2023/Quals/crypto/Messenger_zone/server/db.py | from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy_utils import database_exists, create_database
import os
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
Base = declarative_base()
engine = create_engine("sqlit... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTFZone/2023/Quals/crypto/Messenger_zone/server/models.py | ctfs/CTFZone/2023/Quals/crypto/Messenger_zone/server/models.py | import tornado.escape
import tornado.ioloop
import tornado.web
from sqlalchemy import Column, String, Integer
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy_utils import database_exists, create_database
from db import ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CTFZone/2023/Quals/crypto/Messenger_zone/client/client.py | ctfs/CTFZone/2023/Quals/crypto/Messenger_zone/client/client.py | import hmac
from pygost import gost34112012512
from pygost.gost3410 import sign, verify
from pygost.gost34112012 import GOST34112012
from pygost.gost3412 import GOST3412Kuznechik
from pygost.mgm import MGM
from pygost.mgm import nonce_prepare
from pygost import gost3410
from pygost.gost3413 import unpad2, pad2
from cry... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/darkCON/2021/crypto/Rookie_Choice_4_you/chall.py | ctfs/darkCON/2021/crypto/Rookie_Choice_4_you/chall.py | #!/usr/bin/env python3
from Crypto.Cipher import ARC4 # pip3 install pycryptodome
import os
KEY = os.urandom(16)
FLAG = "******************* REDUCTED *******************"
menu = """
+--------- MENU ---------+
| |
| [1] Show FLAG |
| [2] Encrypt Something |
| [3] Exit |
|... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/darkCON/2021/crypto/TonyAndJames/src.py | ctfs/darkCON/2021/crypto/TonyAndJames/src.py | #!/usr/bin/env python3
import random
def get_seed(l):
seed = 0
rand = random.getrandbits(l)
raw = list()
while rand > 0:
rand = rand >> 1
seed += rand
raw.append(rand)
if len(raw) == l:
return raw, seed
else:
return get_seed(l)
def encrypt(m):
l = len(m)
raw, seed = get_seed(l)
random.seed(see... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/darkCON/2021/crypto/DisguisedWordlets/func_.py | ctfs/darkCON/2021/crypto/DisguisedWordlets/func_.py | def encrypt(text, key):
return ''.join([ chr((( key[0]*(ord(t) - ord('A')) + key[1] ) % 26) + ord('A')) for t in text.upper().replace(' ', '') ])
def compress(uncompressed):
_size = 256
dictionary = dict((chr(i), chr(i)) for i in range(_size))
w = ""
result = []
for c in uncompressed:... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DeadSec/2023/crypto/LCG/chall.py | ctfs/DeadSec/2023/crypto/LCG/chall.py | import random
from Crypto.Util.number import *
import gmpy2
class LCG:
def __init__(self, a, c, m, seed):
self.seed = seed
self.multiplier = a
self.increment = c
self.modulus = m
def next(self):
self.seed = (self.multiplier*self.seed + self.increment) % self.modulus... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DeadSec/2025/crypto/imrul_kAES/server.py | ctfs/DeadSec/2025/crypto/imrul_kAES/server.py | #!/usr/local/bin/python
from Crypto.Util.number import bytes_to_long, long_to_bytes, getPrime
from Crypto.Util.Padding import pad
from Crypto.Random import get_random_bytes
from Crypto.Cipher import AES
print('Yo welcome to my sign as a service...')
p, q = getPrime(512), getPrime(512)
e = 1238923164198387700974184171... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DeadSec/2025/crypto/infant_RSA/infant_rsa.py | ctfs/DeadSec/2025/crypto/infant_RSA/infant_rsa.py | #!/usr/bin/env python3
from Crypto.Util.number import getPrime, bytes_to_long
from secret import flag
p, q = getPrime(512), getPrime(512)
n = p * q
e = 65537
phi = (p-1) * (q-1)
hint = phi & ((1 << 500)-1)
m = bytes_to_long(flag)
c = pow(m, e, n)
print(f'{n=}')
print(f'{c=}')
print(f'{hint=}')
#n=144984891276196734... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DeadSec/2025/crypto/bullmad/bullmad.py | ctfs/DeadSec/2025/crypto/bullmad/bullmad.py | import os, time, signal
from hashlib import sha256
from ecdsa import SigningKey, SECP256k1
from ecdsa.util import sigencode_string
from random import SystemRandom
G = SECP256k1.generator
n = SECP256k1.order
BITS = 64
def sign_with_nonce(sk, message, nonce):
e = int.from_bytes(sha256(message).digest(), 'big')
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/OverTheWireAdventBonanza/2021/crypto/Santas_Secrets/server.py | ctfs/OverTheWireAdventBonanza/2021/crypto/Santas_Secrets/server.py | #!/usr/bin/env python3
import asyncio
from Cryptodome.Cipher import AES # pip3 install pycryptodomex
import os
from REDACTED import FLAG
assert(type(FLAG) is str)
assert(len(FLAG) == 32)
HOST = "0.0.0.0"
PORT = 1209
NUM_SLOTS = 8
SLOT_SIZE = 16
MAX_CMDS = 1000
TIMEOUT = 60
HELPMSG = f"""
Welcome to Santa's Super-... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2021/pwn/CBC-Jail/jail.py | ctfs/niteCTF/2021/pwn/CBC-Jail/jail.py | #!/usr/bin/python3 -u
import os, base64, sys
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
KEY=os.urandom(16)
IV=os.urandom(16)
def encrypt(msg):
msg = pad(msg,16)
cipher = AES.new(KEY,AES.MODE_CBC,IV)
encrypted = cipher.encrypt(msg)
encrypted = encrypted.hex()
msg = IV... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2021/pwn/Auto-Pwn/auto-pwn.py | ctfs/niteCTF/2021/pwn/Auto-Pwn/auto-pwn.py | #!/usr/bin/python3 -u
import os
import sys
import subprocess
import uuid
import random
def main():
number = random.randint(10,100)
dir = '/tmp/' + str(uuid.uuid4())
os.mkdir(dir)
with open('./auto-pwn.c', 'r') as auto_pwn_tmpl_file:
auto_pwn_c_code = auto_pwn_tmpl_file.read()
auto_pwn_c_code = auto_pw... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2021/crypto/NJWT/NJWT.py | ctfs/niteCTF/2021/crypto/NJWT/NJWT.py | import base64
from Crypto.Util.number import *
import sys
import random
import os
import sympy
class NJWT:
n = 1
e = 1
d = 1
def __init__(self):
self.genkey()
return
def genkey(self):
p = getStrongPrime(1024)
q = p
k = random.randint(0,100)
for _ in... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2021/crypto/NJWT/app.py | ctfs/niteCTF/2021/crypto/NJWT/app.py | from flask import Flask, render_template, request, make_response
import NJWT
import os, base64
from dotenv import load_dotenv
app = Flask(__name__)
load_dotenv()
FLAG = os.environ.get('FLAG')
Obj = NJWT.NJWT()
@app.route('/')
def index():
cookie = "None"
resp = make_response(render_template("index.html", di... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2021/crypto/CPA/enc.py | ctfs/niteCTF/2021/crypto/CPA/enc.py | from sage.all import *
from Crypto.Util.number import bytes_to_long
from FLAG import flag
f = flag
def make_matrix(n):
zn = IntegerModRing(n)
mat_list = [randint(0, n-1) for i in range(4)]
mat = [[mat_list[0], mat_list[1]], [mat_list[2], mat_list[3]]]
mat = Matrix(zn, mat)
return mat
def enc(pt,n... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2021/crypto/Variablezz/enc.py | ctfs/niteCTF/2021/crypto/Variablezz/enc.py | import random
flag = 'nite{XXXXXXXXXXXXXXXXXXXXXXXX}'
a = random.randint(1,9999999999)
b = random.randint(1,9999999999)
c = random.randint(1,9999999999)
d = random.randint(1,9999999999)
enc = []
for x in flag:
res = (a*pow(ord(x),3)+b*pow(ord(x),2)+c*ord(x)+d)
enc.append(res)
print(enc) | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2021/crypto/Rabin_To_The_Rescue/rabin_to_the_rescue.py | ctfs/niteCTF/2021/crypto/Rabin_To_The_Rescue/rabin_to_the_rescue.py | from Crypto.Util.number import *
from sympy import *
import random
def mixer(num):
while(num>1):
if(int(num) & 1):
num=3*num+1
else:
num=num/2
return num
def gen_sexy_primes():
p=getPrime(256)
q=p+6
while((p%4!=3)or(q%4!=3)):
p=getPrime(256)
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2021/crypto/Flip_Me_Over/flipmeover.py | ctfs/niteCTF/2021/crypto/Flip_Me_Over/flipmeover.py | from Crypto.Cipher import AES
from Crypto.Util.number import *
import os
from Crypto.Util.Padding import pad,unpad
from Crypto.Util.strxor import strxor
import random
import hashlib
from secrets import FLAG
KEY = os.urandom(16)
entropy = hashlib.md5(os.urandom(128)).digest()
def generate_token(username):
iv = os.... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2024/ai/Mumbo_Dumbo/pow.py | ctfs/niteCTF/2024/ai/Mumbo_Dumbo/pow.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2024/crypto/R_Stands_Alone/chal.py | ctfs/niteCTF/2024/crypto/R_Stands_Alone/chal.py | from Crypto.Util.number import *
def gen_keys():
while True:
a = getPrime(128)
b = getPrime(128)
A = a+b
B = a-b
p = ((17*A*A*A) - (15*B*B*B) - (45*A*A*B) + (51*A*B*B)) // 8
if isPrime(p) :
return a, b, p
p, q, r = gen_keys()
e = 65537
n =... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2023/misc/least_ELOistic_fish/main.py | ctfs/niteCTF/2023/misc/least_ELOistic_fish/main.py | from stockfish import Stockfish
stockfish = Stockfish(path='/usr/bin/stockfish/stockfish-ubuntu-x86-64-avx2')
{
"Debug Log File": "",
"Contempt": 0,
"Min Split Depth": 0,
"Threads": 4,
"Ponder": "false",
"Hash": 2048,
"MultiPV": 1,
"Skill Level": 69,
"Move Overhead": 10,
"Minimu... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2023/crypto/cha_cha_cha/server.py | ctfs/niteCTF/2023/crypto/cha_cha_cha/server.py | #!/usr/bin/python3 -u
import os
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from secret import FLAG
TOKEN = ''.join(['... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2023/crypto/double_whammy/server.py | ctfs/niteCTF/2023/crypto/double_whammy/server.py | #!/usr/bin/python3 -u
import json
import hashlib
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
from ecdsa import VerifyingKey
from ecdsa.util import sigdecode_der
from random import getrandbits
from secret import FLAG
with open("public.pem") as f:
public_key = VerifyingKey.from_pem(f.re... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2023/crypto/babyRSA/encrypt.py | ctfs/niteCTF/2023/crypto/babyRSA/encrypt.py | from Crypto.Util.number import getPrime, bytes_to_long
from secret import FLAG
m = bytes_to_long(FLAG)
f = open ('output.txt', 'w')
e = 37
n = [getPrime(1024)*getPrime(1024) for i in range(e)]
c = [pow(m, e, n[i]) for i in range(e)]
with open ('output.py', 'w'):
f.write(f"e = {e}\n")
f.write(f"c = {c}\n")
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2023/crypto/Unraveling_the_Patterns/challenge.py | ctfs/niteCTF/2023/crypto/Unraveling_the_Patterns/challenge.py | import os
import random
from Crypto.PublicKey import RSA
from Crypto.Util.number import bytes_to_long
def get_seed(size):
return int(os.urandom(size).hex(), 16)
input_data = None
output_data = ""
seed = get_seed(4)
random.seed(seed)
old = "0123456789abcdef"
new = list(old)
random.shuffle(new)
new = ''.join(new)... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2023/crypto/Quantum_Quandary/LWE.py | ctfs/niteCTF/2023/crypto/Quantum_Quandary/LWE.py | from secret_value import message
import numpy as np
import json
from pathlib import Path
flag = "nite{xxxxxxxxxxxxxx}"
l = len(message)
def message_to_vector(message):
vector = [ord(char) for char in message]
return vector
m = message_to_vector(message)
def randomized_matrix(lower_bound, upper_bound, row, col... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2023/web/Image_Gallery/main.py | ctfs/niteCTF/2023/web/Image_Gallery/main.py | from flask import Flask, render_template, request, redirect, url_for, session
import sqlite3
import uuid
app = Flask(__name__)
app.secret_key = str(uuid.uuid4())
@app.route("/login", methods=["POST", "GET"])
def login():
if "logged_in" in session and session["logged_in"]:
session.pop("logged_in", None)
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2025/crypto/smol_fan/server.py | ctfs/niteCTF/2025/crypto/smol_fan/server.py | from hashlib import sha256
from ecdsa import VerifyingKey, SECP256k1
from gmpy2 import is_prime
import os
import sympy
import secrets
FLAG_MESSAGE = b"gimme_flag"
FLAG = os.getenv("flag","nite{fake_flag}")
curve = SECP256k1
G = curve.generator
n = curve.order
d = secrets.randbelow(n)
Q = d * G
vk = VerifyingKey.f... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2022/crypto/Shoo-in/primes.py | ctfs/niteCTF/2022/crypto/Shoo-in/primes.py | 8342828072912665446640812496657974616895237729734331520447110635700611195720588924201965069564261323380181467910921708206195375403970552688043142521352679
11261182920255484587328622670740312344434746846806430954734873940195850016351945896817555661909277786253900984842735860881865717569965731032925702398871639
131882044... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | true |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2022/crypto/Shoo-in/chal.py | ctfs/niteCTF/2022/crypto/Shoo-in/chal.py | import gmpy2
import secrets as s
from flag import flag
fn = open(r"firstnames.py", 'r')
ln = open(r"lastnames.py", 'r')
fp = open (r"primes.py", 'r')
fn_content = fn.readlines()
ln_content = ln.readlines()
prime_arr = fp.readlines()
class RNG:
def __init__ (self, seed, a, b, p):
self.seed = seed
s... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2022/crypto/Shoo-in/firstnames.py | ctfs/niteCTF/2022/crypto/Shoo-in/firstnames.py | Tyrone
Zain
Gerald
Seamus
Matteo
Erick
Devin
Lucian
Vincent
Nikhil
Damion
Beckham
Emmanuel
Jesse
Bryant
Remington
Lorenzo
Benjamin
Gary
Elisha
Tomas
Rayan
Felipe
Marcos
Cesar
Xzavier
Darryl
Gianni
Jonas
Adan
Teagan
Owen
Jose
Ean
Kael
Ramon
Landon
Jaydin
Andres
Dustin
Brayden
Carlo
Tripp
Nathaniel
Jeremiah
Brett
Kyle
Pr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2022/crypto/Shoo-in/lastnames.py | ctfs/niteCTF/2022/crypto/Shoo-in/lastnames.py | Foley
Simmons
Frazier
Beard
Guerrero
Mooney
Hoover
Rojas
Ritter
Stevens
Mercado
Mccall
Austin
Raymond
Wyatt
Wilcox
Barr
Wood
Buckley
Santiago
Greer
Fleming
Richardson
Craig
Kaufman
Cherry
Solomon
Hampton
Cobb
Blair
Campbell
Hebert
Hanson
Wolf
Mckenzie
Frank
Leach
Schmidt
Madden
Robles
Valentine
Keith
Costa
Bryan
Morgan... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2022/crypto/Basically_I_locked_up/new_encryption.py | ctfs/niteCTF/2022/crypto/Basically_I_locked_up/new_encryption.py |
def new_encryption(file_name, password):
with open(file_name, "rb") as f:
plaintext = f.read()
assert(len(password) == 8)
assert(b"HiDeteXT" in plaintext)
add_spice = lambda b: 0xff & ((b << 1) | (b >> 7))
ciphertext = bytearray(add_spice(c) ^ ord(password[i % len(password)]) for i, c in enumerate(plaint... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/niteCTF/2022/crypto/curvAES/Encryption.py | ctfs/niteCTF/2022/crypto/curvAES/Encryption.py | from tinyec import registry
from Crypto.Cipher import AES
import hashlib, secrets, binascii
curve = registry.get_curve('0x630x750x720x760x650x200x690x730x200x620x720x610x690x6e0x700x6f0x6f0x6c0x500x320x350x360x720x31')
def To256bit(point):
algo = hashlib.sha256(int.to_bytes(point.x,32,'big'))
algo.update(int.... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TheOdyssey/2023/crypto/Anarkhia/enc.py | ctfs/TheOdyssey/2023/crypto/Anarkhia/enc.py | #!/usr/bin/python3
import random
from secret import flag
random.seed(''.join([str(random.randint(0x0, 0x9)) for i in range(random.randint(3, 6))]));theKey = [random.randint(0, 255) for i in range(len(flag))];theEnc = "".join([hex(((random.choice(theKey)) ^ ord(flag[i]))<<1) for i in range(len(flag))]);open('out.txt',... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TheOdyssey/2023/crypto/Astynomoi/chall.py | ctfs/TheOdyssey/2023/crypto/Astynomoi/chall.py | #!/usr/bin/env python3
from Crypto.Cipher import ARC4
import os
import gzip
import hashlib
SECRET = b"flag{REDACTED}"
assert len(SECRET) == 64
def compress(m):
return gzip.compress(m)
def package(plaintext):
KEY = os.urandom(32)
plaintext = bytes.fromhex(plaintext)
cipher = ARC4.new(KEY)
enc = ci... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TheOdyssey/2023/crypto/Thermopolium/chall.py | ctfs/TheOdyssey/2023/crypto/Thermopolium/chall.py | from random import getrandbits as grb
from Crypto.Util.number import getPrime as gp, isPrime as ip
FLAG = b"flag{REDACTED}"
class flavor:
def __init__(self, state, mod):
self.state = state
self.mod = mod
self.mult = grb(32)
self.inc = grb(32)
def gen(self):
self.state = ((self.state * self.mult + self.in... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2024/rev/Emojis/emoji.py | ctfs/SanDiego/2024/rev/Emojis/emoji.py | def main():
print("what do you think the key is?")
encrypted = '🙚🙒🙌🙭😌🙧🙬🙻🙠🙓😣🙯🙖🙺🙠🙖😡🙃🙭🙿🙩🙟😯🙮🙬🙸🙻🙦😨🙩🙽🙉🙻🙑😯🙥🙻🙳🙐🙓😿🙯🙽🙉🙣🙐😡🙹🙖🙤🙪🙞😿🙰🙨🙤🙐🙕😯🙨🙽🙳🙽🙊😷'
key = input()
plaintext = ''.join([chr(ord(c) ^ ord(key[i % len(key)])) for i, c in enumerate(encrypted)])
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2024/crypto/Raccoon_Run/server.py | ctfs/SanDiego/2024/crypto/Raccoon_Run/server.py | import json
from time import time
import tornado
import tornado.websocket
import tornado.ioloop
import random
import asyncio
import os
from datetime import timedelta
import tornado.web
import tornado.gen
PORT = 8000
NUM_RACCOONS = 8
FINISH_LINE = 1000
TARGET_BET = 1000
STEP_TIME = 0.25 # in seconds
BETTING_TIME = 15... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/Rock_paper_scissors/client.py | ctfs/SanDiego/2023/crypto/Rock_paper_scissors/client.py | import hashlib, secrets, base64, sys
from pwnlib.tubes import remote
HOST = 'rps.sdc.tf'
PORT = 1337
def hash(m: bytes):
return hashlib.md5(m).digest()
r = remote.remote(HOST, PORT)
def send(msg: str) -> None:
r.sendline(msg.encode())
def send_data(msg: bytes) -> None:
r.sendline(base64.b64encode(msg)... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/Rock_paper_scissors/server.py | ctfs/SanDiego/2023/crypto/Rock_paper_scissors/server.py | import base64
import hashlib
import secrets
import sys
import traceback
flag = open('flag.txt').read()
N_ATTEMPTS = 100
def hash(m: bytes):
return hashlib.md5(m).digest()
def command(cmd: str, arg: str):
print(cmd, arg)
def error(msg: str):
command('ERROR', msg)
sys.exit(1)
num = {'R': 0, 'P': 1, ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/100-security-questions/questions.py | ctfs/SanDiego/2023/crypto/100-security-questions/questions.py | # questions taken from the IPIP personality test, which is in the public domain
questions = [
'I am afraid of many things.',
'I feel comfortable around people.',
'I love to daydream.',
'I trust what people say.',
'I handle tasks smoothly.',
'I get upset easily.',
'I enjoy being part of a gro... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/100-security-questions/client_lock.py | ctfs/SanDiego/2023/crypto/100-security-questions/client_lock.py | from KeyRecoveryScheme import KeyRecoveryScheme
from questions import questions
from Crypto.Util.Padding import pad
from Crypto.Cipher import AES
from Crypto.Protocol.KDF import bcrypt
import json
import base64
from os import path
from sys import exit
from client_unlock import get_db_entry
def main():
print("Welco... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/100-security-questions/KeyRecoveryScheme.py | ctfs/SanDiego/2023/crypto/100-security-questions/KeyRecoveryScheme.py | import hashlib
from fractions import Fraction
from Crypto.Random.random import randrange
from Crypto.Protocol.KDF import scrypt
from math import gcd
# this scheme is taken from a paper by Ellison, Hall, Milbert and Schneier
# titled "Protecting secret keys with personal entropy"
KEY_LENGTH = 16
p = 258641170704651026... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/100-security-questions/client_unlock.py | ctfs/SanDiego/2023/crypto/100-security-questions/client_unlock.py | from KeyRecoveryScheme import KeyRecoveryScheme
from questions import questions
from Crypto.Util.Padding import unpad
from Crypto.Protocol.KDF import bcrypt_check
from Crypto.Cipher import AES
import json
from sys import exit
import base64
def get_db_entry(username):
try:
with open("data.json") as json_fil... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/12-security-questions/questions.py | ctfs/SanDiego/2023/crypto/12-security-questions/questions.py | questions = [
"What is your mother's maiden name?",
"What was the name of your first pet?",
"In which city were you born?",
"What's your favorite movie?",
"What's your second favorite movie?",
"What's your favorite song?",
"What's your second favorite song?",
"What was the first song you... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/12-security-questions/leak.py | ctfs/SanDiego/2023/crypto/12-security-questions/leak.py | # Psst!!!
# Using some of my 31337 OSINT 5ki11z I have been able to narrow down the answer to each question to 10 choices each.
# For each question, I have put down 10 of the possible answers, in a list.
leak = [
["thomas", "miku", "harris", "baltimore", "hipple", "ayer", "ashe", "arming", "acre", "beckinham"], # W... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/12-security-questions/client_lock.py | ctfs/SanDiego/2023/crypto/12-security-questions/client_lock.py | from KeyRecoveryScheme import KeyRecoveryScheme
from questions import questions
from Crypto.Util.Padding import pad
from Crypto.Cipher import AES
from Crypto.Protocol.KDF import bcrypt
import json
import base64
from os import path
from sys import exit
from client_unlock import get_db_entry
def main():
print("Welco... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/12-security-questions/KeyRecoveryScheme.py | ctfs/SanDiego/2023/crypto/12-security-questions/KeyRecoveryScheme.py | import hashlib
from fractions import Fraction
from Crypto.Random.random import randrange
from Crypto.Protocol.KDF import scrypt
from math import gcd
# this scheme is taken from a paper by Ellison, Hall, Milbert and Schneier
# titled "Protecting secret keys with personal entropy"
KEY_LENGTH = 16
p = 258641170704651026... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/12-security-questions/client_unlock.py | ctfs/SanDiego/2023/crypto/12-security-questions/client_unlock.py | from KeyRecoveryScheme import KeyRecoveryScheme
from questions import questions
from Crypto.Util.Padding import unpad
from Crypto.Protocol.KDF import bcrypt_check
from Crypto.Cipher import AES
import json
from sys import exit
import base64
def get_db_entry(username):
with open("data.json") as json_file:
pa... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/Jumbled_snake/jumble.py | ctfs/SanDiego/2023/crypto/Jumbled_snake/jumble.py | #! /usr/bin/env python3
# Need print_flag.py (secret) in the same directory as this file
import print_flag
import os
import secrets
import string
def get_rand_key(charset: str = string.printable):
chars_left = list(charset)
key = {}
for char in charset:
val = secrets.choice(chars_left)
char... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/Lake_of_Pseudo_Random_Fire/game.py | ctfs/SanDiego/2023/crypto/Lake_of_Pseudo_Random_Fire/game.py | #!/bin/python3
from Crypto.Cipher import AES
from os import urandom
import random
import binascii
flag = open("flag.txt", "rb").read()
class PRFGame:
def __init__(self, mode):
self.plaintext_ciphertext = {}
self.key = urandom(16)
# mode = 1 is pseudorandom, move = 0 is random
# on... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SanDiego/2023/crypto/SHA256-CTR/sha256ctr.py | ctfs/SanDiego/2023/crypto/SHA256-CTR/sha256ctr.py | import hashlib
from random import SystemRandom
import secrets
from time import sleep
FLAG = open('flag.txt', 'rb').read()
# In bits
INITIAL_CTR_SIZE = 256
SHA256_SIZE = 32
counter = secrets.randbelow(2 ** INITIAL_CTR_SIZE)
# print(hex(counter)) # DEBUG
print('Welcome to the demo playground for my unbreakable SHA25... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Cryptoverse/2023/crypto/PicoChip_1/picochip.py | ctfs/Cryptoverse/2023/crypto/PicoChip_1/picochip.py | from itertools import groupby
from Crypto.Util.number import *
from enum import Enum
from base64 import b64encode
from secret import flag
import plotly.express as px
import random
class State(Enum):
# PicoChip power states for hardware simulation.
FALLBACK = 0x0
SUCCESS = 0x1
ERROR = 0x2
class Pico... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Cryptoverse/2023/crypto/Fractional_Flag/fractional_flag.py | ctfs/Cryptoverse/2023/crypto/Fractional_Flag/fractional_flag.py | from Crypto.Util.number import getPrime, inverse, bytes_to_long
from secret import flag
assert len(flag) == 99
assert flag.startswith(b"cvctf{") and flag.endswith(b"}")
class MyRSA:
def __init__(self, n = 2, nbits = 512):
self.p = getPrime(nbits)
self.q = getPrime(nbits)
self.N = self.p * ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Cryptoverse/2023/crypto/Baby_AES/challenge.py | ctfs/Cryptoverse/2023/crypto/Baby_AES/challenge.py | from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
from secret import flag
KEY_LEN = 2
BS = 16
key = pad(open("/dev/urandom","rb").read(KEY_LEN), BS)
iv = open("/dev/urandom","rb").read(BS)
cipher = AES.new(key, AES.MODE_CBC, iv)
ct = cipher.encrypt(pad(flag, 16))
print(f"iv = {iv.hex()}")
print(f"ct... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Cryptoverse/2023/crypto/LFSR_Explorer/lfsr.py | ctfs/Cryptoverse/2023/crypto/LFSR_Explorer/lfsr.py | from Crypto.Util.number import *
from secret import flag
assert flag.startswith("cvctf{")
assert flag.endswith("}")
flag = flag[6:-1].encode()
assert len(flag) == 8
def explore(state, mask):
curr = (state << 1) & 0xffffffff
i = state & mask & 0xffffffff
last = 0
while i != 0:
last ^= (i & 1)
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Cryptoverse/2023/crypto/Knapsack_vs_Backpack/challenge.py | ctfs/Cryptoverse/2023/crypto/Knapsack_vs_Backpack/challenge.py | from Crypto.Util.number import *
from math import gcd
from secret import flag
import random
NBITS = 32
print("=== Knapsack vs. Backpack ===")
class Knapsack:
def __init__(self, nbits):
W, P = [], []
for _ in range(nbits):
W.append(random.randint(1, 10))
P.append(random.ran... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Cryptoverse/2023/crypto/PicoChip_2/picochip.py | ctfs/Cryptoverse/2023/crypto/PicoChip_2/picochip.py | from Crypto.Util.number import *
from enum import Enum
from base64 import b64encode
from secret import flag
import random
import csv
class State(Enum):
# PicoChip power states for hardware simulation.
FALLBACK = 0x0
SUCCESS = 0x1
ERROR = 0x2
class PicoChip:
def __init__(self, k: int, N: int, t:... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Cryptoverse/2022/crypto/RSA2/chall.py | ctfs/Cryptoverse/2022/crypto/RSA2/chall.py | from Crypto.Util.number import inverse, bytes_to_long, getPrime, isPrime
from math import gcd
from secret import flag
PBITS = 512
e = 0x10001
def stage_one(data: bytes):
m = bytes_to_long(data)
p = getPrime(PBITS)
q = getPrime(PBITS)
b = 7
n = p**b * q
print(f"p = {p}")
print(f"e = {e}")
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Cryptoverse/2022/crypto/Weird_dlog/chall.py | ctfs/Cryptoverse/2022/crypto/Weird_dlog/chall.py | from Crypto.Util.number import *
from secret import flag
NBITS = 1337
def keygen():
p = getPrime(NBITS)
q = p + 2
while not isPrime(q):
q += 2
n = p**2 * q
g = getRandomRange(2, n-1)
assert pow(g, p-1, p**2) != 1
return (g, n), p
(g, n), pk = keygen()
print(f"g = {g}")
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/Cryptoverse/2022/crypto/ATaleOfTwoSystems/challenge.py | ctfs/Cryptoverse/2022/crypto/ATaleOfTwoSystems/challenge.py | from Crypto.Util.number import *
from secret import flag
NBITS = 1024
def system_one(m: bytes):
a, b = [getRandomNBitInteger(NBITS) for _ in range(2)]
p = getPrime(2 * NBITS)
q = getPrime(NBITS // 2)
g = inverse(a, p) * q % p
ct = (b * g + bytes_to_long(m)) % p
print(f"p = {p}")
print(f"... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Cryptoverse/2022/crypto/BigRabin/chall.py | ctfs/Cryptoverse/2022/crypto/BigRabin/chall.py | from Crypto.Util.number import *
from secret import flag
import os, functools
primes = []
e = 2
for _ in range(10):
primes.append(getPrime(1024))
n = functools.reduce((lambda x, y: x * y), primes)
m = bytes_to_long(os.urandom(256) + flag)
c = pow(m,e,n)
print(primes)
print(c) | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Cryptoverse/2022/crypto/RSA3/server.py | ctfs/Cryptoverse/2022/crypto/RSA3/server.py | from Crypto.Util.number import *
import random
from secret import flag
es = [17, 19, 23, 29, 31, 63357]
e = random.choice(es)
p = getPrime(1024)
q = getPrime(1024)
n = p * q
m = bytes_to_long(flag)
c = pow(m, e, n)
if not random.randint(0, 10):
c = (1 << len(bin(c)[2:])) | c
print(f"n = {n}\ne = {e}\nc = {c}") | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Defcamp/2022/crypto/algorithm/chall.py | ctfs/Defcamp/2022/crypto/algorithm/chall.py | flag = ' [test]'
hflag = flag.encode('hex')
iflag = int(hflag[2:], 16)
def polinom(n, m):
i = 0
z = []
s = 0
while n > 0:
if n % 2 != 0:
z.append(2 - (n % 4))
else:
z.append(0)
n = (n - z[i])/2
i = i + 1
z = z[::-1]
l = len(z)
for i in range(0, l):
s += z[i] * m **... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Defcamp/2022/crypto/beauty/beast.py | ctfs/Defcamp/2022/crypto/beauty/beast.py |
from beast_tls import *
connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connection.connect(("127.0.0.1", 4444))
secret = all_requests("flag: CTF{XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}")
found = ''.join(secret)
print "\n" + found
connection.close() | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Defcamp/2022/crypto/P2DPI/server.py | ctfs/Defcamp/2022/crypto/P2DPI/server.py | from Crypto.PublicKey import ECC
from Crypto.Random import get_random_bytes
from Crypto.Random.random import randint
from blake3 import blake3
import base64 as b64
import traffic
import ecdsa
secure_message = traffic.get_msg()
sign_pub= None
with open('key.pub','rb') as f:
sign_pub=f.read()
ver=ecdsa.VerifyingKey.fr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/KITCTFCTF/2023/pwn/icefox/deploy/wrapper.py | ctfs/KITCTFCTF/2023/pwn/icefox/deploy/wrapper.py | import base64
import binascii
from pwn import *
import sys
import os
def main():
try:
b64 = input("Base64 encoded file: ").strip()
except EOFError:
return
try:
js = base64.b64decode(b64)
except binascii.Error:
print("Invalid input", flush=True)
return
if l... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/KITCTFCTF/2023/pwn/type_THIS/deploy/visit.py | ctfs/KITCTFCTF/2023/pwn/type_THIS/deploy/visit.py | import validators
import subprocess
import time
import os
WGET_TIMEOUT = 10
exploit_url = input("URL: ")
if not validators.url(exploit_url):
print("Invalid URL!")
exit(0)
try:
fn = os.urandom(16).hex()
fpath = f"attempts/{fn}"
is_reachable = subprocess.call(["wget", "-p", "-k", "-P", fpath, explo... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/KITCTFCTF/2023/rev/sup3r5ecur3N0tPh15hyF11e/sup3r5ecur3N0tPh15hyF11e.exe.py | ctfs/KITCTFCTF/2023/rev/sup3r5ecur3N0tPh15hyF11e/sup3r5ecur3N0tPh15hyF11e.exe.py | import marshal
__name__ = __file__.split("/")[-1].encode()
f = lambda x: sum([coefs[i]*pow(x,i,7573) for i,_ in enumerate(coefs)]) % 7573
d = lambda f,n: [42,3][int(n)] if n<2 else int(f(f,n/2) +f(f,n/2))
coefs = [227,
5236,
4304,
6403,
3327,
6974,
1789,
6826,
4659,
785,
337,
6446,
7475,
445,
1128,
326,
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | true |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/KITCTFCTF/2023/crypto/number-lock/number-lock.py | ctfs/KITCTFCTF/2023/crypto/number-lock/number-lock.py | #!/usr/bin/env python3
import random
from binascii import unhexlify
"""
Original AES-128 implementation by Bo Zhu (http://about.bozhu.me) at
https://github.com/bozhu/AES-Python . PKCS#7 padding,
byte array and string support added by https://github.com/boppreh/aes.
"""
s_box = (
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/KITCTFCTF/2023/crypto/ref4ctory/main.py | ctfs/KITCTFCTF/2023/crypto/ref4ctory/main.py | import sys
import ast
def check_factors(a,b,ab):
if abs(a)<=1 or abs(b)<=1:
print("too easy")
return False
if type(a*b) == float:
print("no floats please")
return False
return a*b == ab
factors = [4,10,0x123120,38201373467,247867822373,422943922809193529087,3741]
for comp... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/KITCTFCTF/2023/crypto/one_true_pairing/main.py | ctfs/KITCTFCTF/2023/crypto/one_true_pairing/main.py | import sys
import random
from secret import get_next_seed, store_leaked_data, store_exec_status, get_flag, get_scheduled_cmds
RESEED_AFTER = 1000000
def xor_bytes(a, b):
return bytes(map(lambda x: x[0] ^ x[1], zip(a,b)))
class Handler:
def __init__(self) -> None:
self.handling = True
self.... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/KITCTFCTF/2023/crypto/one_true_pairing/secret.py | ctfs/KITCTFCTF/2023/crypto/one_true_pairing/secret.py | import random
import os
FLAG_RESPONSE = b'Please keep this for me: ' + os.getenv('FLAG', 'GPNCTF{fake_flag}').encode()
def get_next_seed():
return os.urandom(12)
def store_leaked_data(data):
# store leaked data from remote for later processing
return
def store_exec_status(status):
# store or pr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/KITCTFCTF/2023/crypto/winterfactory/winterfactory.py | ctfs/KITCTFCTF/2023/crypto/winterfactory/winterfactory.py | #!/usr/bin/env python3
import winternitz.signatures
import random
from binascii import unhexlify
class factory:
def __init__(self):
w = 2**16
self.wots = winternitz.signatures.WOTS(w, digestsize=256, hashfunction=winternitz.signatures.openssl_sha256)
self.factory_id = 831347528
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/KITCTFCTF/2023/web/cross-site-python/app.py | ctfs/KITCTFCTF/2023/web/cross-site-python/app.py | from flask import Flask, redirect, make_response, render_template, request, abort, Response
from base64 import b64decode as decode
from base64 import b64encode as encode
from queue import Queue
import random
import string
app = Flask(__name__)
projects = {}
project_queue = Queue(1000)
def generate_id():
return '... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/KITCTFCTF/2023/web/Wanky_Mail/app.py | ctfs/KITCTFCTF/2023/web/Wanky_Mail/app.py | from flask import Flask, render_template_string, request, redirect, abort
from aiosmtpd.controller import Controller
from datetime import datetime
from base58 import b58decode, b58encode
import random
import string
import os
from datetime import datetime
import queue
mails = {}
active_addr = queue.Queue(1000)
def fo... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/KITCTFCTF/2022/pwn/date/pow.py | ctfs/KITCTFCTF/2022/pwn/date/pow.py | import os
import subprocess
import sys
DIFFICULTY = 26
def check(r, token):
return subprocess.call(["hashcash", f"-cyqb{DIFFICULTY}", "-r", r, token]) == 0
def main():
if len(sys.argv) != 2:
print("No command provided", flush=True)
exit()
r = os.urandom(8).hex()
print(f"Send the result of: hashcash -mb{D... | 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.