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/WACON/2023/Quals/crypto/PSS/prob.py
ctfs/WACON/2023/Quals/crypto/PSS/prob.py
from Crypto.Util.number import * import os from hashlib import sha256 from tqdm import tqdm def cascade_hash(msg, cnt, digest_len): assert digest_len <= 32 msg = msg * 10 for _ in range(cnt): msg = sha256(msg).digest() return msg[:digest_len] def seed_to_permutation(seed): permutation = ''...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WACON/2023/Quals/web/mosaic/file_remover.py
ctfs/WACON/2023/Quals/web/mosaic/file_remover.py
import os, time from threading import Thread def flag_remover(): while True: try: time.sleep(3) os.system("rm -rf /app/uploads/admin/*") os.system("rm -rf /app/static/uploads/admin/*") except: continue def userfile_remover(): while True: ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WACON/2023/Quals/web/mosaic/src/app.py
ctfs/WACON/2023/Quals/web/mosaic/src/app.py
from flask import Flask, render_template, request, redirect, url_for, session, g, send_from_directory import mimetypes import requests import imageio import os import sqlite3 import hashlib import re from shutil import copyfile, rmtree import numpy as np app = Flask(__name__) app.secret_key = os.urandom(24) app.config...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2024/crypto/Times/mul_safe.py
ctfs/BYUCTF/2024/crypto/Times/mul_safe.py
import hashlib from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad from ellipticcurve import * # I'll use my own library for this from base64 import b64encode import os from Crypto.Util.number import getPrime def encrypt_flag(shared_secret: int, plaintext: str): iv = os.urandom(AES.block_size...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2024/crypto/Do_Math/domath_safe.py
ctfs/BYUCTF/2024/crypto/Do_Math/domath_safe.py
from Crypto.Util.number import * p = getPrime(2048) q = getPrime(2048) e = 0x10001 n = p * q d = pow(e, -1, (p-1)*(q-1)) msg = "byuctf{REDACTED}" m = bytes_to_long(msg.encode('utf-8')) c = pow(m, e, n) print(c) print() hints = [p, q, e, n, d] for _ in range(len(hints)): hints[_] = (hints[_] * getPrime(1024)) %...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/rev/bad2/bad2.py
ctfs/BYUCTF/2023/rev/bad2/bad2.py
#!/usr/bin/python3 from base64 import b64decode as c︀;c︆=exec;c︋=lambda x:x.decode();c︆(c︋(c︀(b'ZXhlYygiaW1wb3J0IHN1YnByb2Nlc3MgYXMgc3lzIik=')));from base64 import b32decode as c︈;c︄={};c︄['c︉']=int;c︄['c︃']=__builtins__.__doc__;c︄['‮']=c︋(c︈(c︈(c︈(c︀(b'SkZMRVNWU0RLTkJWQVIyS0lOREVDVkNMSTVGVEtUQ1dJNUlURVVTSUtVNlQyUEo1SF...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/jail/Leet_1/leet1.py
ctfs/BYUCTF/2023/jail/Leet_1/leet1.py
import re FLAG = open('flag.txt').read() inp = input('> ') if re.search(r'\d', inp) or eval(inp) != 1337: print('Nope') else: print(FLAG)
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/jail/nopqrstuvwxyz/nopqrstuvwxyz.py
ctfs/BYUCTF/2023/jail/nopqrstuvwxyz/nopqrstuvwxyz.py
inp = input("code > ").lower() eval((inp[:4]+__import__("re").sub(r'[n-z]','',inp[4:]))[:80])
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/jail/abcdefghijklm/abcdefghijklm.py
ctfs/BYUCTF/2023/jail/abcdefghijklm/abcdefghijklm.py
inp = input("code > ").lower() eval((inp[:4]+__import__("re").sub(r'[a-m]','',inp[4:]))[:80])
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/jail/Builtins_1/b1.py
ctfs/BYUCTF/2023/jail/Builtins_1/b1.py
print(eval(input("code> "), {"__builtins__": {}}, {"__builtins__": {}}))
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/jail/a-z0-9/a-z0-9.py
ctfs/BYUCTF/2023/jail/a-z0-9/a-z0-9.py
eval((__import__("re").sub(r'[a-z0-9]','',input("code > ").lower()))[:130])
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/jail/Builtins_2/b2.py
ctfs/BYUCTF/2023/jail/Builtins_2/b2.py
inp = input("code> ")[:72] if "__" in inp: print("Nope") else: print(eval(inp, {"__builtins__": {}}, {"__builtins__": {}}))
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/jail/Leet_2/leet2.py
ctfs/BYUCTF/2023/jail/Leet_2/leet2.py
import re FLAG = open('flag.txt').read() inp = input('> ') if re.search(r'[123456789]', inp) or re.search(r'\(', inp) or eval(inp) != 1337: print('Nope') else: print(FLAG)
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/web/Notes/server.py
ctfs/BYUCTF/2023/web/Notes/server.py
# imports from flask import Flask, session, request, redirect import secrets, html # initialize flask app = Flask(__name__) app.secret_key = secrets.token_hex(32) FLAG = open("flag.txt", "r").read() SECRET = open("secret.txt", "r").read() users = [{'username':'admin','password':SECRET}] # NEVER DO THIS IN PRODUCTION ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/web/urmombotnetdotnetcom_1/app/botnet_order_routes.py
ctfs/BYUCTF/2023/web/urmombotnetdotnetcom_1/app/botnet_order_routes.py
# imports from __main__ import app, token_required, BOT_MONTHLY_PRICE, mysql from flask import jsonify, request from datetime import datetime # GET botnet order information @app.route('/api/botnet-orders/<int:order_id>', methods=['GET']) @token_required def get_botnet_order(session_data, order_id): # get user_id ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/web/urmombotnetdotnetcom_1/app/login_routes.py
ctfs/BYUCTF/2023/web/urmombotnetdotnetcom_1/app/login_routes.py
# imports from __main__ import app, mysql from flask import jsonify, request, make_response import re, jwt from hashlib import sha256 # POST register @app.route('/api/register', methods=['POST']) def post_register(): # ensure needed parameters are present if (request.json is None) or ('email' not in request.js...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/web/urmombotnetdotnetcom_1/app/account_routes.py
ctfs/BYUCTF/2023/web/urmombotnetdotnetcom_1/app/account_routes.py
# imports from __main__ import app, token_required, BOT_PRICE_LINUX_WINDOWS, BOT_PRICE_MACOS, mysql from flask import jsonify, request import ipaddress # GET user information @app.route('/api/users/<int:user_id>', methods=['GET']) @token_required def get_user(session_data, user_id): # ensure user is authorized to...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/web/urmombotnetdotnetcom_1/app/server.py
ctfs/BYUCTF/2023/web/urmombotnetdotnetcom_1/app/server.py
# imports from flask import Flask, jsonify, request import jwt, secrets from flask_mysqldb import MySQL from functools import wraps import os # initialize flask app = Flask(__name__) PORT = 8000 BOT_PRICE_LINUX_WINDOWS = 25.00 BOT_PRICE_MACOS = 50.00 BOT_MONTHLY_PRICE = 5.00 # set up MySQL integration app.config['MY...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2023/web/urmombotnetdotnetcom_1/app/ticket_routes.py
ctfs/BYUCTF/2023/web/urmombotnetdotnetcom_1/app/ticket_routes.py
# imports from __main__ import app, token_required, mysql from flask import jsonify, request from datetime import datetime # GET ticket information @app.route('/api/tickets/<int:ticket_id>', methods=['GET']) @token_required def get_ticket(session_data, ticket_id): # get user_id from ticket_id cur = mysql.conn...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2025/misc/Hash_Psycho/hash_psycho.py
ctfs/BYUCTF/2025/misc/Hash_Psycho/hash_psycho.py
FLAG = "byuctf{}" class User: def __init__(self, username, id): self.username = username self.id = id def __eq__(self, other): return self.id == other.id def __hash__(self): return hash(self.id) ADMIN = User('admin', 1337) print("Welcome to onboarding! I'm Ja...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2025/rev/u/u.py
ctfs/BYUCTF/2025/rev/u/u.py
ù,ú,û,ü,ũ,ū,ŭ,ů,ű,ų,ṳ,ṷ,ụ=chr,ord,abs,input,all,print,len,input,pow,range,list,dict,set;ù=[12838,1089,16029,13761,1276,14790,2091,17199,2223,2925,17901,3159,18135,18837,3135,19071,4095,19773,4797,4085,20007,5733,20709,17005,2601,9620,3192,9724,3127,8125];u,U=3,256;ṷ=ü();ʉ=ṳ(ụ([ű(u,û,U) for û in(ų(U))]))[u:ŭ(ù)+u];ṳ=zip...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2025/crypto/Choose_Your_RSA/server.py
ctfs/BYUCTF/2025/crypto/Choose_Your_RSA/server.py
#!/usr/local/bin/python from Crypto.Cipher import AES from Crypto.Util.number import bytes_to_long, getPrime from Crypto.Util.Padding import pad import os print("[+] Generating values...", flush=True) flag = open("/app/flag.txt").read().encode() key = os.urandom(160) p, q, n, e = [], [], [], [] for i in range(3): ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2025/crypto/Cycles/main.py
ctfs/BYUCTF/2025/crypto/Cycles/main.py
from Crypto.Util.number import long_to_bytes, bytes_to_long, isPrime from Crypto.Cipher import AES from Crypto.Util.Padding import pad # Can you undo this? from hidden import p,N,a,flag,g # these are for you :) assert isPrime(p) assert len(bin(a)) < 1050 hint = pow(g, a, p) key = long_to_bytes(a)[:16] cipher = AES....
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2025/crypto/Hash_Based_Cryptography/server.py
ctfs/BYUCTF/2025/crypto/Hash_Based_Cryptography/server.py
#!/usr/local/bin/python import hashlib from secrets import KEY, FLAG def gen_otp(key: bytes, message: bytes) -> bytes: iv = key otp = b'' for _ in range(len(message)//20): iv = hashlib.sha1(iv).digest() otp += iv return otp def pad(message): if type(message) is str: messag...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2025/crypto/Many_Primes/encrypt.py
ctfs/BYUCTF/2025/crypto/Many_Primes/encrypt.py
from Crypto.Util.number import bytes_to_long, getPrime import random flag = open("flag.txt").read().encode() flag = bytes_to_long(flag) n = 1 while n.bit_length()<4096: i = random.randint(10,16) reps = random.randint(2,5) p = getPrime(i) if n%p !=0: n*=p**reps e = 65537 encryptedFlag = pow(flag...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2025/crypto/Anaken21sec1/encrypt.py
ctfs/BYUCTF/2025/crypto/Anaken21sec1/encrypt.py
import numpy as np from random import choice A = np.array([[1, 7, 13, 19, 25, 31], [2, 8, 14, 20, 26, 32], [3, 9, 15, 21, 27, 33], [4, 10, 16, 22, 28, 34], [5, 11, 17, 23, 29, 35], [6, 12, 18, 24, 30, 36]]) B = np.array([[36, 30, 24, 18, 12, 6], [...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2025/crypto/Real_Smooth/real-smooth.py
ctfs/BYUCTF/2025/crypto/Real_Smooth/real-smooth.py
#!/usr/local/bin/python from Crypto.Cipher import ChaCha20 from Crypto.Random import get_random_bytes from secrets import FLAG key = get_random_bytes(32) nonce = get_random_bytes(8) cipher = ChaCha20.new(key=key, nonce=nonce) print(bytes.hex(cipher.encrypt(b'Slide to the left'))) print(bytes.hex(cipher.encrypt(b'Sli...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2025/crypto/Anaken21sec2/break.py
ctfs/BYUCTF/2025/crypto/Anaken21sec2/break.py
#!/usr/local/bin/python import encrypt key = encrypt.getRandomKey() flag = open("flag.txt").read().strip().split("byuctf{")[1].split("}")[0] flag = [letter.lower() for letter in flag if letter.isalpha()] print(encrypt.encrypt(flag, key)) for _ in range(20): plaintext = input("What to encrypt:\n") plaintex...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2025/crypto/Anaken21sec2/encrypt.py
ctfs/BYUCTF/2025/crypto/Anaken21sec2/encrypt.py
import numpy as np from random import choice A = np.array([[1, 7, 13, 19, 25, 31], [2, 8, 14, 20, 26, 32], [3, 9, 15, 21, 27, 33], [4, 10, 16, 22, 28, 34], [5, 11, 17, 23, 29, 35], [6, 12, 18, 24, 30, 36]]) B = np.array([[36, 30, 24, 18, 12, 6], [...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2022/rev/FunFact/obfuscated.py
ctfs/BYUCTF/2022/rev/FunFact/obfuscated.py
import base64 string = "aW1wb3J0IHJhbmRvbSwgc3RyaW5nCiAgICAKZGVmIG9wdGlvbl9vbmUoKToKICAgIHByaW50KCJcbkp1c3Qga2lkZGluZywgaXQncyBub3QgdGhhdCBlYXN5XG4iKQogICAgbWFpbigpCiAgICAKZGVmIG9wdGlvbl90d28oKToKICAgIHJhbmRvbV9mYWN0cyA9IFsiRWFjaCBhcm0gb2YgYW4gb2N0b3B1cyBoYXMgaXRzIG93biBuZXJ2b3VzIHN5c3RlbSIsICJDb21iIGplbGxpZXMgYXJlIHRy...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2022/web/Wordle/utils.py
ctfs/BYUCTF/2022/web/Wordle/utils.py
from werkzeug.exceptions import abort from sql import get_sql import hashlib def checkSolved(guess_status): # guess_status[g_pos] = {"letter":g_char, "state":1} isSolved = True for i in guess_status: if i["state"] != 2: isSolved = False return isSolved def getHashString(guess_st...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BYUCTF/2022/web/Wordle/app.py
ctfs/BYUCTF/2022/web/Wordle/app.py
import json import uuid from flask import Flask, render_template, request, abort, make_response from flask_cors import CORS from flask_limiter import Limiter from flask_limiter.util import get_remote_address from werkzeug.middleware.proxy_fix import ProxyFix from utils import set_finished, word_is_valid, id_or_400, g...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2021/pwn/Jerry/wrapper.py
ctfs/N1CTF/2021/pwn/Jerry/wrapper.py
#!/usr/bin/python -u # -*- coding: utf-8 -*- import os import sys import time import base64 import signal import random import string import uuid S = string.letters+string.digits+'_' def handler(signum, frame): print('time up!') exit(0) def generate_filename(): a = '/tmp/' a += str(uuid.uuid1()) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2021/pwn/easyx11/run.py
ctfs/N1CTF/2021/pwn/easyx11/run.py
#!/usr/bin/env python3 import socket import threading import os import sys import ctypes def send(conn): while True: try: data = conn.recv(4096) os.write(sys.stdout.fileno(), data) except: break conn.close() def recv(conn): while True: try: ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2021/crypto/checkin/checkin.py
ctfs/N1CTF/2021/crypto/checkin/checkin.py
from Crypto.Util.number import * from secret import flag p = getPrime(512) q = getPrime(512) n = p*q x = 2021*p+1120*q h = (inverse(x,n)+x)%n e = 65537 c = pow(bytes_to_long(flag), e, n) print('n =', n) print('c =', c) print('h =', h) print('p0 =', p >> 490) # n = 1245929232167658379825288392027333397136552428727173...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2021/crypto/n1token2/n1-token2.py
ctfs/N1CTF/2021/crypto/n1token2/n1-token2.py
import random from secret import FLAG assert FLAG.startswith('n1ctf{') assert FLAG.endswith('}') SECRET = bytes.fromhex(FLAG[6:-1]) assert len(SECRET) == 16 p = 251 e = [1, 20, 113, 149, 219] y = b'' for x in range(1, p): coeff = [random.choice(e)] + list(SECRET) y += bytes([sum(c * pow(x, i, p) for i, c ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2021/crypto/oh_my_flag/compsite.py
ctfs/N1CTF/2021/crypto/oh_my_flag/compsite.py
import cv2 orig=cv2.imread("orig.bmp") flag=cv2.imread("flag.bmp") yoff,xoff=400,700 for i in range(flag.shape[0]): for j in range(flag.shape[1]): if flag[i][j][0]==0: assert(sum(orig[i+yoff][j+xoff]!=0)==3) orig[i+yoff][j+xoff][0]=0 orig[i+yoff][j+xoff][1]=0 ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2021/crypto/n1token1/n1-token1.py
ctfs/N1CTF/2021/crypto/n1token1/n1-token1.py
from Crypto.Util.number import * import random from secret import flag def gettoken(c): X = 0 while ((pow(X, (p-1)//2, p)!=1) or (pow(X, (q-1)//2, q)!=1)): X = 1 while X.bit_length() < 920: X *= random.choice(primes) xp = pow(X, (p + 1)//4, p) xq = pow(X, (q + 1)//4, q) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2021/crypto/n1ogin/client.py
ctfs/N1CTF/2021/crypto/n1ogin/client.py
import os import json import time from Crypto.PublicKey.RSA import import_key from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.primitives import hashes, hmac from pwn import * PUB_KEY = import_key(open("n1ogin.pub", "r").read()) def seal(content): iv = os.ur...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2021/crypto/n1ogin/server.py
ctfs/N1CTF/2021/crypto/n1ogin/server.py
import os import json import time from Crypto.PublicKey.RSA import import_key from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.primitives import hashes, hmac from secret import FLAG, SALT # generated by `openssl genrsa -out n1ogin.pem 2048` PRIV_KEY = import_key(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2021/web/tornado/app.py
ctfs/N1CTF/2021/web/tornado/app.py
import tornado.ioloop import tornado.web import builtins import unicodedata import uuid import os import re def filter(data): data = unicodedata.normalize('NFKD',data) if len(data) > 1024: return False if re.search(r'__|\(|\)|datetime|sys|import',data): return False for k in builtins.__...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2019/Part5-typechecker/pow_solver.py
ctfs/N1CTF/2019/Part5-typechecker/pow_solver.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import hashlib, string, struct, sys def solve_pow(chal, n): r = 0 while True: s = chal + struct.pack("<Q", r) h = int(hashlib.sha256(s).hexdigest(), 16) if h % (2 ** n) == 0: break r += 1 return r if __name__ == '__main__': if len(sys.argv)...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2023/misc/guess_by_cyberutopian/files/pow.py
ctfs/N1CTF/2023/misc/guess_by_cyberutopian/files/pow.py
import hashlib import os def generate_proof_of_work(size,difficulty): target = os.urandom(size).hex() hash_value = hashlib.sha1(target.encode()).hexdigest() return target[difficulty:],hash_value def check_proof_of_work(prefix,suffix,expected): return hashlib.sha1(f'{prefix}{suffix}'.encode()).hexdiges...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2023/misc/guess_by_cyberutopian/files/chal.py
ctfs/N1CTF/2023/misc/guess_by_cyberutopian/files/chal.py
#!/usr/bin/env python3 import os import base64 import random import subprocess random.seed(os.urandom(32)) # Enjoy the music :) SALT_DICT=base64.b64decode(b'aHR0cHM6Ly95LnFxLmNvbS9uL3J5cXEvc29uZ0RldGFpbC8wMDAyOTJXNjJvODd3Rg==') def generate_salts(): num_salts=random.randint(1,16) return [bytes(random.choices...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2023/pwn/n1sub/pow.py
ctfs/N1CTF/2023/pwn/n1sub/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/N1CTF/2023/crypto/e2D1p/task.py
ctfs/N1CTF/2023/crypto/e2D1p/task.py
from Crypto.Util.number import * import os FLAG = os.environ.get('FLAG', b'n1ctf{XXXXFAKE_FLAGXXXX}') assert FLAG[:6] == b'n1ctf{' and FLAG[-1:] == b'}' FLAG = FLAG[6:-1] def keygen(nbits): while True: q = getPrime(nbits) if isPrime(2*q+1): if pow(0x10001, q, 2*q+1) == 1: ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2023/crypto/e2sm4/util.py
ctfs/N1CTF/2023/crypto/e2sm4/util.py
from random import sample i2l = lambda x: [(x >> 24) & 0xff, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff] l2i = lambda x: (x[0] << 24)|(x[1] << 16)|(x[2] << 8)|x[3] rotl32 = lambda x, n: ((x << n) & 0xffffffff) | ((x >> (32-n)) & 0xffffffff) rotl8 = lambda x, n: ((x << n) & 0xff) | ((x >> (8-n)) & 0xff) xor = lambda x...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2023/crypto/e2sm4/task.py
ctfs/N1CTF/2023/crypto/e2sm4/task.py
import util import os FLAG = os.environ.get('FLAG', 'n1ctf{XXXXFAKE_FLAGXXXX}') key = os.urandom(16) ct = [] for _ in range(5): ct.append(util.crypt_ecb(FLAG.encode(), key, 31-_).hex()) print(f"Dance_Box = {util.Dance_Box}") print(f"{ct = }") """ Dance_Box = [[46, 38, 43, 106, 114, 176, 12, 69, 1, 21, 82, 27, 184...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2025/crypto/n1fhe/task.py
ctfs/N1CTF/2025/crypto/n1fhe/task.py
import tenseal.sealapi as sealapi from Crypto.Cipher import AES from Crypto.Util.Padding import pad import random, base64, os FLAG = b"n1ctf{REDACTED}" assert len(FLAG) == 48 degree = 4096 plain_modulus = sealapi.PlainModulus.Batching(degree, 18) coeff = sealapi.CoeffModulus.BFVDefault(degree, sealapi.SEC_LEVEL_TYPE.T...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2025/crypto/n1share/task.py
ctfs/N1CTF/2025/crypto/n1share/task.py
from Crypto.Cipher import AES import random, os, hashlib FLAG = b"n1ctf{REDACTED}" p = 521 drunk = random.sample(range(1, p), 300) key = os.urandom(256) shares = [] for x in range(1, p): y = [sum(c*pow(x,i,p) for i,c in enumerate(key[:128])), sum(c*pow(x,i,p) for i,c in enumerate(key[128:]))] shar...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2025/crypto/n1fnv1/server.py
ctfs/N1CTF/2025/crypto/n1fnv1/server.py
import os, secrets, signal def hash(params, msg): a, b, c, m, x = params for byte in msg: for bit in f'{byte:08b}': x = ((x * a + b + int(bit)) ^ c) % m return x nbits = 128 rand = lambda: secrets.randbits(nbits) print('⚙️', params := (rand() | 1, rand(), rand(), 2 ** nbits, rand())) p...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2025/crypto/n1fsr/task.py
ctfs/N1CTF/2025/crypto/n1fsr/task.py
import secrets FLAG = b"n1ctf{REDACTED}" Ns = [14, 32, 24, 48, 8, 8, 8, 8, 10] MASKS = [0x7a7, 0xcfdf1bcf, 0xb9ca5b, 0x83c7efefc783, 0x27, 0x65, 0x63, 0x2b, 0x243] Filters = [ 237861018962211057901759878514586912107, 69474900172976843852504521249820447513188207961992185137442753975916133181030, 28448620439...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2022/blockchain/Utility_Payment_Service/solve/solve.py
ctfs/N1CTF/2022/blockchain/Utility_Payment_Service/solve/solve.py
import os from os.path import exists so_file = "utility_payment_solve.so" if not exists(so_file): os.system('make') from pwn import args, remote from solana.publickey import PublicKey from solana.system_program import SYS_PROGRAM_ID host = args.HOST or 'localhost' port = args.PORT or 5000 r = remote(host, port...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2022/pwn/babyuefi/run.py
ctfs/N1CTF/2022/pwn/babyuefi/run.py
import os, subprocess import random def main(): try: os.system("rm -f OVMF.fd") os.system("cp OVMF.fd.bak OVMF.fd") ret = subprocess.call([ "qemu-system-x86_64", "-m", str(256+random.randint(0, 512)), "-drive", "if=pflash,format=raw,file=OVMF.fd", ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2022/rev/flag_compiler/check.py
ctfs/N1CTF/2022/rev/flag_compiler/check.py
ans=input("flag: n1ctf{?}\ninput ? here: ").strip() assert(len(ans)>=39 and len(ans)<=40 and ';' in ans) with open('fin.cpp','r') as f: r=f.read().replace('$FLAG$',','.join(map(str,[*__import__('struct').unpack("I"*10,ans.encode().ljust(40,b'\x00'))]))) with open('fin_out.cpp','w') as f: f.write(r) print("start check...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2022/crypto/brand_new_checkin/brand_new_checkin.py
ctfs/N1CTF/2022/crypto/brand_new_checkin/brand_new_checkin.py
from Crypto.Util.number import * from random import getrandbits from secret import flag def keygen(): p = getPrime(512) q = getPrime(512) n = p * q phi = (p-1)*(q-1) while True: a = getrandbits(1024) b = phi + 1 - a s = getrandbits(1024) t = -s*a * inverse(b, phi)...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/N1CTF/2022/crypto/ezdlp/ezdlp.py
ctfs/N1CTF/2022/crypto/ezdlp/ezdlp.py
from Crypto.Util.number import * from math import prod from secret import flag def keygen(pbits,kbits,k): p = getPrime(pbits) x = [getPrime(kbits + 1) for i in range(k)] y = prod(x) while 1: r = getPrime(pbits - kbits * k) q = 2 * y * r + 1 if isPrime(q): return p*q,...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TheCyberJawaraInternational/2024/crypto/exchange_1/server.py
ctfs/TheCyberJawaraInternational/2024/crypto/exchange_1/server.py
import random, os from sage.all import GF, EllipticCurve from Crypto.Hash import SHA256 from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad from secret import k, secret_message assert k < 2**80 class SIDHKeyExchange: def __init__(self, ea, eb, Px, Py, Qx, Qy): self.ea = ea se...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TheCyberJawaraInternational/2024/crypto/exchange_2/server.py
ctfs/TheCyberJawaraInternational/2024/crypto/exchange_2/server.py
import random, os from sage.all import GF, EllipticCurve from Crypto.Hash import SHA256 from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad from secret import k, secret_message assert k < 2**80 class SIDHKeyExchange: def __init__(self, ea, eb, Px, Py, Qx, Qy): self.ea = ea se...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TheCyberJawaraInternational/2024/crypto/Chemistry_Lab/chall.py
ctfs/TheCyberJawaraInternational/2024/crypto/Chemistry_Lab/chall.py
import numpy as np from random import * from PIL import Image dna_rules = { 1: {'00': 'A', '11': 'T', '01': 'G', '10': 'C'}, 2: {'00': 'A', '11': 'T', '10': 'G', '01': 'C'}, 3: {'01': 'A', '10': 'T', '00': 'G', '11': 'C'}, 4: {'01': 'A', '10': 'T', '11': 'G', '00': 'C'}, 5: {'10': 'A', '01': 'T', ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TheCyberJawaraInternational/2024/crypto/Tempus/challenge.py
ctfs/TheCyberJawaraInternational/2024/crypto/Tempus/challenge.py
import time from random import SystemRandom from ethsnarks import jubjub, eddsa, field FLAG = open('flag.txt', 'rb').read() def serialize(sig: eddsa.Signature): return (sig.R.compress() + int(sig.s).to_bytes(32, 'big')).hex() def deserialize(b): b = bytes.fromhex(b) R = jubjub.Point.decompress(b[:32]) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/S4CTF/2021/crypto/khayyam/khayyam.py
ctfs/S4CTF/2021/crypto/khayyam/khayyam.py
#!/usr/bin/env python3 from gmpy import * from flag import FLAG l = len(FLAG) // 2 x = int(FLAG[:l].encode("utf-8").hex(), 16) y = int(FLAG[l:].encode("utf-8").hex(), 16) p = next_prime(x) q = next_prime(y) e, n = 65537, p * q m_1 = x + int(sqrt(y)) m_2 = y + int(sqrt(x)) c_1, c_2 = pow(m_1, e, n), pow(m_2, e, n)...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/S4CTF/2021/crypto/Baby-IQ/baby-iq.py
ctfs/S4CTF/2021/crypto/Baby-IQ/baby-iq.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from math import sqrt from flag import flag import os import random import base64 def chunkchunk(msg, l): return [msg[l*i:l*(i + 1)] for i in range(0, len(msg) // l)] def pad(msg): r = int(sqrt(len(msg))) + 1 head = base64.b64encode(os.urandom(r**2))[:r**2 - (len(msg...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/S4CTF/2021/crypto/genie/genie.py
ctfs/S4CTF/2021/crypto/genie/genie.py
#!/usr/bin/env python3 import numpy as np import random from flag import FLAG p = 8443 def vsum(u, v): assert len(u) == len(v) l, w = len(u), [] for i in range(l): w += [(u[i] + v[i]) % p] return w def sprod(a, u): w = [] for i in range(len(u)): w += [a*u[i] % p] return w def encrypt(msg): l = len(msg)...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/S4CTF/2021/crypto/phillip/phillip.py
ctfs/S4CTF/2021/crypto/phillip/phillip.py
#!/usr/bin/env python3 from Crypto.Util.number import * from gmpy2 import next_prime, gcd, lcm from random import randint import sys, os, signal import inspect from flag import flag def make_params(nbit): p, q = [getPrime(nbit) for _ in range(2)] n, f, g = p * q, lcm(p-1, q-1), p + q e = pow(g, f, n**2) u = divmo...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/S4CTF/2021/crypto/Baby-RSA/baby_rsa.py
ctfs/S4CTF/2021/crypto/Baby-RSA/baby_rsa.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from Crypto.Util.number import * from flag import flag def create_tuple(nbit): # sorry for dirty code that is not performant! while True: p, q = [getPrime(nbit) for _ in range(2)] P = int(str(p) + str(q)) Q = int(str(q) + str(p)) if isPrime(P) and isPrime(Q): ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/S4CTF/2021/crypto/Baby-Xor/baby_xor.py
ctfs/S4CTF/2021/crypto/Baby-Xor/baby_xor.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from flag import flag def xor(u, v): return ''.join(chr(ord(cu) ^ ord(cv)) for cu, cv in zip(u, v)) u = flag v = flag[1:] + flag[0] enc = open('flag.enc', 'w') enc.write(xor(u, v)) enc.close()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HCMUS/2023/Quals/pwn/pickle_trouble/server.py
ctfs/HCMUS/2023/Quals/pwn/pickle_trouble/server.py
import pandas as pd import io import time import threading import socketserver import sys from io import StringIO import secrets import os import numpy as np FLAG_FILE = "flag.txt" PORT = int(os.getenv("APP_PORT")) HOST = "0.0.0.0" original_stdout = sys.stdout class Service(socketserver.BaseRequestHandler): def ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HCMUS/2023/Quals/pwn/python_is_safe/main.py
ctfs/HCMUS/2023/Quals/pwn/python_is_safe/main.py
#!/usr/bin/env python3 from ctypes import CDLL, c_buffer libc = CDLL('/lib/x86_64-linux-gnu/libc.so.6') buf1 = c_buffer(512) buf2 = c_buffer(512) libc.gets(buf1) if b'HCMUS-CTF' in bytes(buf2): print(open('./flag.txt', 'r').read())
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HCMUS/2023/Quals/crypto/M_Side/prob.py
ctfs/HCMUS/2023/Quals/crypto/M_Side/prob.py
from Crypto.Util.number import getStrongPrime, bytes_to_long as b2l, isPrime import os FLAG = os.getenv('FLAG', 'FLAG{hue_hue_hue}').encode() p = getStrongPrime(512) q = getStrongPrime(512) while not isPrime(4 * p * p + q * q): p = getStrongPrime(512) q = getStrongPrime(512) hint = 4 * p * p + q * q e = 6553...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HCMUS/2023/Quals/crypto/Sneak_Peek/prob.py
ctfs/HCMUS/2023/Quals/crypto/Sneak_Peek/prob.py
from Crypto.Util.number import getPrime, bytes_to_long as b2l FLAG = b2l(b'HMCSU-CFT{SO YOU THINK THIS FLAG IS REAL\xff}') p = getPrime(512) q = getPrime(512) n = p * q peek = p >> 240 print(n) print(peek) print(pow(FLAG, 65537, n)) """ 137695652953436635868173236797773337408441001182675256086214756367750388214098...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HCMUS/2023/Quals/crypto/real_key/prob.py
ctfs/HCMUS/2023/Quals/crypto/real_key/prob.py
from Crypto.Cipher import AES from Crypto.Util.number import getRandomInteger from Crypto.Util.Padding import pad import numpy as np def gen_key(): key = getRandomInteger(128).to_bytes(16, 'big') while b'\0' in key: key = getRandomInteger(128).to_bytes(16, 'big') mat = [[i for i in key[k:k+4]] for k in ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HCMUS/2023/Quals/crypto/CRY1/server.py
ctfs/HCMUS/2023/Quals/crypto/CRY1/server.py
import time import random import threading import socketserver import os FLAG_FILE = os.getenv("FLAG") PORT = int(os.getenv("APP_PORT")) HOST = "0.0.0.0" assert FLAG_FILE is not None, "Environment variable FLAG not set" assert PORT is not None, "Environment variable APP_PORT not set" class Service(socketserver.Base...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HCMUS/2023/Quals/crypto/falsehood/prob.py
ctfs/HCMUS/2023/Quals/crypto/falsehood/prob.py
import os import numpy as np from sage.all import ComplexField, PolynomialRing from Crypto.Cipher import AES from Crypto.Util.Padding import pad import random from binascii import hexlify FLAG = os.getenv('FLAG', "FLAG{this is a real flag}") bits = 1111 C = ComplexField(bits) P = PolynomialRing(C, names='x') (x,) = P....
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TexSAW/2024/crypto/Ironcrypt/encrypt.py
ctfs/TexSAW/2024/crypto/Ironcrypt/encrypt.py
from binascii import hexlify, unhexlify from Crypto.Cipher import AES import sys one = "----------------" two = "----------------" maxlen = 256 def encrypt(message, key): aes = AES.new(key, AES.MODE_OFB, two) return aes.encrypt(message) def decrypt(message, key): aes = AES.new(key, AES.MODE_OFB, two) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TexSAW/2025/misc/My_Awesome_Python_Homework_Assignment/main.py
ctfs/TexSAW/2025/misc/My_Awesome_Python_Homework_Assignment/main.py
#!/usr/local/bin/python import subprocess code = """ def isPalindrome(s): result = True for i in range(len(s) // 2): characterOne = s[i] characterTwo = s[len(s) - 1 - i] if characterOne != characterTwo: result = False return result wordToCheck = input("Enter a word to ch...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TexSAW/2025/pwn/gccfuck/main.py
ctfs/TexSAW/2025/pwn/gccfuck/main.py
#!/usr/bin/python3 from os import chdir from subprocess import run from tempfile import TemporaryDirectory code = input('code? ') assert len(set(code)) <= 12 with TemporaryDirectory() as d: chdir(d) with open('a.c', 'w') as f: f.write(code) assert run(['gcc', 'a.c'], capture_output=True).returnc...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TexSAW/2025/pwn/scfuck/main.py
ctfs/TexSAW/2025/pwn/scfuck/main.py
#!/usr/bin/python3 import re from os import chdir from subprocess import run from tempfile import TemporaryDirectory code = input('code? ') main = input('main? ') assert re.fullmatch(r'[a-zA-Z_][a-zA-Z0-9_]*', main) assert len(set(code)) <= 5 gcc = ['gcc', 'a.c', f'-Wl,--defsym=main={main},-T,a.ld'] with Temporary...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TexSAW/2025/pwn/slop/main.py
ctfs/TexSAW/2025/pwn/slop/main.py
#!/usr/bin/python3 import re from os import chdir from subprocess import run from tempfile import TemporaryDirectory # code = input('code? ') code = '' main = input('main? ') assert re.match(r'[a-zA-Z_][a-zA-Z0-9_]*', main) # assert len(set(code)) <= 5 # gcc = ['gcc', 'a.c', f'-Wl,--defsym=main={main},-T,a.ld'] gcc...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesAhmedabad/2021/pwn/shared_knote/pow.py
ctfs/BSidesAhmedabad/2021/pwn/shared_knote/pow.py
""" i.e. sha256("????v0iRhxH4SlrgoUd5Blu0") = b788094e2d021fa16f30c83346f3c80de5afab0840750a49a9254c2a73ed274c Suffix: v0iRhxH4SlrgoUd5Blu0 Hash: b788094e2d021fa16f30c83346f3c80de5afab0840750a49a9254c2a73ed274c """ import itertools import hashlib import string table = string.ascii_letters + string.digits + "._" suff...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesAhmedabad/2021/rev/collapsed_license/server.py
ctfs/BSidesAhmedabad/2021/rev/collapsed_license/server.py
import os import base64 import tempfile import subprocess import requests if __name__ == '__main__': try: url = input("License URL: ") assert url.startswith("http") lic = requests.get(url).content assert len(lic) < 1000*1000 # 1MB limit with tempfile.NamedTemporaryFile('w+b'...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesAhmedabad/2021/rev/kings_license/server.py
ctfs/BSidesAhmedabad/2021/rev/kings_license/server.py
import os import base64 import tempfile import subprocess if __name__ == '__main__': os.system("stty -icanon") try: b64lic = input("License Key: ") print(input("> ")) lic = base64.b64decode(b64lic) with tempfile.NamedTemporaryFile('w+b') as f: f.write(lic) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesAhmedabad/2021/crypto/they_were_eleven/task.py
ctfs/BSidesAhmedabad/2021/crypto/they_were_eleven/task.py
import os from Crypto.Util.number import getPrime, getRandomRange with open("flag.txt", "rb") as f: m = f.read().strip() m += os.urandom(111 - len(m)) m = int.from_bytes(m, "big") xs = [] for i in range(11): p = getPrime(512) q = getPrime(512) n = p * q c = m**11 * getRandomRange(0, 2**1...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesAhmedabad/2021/crypto/floorsa/chall.py
ctfs/BSidesAhmedabad/2021/crypto/floorsa/chall.py
import os import hashlib from Crypto.Util.number import getPrime, getRandomNBitInteger from itertools import product def floor_sum(n: int, m: int, a: int) -> int: """Fast calculation for sum([a * i // m for i in range(n)]) """ res, b = 0, 0 while 0 < n: res += n * (n - 1) // 2 * (a // m) a %= m res...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BSidesAhmedabad/2021/crypto/dlppp/task.py
ctfs/BSidesAhmedabad/2021/crypto/dlppp/task.py
import os from Crypto.Util.number import getPrime, getRandomNBitInteger flag = os.getenv("FLAG", "XXXX{sample_flag}").encode() m = int.from_bytes(flag, 'big') p = getPrime(512) y = pow(1 + p, m, p**3) assert m < p print(f"p = {hex(p)}") print(f"y = {hex(y)}")
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2021/crypto/trinity/src/server.py
ctfs/Balsn/2021/crypto/trinity/src/server.py
#!/usr/local/bin/python3 -u import signal from blake3 import blake3 signal.alarm(15) key = b'wikipedia.org/wiki/Trinity'.ljust(32) God = bytes.fromhex(input('God >')) GOd = bytes.fromhex(input('GOd >')) GOD = bytes.fromhex(input('GOD >')) trinity = {God, GOd, GOD} assert 3 == len(trinity) assert 1 == len({blake3(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2021/crypto/dlog/src/server.py
ctfs/Balsn/2021/crypto/dlog/src/server.py
#!/usr/local/bin/python3 -u from gevent import monkey monkey.patch_all() import json import os from gevent.pywsgi import WSGIServer from flask import Flask, Response, request from prometheus_client import Summary, make_wsgi_app from werkzeug.middleware.dispatcher import DispatcherMiddleware app = Flask(__name__) OR...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2021/crypto/1337pins/src/server.py
ctfs/Balsn/2021/crypto/1337pins/src/server.py
#!/usr/local/bin/python3 -u import signal import random signal.alarm(600) N = 1337 remaining = N for i in range(31337): y = random.getrandbits(32) % 10 x = int(input()) if x == y: remaining -= 1 print('.') else: remaining = N print(y) if remaining == 0: ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2021/crypto/IEAIE/lib.py
ctfs/Balsn/2021/crypto/IEAIE/lib.py
import math import functools import numpy as np from scipy.stats import entropy from skimage.measure import shannon_entropy from secret import x0, y0, xp0, yp0, GenerateNewKey, GenerateNewFlag, GetSameEntropyImage mu = 0.8116 @functools.lru_cache(maxsize=None) def LASM2D(mu, x0, y0, ret_num, skip_num=200): iter_n...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2021/crypto/IEAIE/secret.py
ctfs/Balsn/2021/crypto/IEAIE/secret.py
# NOTE!!!!!!! # This is just a example of secret.py for you to run locally # The remote implementation is different import random, sys import numpy as np from PIL import Image # secret key x0, y0, xp0, yp0 = 0.441, 0.3406, 0.8704, 0.1566 def GenerateNewKey(): global x0, y0, xp0, yp0 x0, y0, xp0, yp0 = 0.441, ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2021/crypto/IEAIE/encrypt.py
ctfs/Balsn/2021/crypto/IEAIE/encrypt.py
#!/usr/bin/env python3 from lib import * from subprocess import * import numpy as np import sys import concurrent.futures import base64 from scipy.stats import entropy def Encrypt(A): # Step 1 (m, n) = A.shape s = Entropy(A) x_0, y_0 = UpdateKey1(x0, y0, xp0, yp0, s) P_seq = LASM2D(mu, x_0, y_0, m...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2021/crypto/Draupnir/distribute/share/chal.py
ctfs/Balsn/2021/crypto/Draupnir/distribute/share/chal.py
import eth_sandbox from web3 import Web3 eth_sandbox.run_launcher([ eth_sandbox.new_launch_instance_action(deploy_value=Web3.toWei(100, 'ether')), eth_sandbox.new_get_flag_action() ])
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2021/crypto/Draupnir/distribute/share/eth_sandbox/launcher.py
ctfs/Balsn/2021/crypto/Draupnir/distribute/share/eth_sandbox/launcher.py
import requests import os from dataclasses import dataclass from typing import Callable, List, Dict, Optional import binascii import random import string import hashlib from web3 import Web3 from web3.types import TxReceipt from eth_account import Account import json from eth_sandbox import load_auth_key from hexbyte...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2021/crypto/Draupnir/distribute/share/eth_sandbox/__init__.py
ctfs/Balsn/2021/crypto/Draupnir/distribute/share/eth_sandbox/__init__.py
from .auth import * from .launcher import *
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2021/crypto/Draupnir/distribute/share/eth_sandbox/server.py
ctfs/Balsn/2021/crypto/Draupnir/distribute/share/eth_sandbox/server.py
from web3 import Web3 from dataclasses import dataclass from threading import Thread, Lock from typing import Tuple, Dict, Any from uuid import uuid4 import sys import os from eth_account.hdaccount import generate_mnemonic import socket import random import time from flask import Flask, request, redirect, Response ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2021/crypto/Draupnir/distribute/share/eth_sandbox/auth.py
ctfs/Balsn/2021/crypto/Draupnir/distribute/share/eth_sandbox/auth.py
from uuid import uuid4 def load_auth_key(): with open("/tmp/auth", "r") as f: return f.read() def generate_auth_key(): auth_key = str(uuid4()) with open("/tmp/auth", "w") as f: f.write(auth_key) return auth_key
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2019/PlainNote/docker/share/pow.py
ctfs/Balsn/2019/PlainNote/docker/share/pow.py
#!/usr/bin/env python import hashlib import string,random import os import sys prefix = ''.join(random.choice(string.letters+string.digits) for _ in xrange(16)) difficulty = 18 zeros = '0' * difficulty def is_valid(digest): digest = [ord(i) for i in digest] bits = ''.join(bin(i)[2:].zfill(8) for i in digest) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2019/SimpleLanguage/docker/share/wrapper.py
ctfs/Balsn/2019/SimpleLanguage/docker/share/wrapper.py
#!/usr/bin/env python3 import sys import subprocess sys.stdout.write("Payload(hex) :") sys.stdout.flush() payload = sys.stdin.readline().strip() payload_bytes = bytes.fromhex(payload) p = subprocess.Popen("/home/SimpleLanguage/SimpleLanguage", stdout=subprocess.PIPE, stdin=subprocess.PIPE,stderr=subprocess.PIPE) p.stdi...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2023/misc/pycthon/chall.py
ctfs/Balsn/2023/misc/pycthon/chall.py
#!/usr/bin/python3 -u with open('/home/ctf/flag') as f: flag = f.read() payload = input(">>> ") set_dirty(flag) sandbox() eval(payload)
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Balsn/2023/misc/Matrix/share/chal.py
ctfs/Balsn/2023/misc/Matrix/share/chal.py
#!/usr/local/bin/python3 -u import torch import secrets import hashlib from config import FLAG MAX_QUERY = 4000 SECRET_SCALE_RANGE = (500000, 1000000) PARAM_RANDOM_RANGE = (-999, 999) PARAM_SCALE = 1000 class Model(torch.nn.Module): def __init__(self): super(Model, self).__init__() self.conv1 = to...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false