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/Codegate/2022/Quals/crypto/nft/nft_web/account/migrations/0001_initial.py
ctfs/Codegate/2022/Quals/crypto/nft/nft_web/account/migrations/0001_initial.py
# Generated by Django 3.2.1 on 2022-02-04 18:05 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='User', fields=[ ('id', models.BigAutoField(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Codegate/2022/Quals/crypto/nft/nft_web/account/migrations/__init__.py
ctfs/Codegate/2022/Quals/crypto/nft/nft_web/account/migrations/__init__.py
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Codegate/2022/Quals/web/CAFE/bot.py
ctfs/Codegate/2022/Quals/web/CAFE/bot.py
#!/usr/bin/python3 from selenium import webdriver from selenium.webdriver.chrome.options import Options from webdriver_manager.chrome import ChromeDriverManager import time import sys options = webdriver.ChromeOptions() options.add_argument('--headless') options.add_argument('--disable-logging') options.add_argument(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/AccessDenied/2022/crypto/reused_key/resused_key.py
ctfs/AccessDenied/2022/crypto/reused_key/resused_key.py
import os flag = "XXXX" some_simple_text = "YYYY" key = os.urandom(43) def encrypt(plain_text): assert len(plain_text) == len(key) ciphertext = bytearray([a ^ b for a, b in zip(plain_text, key)]) return ciphertext.hex() print(encrypt(flag.encode("utf-8"))) print(encrypt(some_simple_text.encode("utf-8")))...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/AccessDenied/2022/crypto/MITM-2/AES.py
ctfs/AccessDenied/2022/crypto/MITM-2/AES.py
from Crypto.Cipher import AES from binascii import hexlify, unhexlify from hashlib import md5 import os import signal def get_ciphers(keys, iv1, iv2): return [ AES.new(keys[0], mode=AES.MODE_ECB), AES.new(keys[1], mode=AES.MODE_CBC, iv=iv1), AES.new(keys[2], mode=AES.MODE_CBC, iv=iv2) ] def padding(m): retu...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/AccessDenied/2022/crypto/MITM-2/Bob.py
ctfs/AccessDenied/2022/crypto/MITM-2/Bob.py
from AES import encrypt, decrypt, padding from binascii import hexlify, unhexlify from hashlib import md5 import os # Alice and Bob keys are generated by [md5(os.urandom(3)).digest() for _ in rand] flag = b"XXXXXX" # flag keys = [ b'XXXXXXXXXXXXXXXX', b'XXXXXXXXXXXXXXXX' ] msg = b"thank_you_here_is_remaining_part" g...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/AccessDenied/2022/crypto/MITM-2/Alice.py
ctfs/AccessDenied/2022/crypto/MITM-2/Alice.py
from AES import encrypt, decrypt, padding from binascii import hexlify, unhexlify from hashlib import md5 import os flag = b"XXXXXX" msg = b"here_is_my_code!" keys = [ b'XXXXXXXXXXXXXXXX', b'XXXXXXXXXXXXXXXX' ] g = 4189907057051749069212614323485725660347707200547680164474586562789395867582060680287617364837102804440...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/AccessDenied/2022/crypto/Small_key/xor.py
ctfs/AccessDenied/2022/crypto/Small_key/xor.py
import os flag = b"XXXXXX" key = os.urandom(8) cipher_text = b"" for i in range(len(flag)): cipher_text += bytes([flag[i] ^ key[i % 8]]) print(cipher_text.hex()) # flag 763d32726973a23f79373473616ba86a60300e677634f734482a626f6e5ff22e636a327c2f5ff228240123242e6caa23483d6127765fff6d743a61212f38bb
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/AccessDenied/2022/crypto/ECC/chal.py
ctfs/AccessDenied/2022/crypto/ECC/chal.py
import tinyec.ec as ec import tinyec.registry as reg from hashlib import sha256 from random import randint class RNG: def __init__(self, seed): self.state = seed def next(self): self.state = self.state + 1 return self.state def hashInt(msg): h = sha256(msg).digest() retur...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MUST/2023/Quals/rev/a_lot_of_technique/rev.py
ctfs/MUST/2023/Quals/rev/a_lot_of_technique/rev.py
import base64 def encrypt_input(input_str): flag = input_str flag = unknown2(flag, 345345345) flag = unknown1(flag) flag = unknown2(flag, 0) flag = unknown(flag, 18) return flag def check_flag(encrypted_input): return encrypted_input == "HL13Oe5cEdBUwYlKM0hONdROENJsFNvz" def unknown(input...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MUST/2023/Quals/rev/King_And_His_Servant/enc.py
ctfs/MUST/2023/Quals/rev/King_And_His_Servant/enc.py
def encrypt(): message = input("Enter the message you would like to encrypt: ").strip() key = input("Enter the key to encrypt with: ").strip() key_int = sum(ord(char) for char in key) encrypted_message = "" for c in message: if c in alphabet: position = alphabet.find(c) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Pwn2Win/2021/pwn/accessing_the_truth/run.py
ctfs/Pwn2Win/2021/pwn/accessing_the_truth/run.py
#!/usr/bin/python3 -u import random import string import subprocess import tempfile def random_string(n): return ''.join(random.choice(string.ascii_lowercase) for _ in range(n)) def check_pow(bits): r = random_string(10) print(f"hashcash -mb{bits} {r}") solution = input("Solution: \n").strip() if ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Pwn2Win/2021/crypto/A2S/a2s.py
ctfs/Pwn2Win/2021/crypto/A2S/a2s.py
""" This is a slightly modified version of BoppreH's A2S implementation found at at https://github.com/boppreh/AES Follow the original disclaimer __________________________________ This is an exercise in secure symmetric-key encryption, implemented in pure Python (no external libraries needed). Original AES-128 impleme...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Pwn2Win/2021/crypto/A2S/chall.py
ctfs/Pwn2Win/2021/crypto/A2S/chall.py
from a2s import A2S from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad import hashlib from uuid import uuid4 key = uuid4().bytes cipher = A2S(key) p = [] c = [] for _ in range(3): plaintext = uuid4().bytes p.append(plaintext.hex()) ciphertext = cipher.encrypt_block(plaintext) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Pwn2Win/2021/crypto/t00_rare/run.py
ctfs/Pwn2Win/2021/crypto/t00_rare/run.py
#!/usr/bin/python3 -u import random import string import subprocess def random_string(n): return ''.join(random.choice(string.ascii_lowercase) for _ in range(n)) def check_pow(bits): r = random_string(10) print(f"hashcash -mb{bits} {r}") solution = input("Solution: \n").strip() if subprocess.call(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Pwn2Win/2021/crypto/cladorhizidae/cladorhizidae.py
ctfs/Pwn2Win/2021/crypto/cladorhizidae/cladorhizidae.py
rate_size = 2 capacity_size = 14 block_size = 4 state_size = rate_size + capacity_size blank_rounds = 6 # This file contains functions of BoppreH's A2S implementation found at at https://github.com/boppreh/AES s_box = ( 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Pwn2Win/2021/crypto/cladorhizidae/chall.py
ctfs/Pwn2Win/2021/crypto/cladorhizidae/chall.py
#!/usr/bin/python3 from uuid import uuid4 from cladorhizidae import hmac def main(): k = uuid4().bytes user_ID = uuid4().bytes token = hmac(k, user_ID) flag = open('flag.txt').read() print("This is a valid user_ID: ", user_ID.hex()) print("This is the corresponding access token: ", token.hex...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Pwn2Win/2018/SuperStorage/wrap.py
ctfs/Pwn2Win/2018/SuperStorage/wrap.py
#!/usr/bin/python -u from os import system print('Welcome to the Super Storage.') print('Tell me where and what to store. Exit with "end".') system("/home/super_storage/super_storage") print("Your stuffs were stored! Bye...")
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Pwn2Win/2020/butcher_bmc/run.py
ctfs/Pwn2Win/2020/butcher_bmc/run.py
#!/usr/bin/python3 -u import random import signal import string import subprocess import sys def random_string(n): return ''.join(random.choice(string.ascii_lowercase) for _ in range(n)) def check_pow(bits): r = random_string(10) print(f"hashcash -mb{bits} {r}") solution = input("Solution: \n").strip(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DawgCTF/2021/crypto/What_the_Flip/app.py
ctfs/DawgCTF/2021/crypto/What_the_Flip/app.py
import socketserver import socket, os from Crypto.Cipher import AES from Crypto.Util.Padding import pad,unpad from Crypto.Random import get_random_bytes from binascii import unhexlify from secret import FLAG wlcm_msg ='########################################################################\n'+\ '# ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DawgCTF/2021/crypto/TrashChain/trashchain.py
ctfs/DawgCTF/2021/crypto/TrashChain/trashchain.py
#!/usr/bin/env python3 # Hash constants A = 340282366920938460843936948965011886881 B = 127605873542257115442148455720344860097 # Hash function def H(val, prev_hash, hash_num): return (prev_hash * pow(val + hash_num, B, A) % A) if __name__ == "__main__": # Print welcome message print("Welcome to TrashC...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DawgCTF/2024/crypto/Lost_Key/decrypt.py
ctfs/DawgCTF/2024/crypto/Lost_Key/decrypt.py
from Crypto.Cipher import AES def decrypt_with_aes(key, ciphertext): cipher = AES.new(key, AES.MODE_ECB) plaintext = cipher.decrypt(ciphertext) return plaintext.rstrip(b'\0') def main(): # Read the ciphertext from the file with open("ciphertext.txt", "rb") as f: ciphertext = f.read() ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DawgCTF/2024/crypto/Surely_Secure_ECC/ecc_encrypt.py
ctfs/DawgCTF/2024/crypto/Surely_Secure_ECC/ecc_encrypt.py
import random # Define parameters for secp256k1 curve # Prime modulus of the field over which the curve is defined. The size of the field # determines the difficulty of cryptographic operations. For secp256k1, it is a very large prime number. p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F # ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DawgCTF/2024/crypto/Surely_Secure_ECC_solved_by_1_team/ecc_encrypt.py
ctfs/DawgCTF/2024/crypto/Surely_Secure_ECC_solved_by_1_team/ecc_encrypt.py
import random # Define parameters for secp256k1 curve # Prime modulus of the field over which the curve is defined. The size of the field # determines the difficulty of cryptographic operations. For secp256k1, it is a very large prime number. p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F # ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DawgCTF/2023/rev/DM_the_bot/unclaimed_bot.py
ctfs/DawgCTF/2023/rev/DM_the_bot/unclaimed_bot.py
import discord if __name__ == "__main__": client = discord.Client(intents=discord.Intents.default()) @client.event async def on_ready(): print('We have logged in as {0.user}'.format(client)) klist = ["TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaX","Bpc2NpbmcgZWxpdCwgc2VkIGRvIGVpd...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DawgCTF/2023/rev/DM_the_bot2/bot.py
ctfs/DawgCTF/2023/rev/DM_the_bot2/bot.py
#BY: J4NU5 import discord STRING = 4 START = 22 STOP = 58 if __name__ == "__main__": client = discord.Client(intents=discord.Intents.default()) @client.event async def on_ready(): print('We have logged in as {0.user}'.format(client)) msglist = ["TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DawgCTF/2025/crypto/The_MAC_FAC/server.py
ctfs/DawgCTF/2025/crypto/The_MAC_FAC/server.py
#!/usr/local/bin/python3 from Crypto.Cipher import AES from Crypto.Util.strxor import * from Crypto.Util.number import * from Crypto.Util.Padding import * from secret import flag, xor_key, mac_key, admin_iv, admin_phrase import os banner = """ Welcome to the MAC FAC(tory). Here you can request prototype my secure MAC...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DawgCTF/2025/crypto/Jokesmith/server.py
ctfs/DawgCTF/2025/crypto/Jokesmith/server.py
#!/usr/local/bin/python3 from secret import flag from Crypto.Util.number import * jokes = [ "Why did the prime break up with the modulus? Because it wasn't factoring in its feelings", "Why did the cryptographer bring RSA to the dance? Because it had great curves — wait, no, wrong cryptosystem", "Why did ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DawgCTF/2025/crypto/Guess_Me_If_You_Can/server.py
ctfs/DawgCTF/2025/crypto/Guess_Me_If_You_Can/server.py
#!/usr/local/bin/python3 from Crypto.Util.number import * from secret import flag, init, N, a, b seed = init state = seed current_user = (None, None) accounts = [] notes = dict() menu1 = '''[1] - Register [2] - Login [3] - Manage Notes [4] - List Users [5] - Exit ''' menu2 = '''[1] - Register [2] - Logout [3] - M...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DawgCTF/2025/crypto/Cantors_Pairadox/chall.py
ctfs/DawgCTF/2025/crypto/Cantors_Pairadox/chall.py
from sage.all import sqrt, floor from secret import flag def getTriNumber(n): return n * (n + 1) // 2 # Ensure integer division def pair(n1, n2): S = n1 + n2 return getTriNumber(S) + n2 def pair_array(arr): result = [] for i in range(0, len(arr), 2): result.append(pair(arr[i], arr[i + 1]...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DawgCTF/2025/crypto/Baby_RSA_1/source.py
ctfs/DawgCTF/2025/crypto/Baby_RSA_1/source.py
from Crypto.Util.number import * from sage.all import randint p = getPrime(512) q = getPrime(512) N = p * q e = 0x10001 m = bytes_to_long(b"DawgCTF{fake_flag}") c = pow(m, e, N) print("N =", N) print("e =", e) print("ct =", c) print() a = randint(0, 2**100) b = randint(0, 2**100) c = randint(0, 2**100) d = randin...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DawgCTF/2025/crypto/Baby_RSA_2/chall.py
ctfs/DawgCTF/2025/crypto/Baby_RSA_2/chall.py
from Crypto.Util.number import * from secret import flag # This is my stuff! Don't look at it p = getPrime(512) q = getPrime(512) N = p * q e_priv = 0x10001 phi = (p - 1) * (q - 1) d_priv = inverse(e_priv, phi) m = bytes_to_long(flag) c = pow(m, e_priv, N) # This is your stuff! e_pub = getPrime(16) d_pub = in...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2021/steg/RansomWTF/scramble.py
ctfs/HeroCTF/2021/steg/RansomWTF/scramble.py
import numpy as np import cv2 import sys """ EGGMAN'S RANSOMWARE. I LIKE EGGS, ESPECIALLY SCRAMBLED ONES. LET'S SEE HOW YOU LIKE YOUR SCRAMBLED PICTURES ! """ def scramble(image): # 420 EGGS ! np.random.seed(420) # Image dimensions : 1280x720 to_hide = cv2.imread(image) to_hide_array = np.asarra...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2021/crypto/ExtractMyBlocks/challenge.py
ctfs/HeroCTF/2021/crypto/ExtractMyBlocks/challenge.py
#!/usr/bin/env python3 from os import getenv from Crypto.Cipher import AES BLOCK_SIZE = 16 FLAG = getenv("FLAG") KEY = getenv("KEY") padding = lambda msg: msg + "0" * (BLOCK_SIZE - len(msg) % BLOCK_SIZE) encrypt = lambda plain: AES.new(KEY, AES.MODE_ECB).encrypt(plain).hex() print("[SUPPORT] Password Reset") accoun...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2021/crypto/h4XOR/xor.py
ctfs/HeroCTF/2021/crypto/h4XOR/xor.py
#!/usr/bin/env python3 from os import urandom from random import randint from pwn import xor input_img = open("flag.png", "rb").read() outpout_img = open("flag.png.enc", "wb") key = urandom(8) + bytes([randint(0, 9)]) outpout_img.write(xor(input_img, key))
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2024/misc/Free_Shell/free_shell.py
ctfs/HeroCTF/2024/misc/Free_Shell/free_shell.py
#!/usr/bin/env python3 import os import subprocess print("Welcome to the free shell service!") print("Your goal is to obtain a shell.") command = [ "/bin/sh", input("Choose param: "), os.urandom(32).hex(), os.urandom(32).hex(), os.urandom(32).hex() ] subprocess.run(command)
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2023/crypto/Lossy/chall.py
ctfs/HeroCTF/2023/crypto/Lossy/chall.py
from cryptography.hazmat.primitives.ciphers.algorithms import AES from cryptography.hazmat.primitives.ciphers import Cipher, modes from secret import flag, key assert len(flag) == 32 assert len(key) == 16 # should be equivalent to .hex() (probably) to_hex = lambda x: "".join(hex(k)[2:] for k in x) def encrypt(pt, k...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2023/crypto/Hyper_Loop/hyper_loop.py
ctfs/HeroCTF/2023/crypto/Hyper_Loop/hyper_loop.py
from os import urandom flag = bytearray(b"Hero{????????????}") assert len(flag) == 18 for _ in range(32): for i, c in enumerate(urandom(6) * 3): flag[i] = flag[i] ^ c print(f"{flag = }") """ $ python3 hyper_loop.py flag = bytearray(b'\x05p\x07MS\xfd4eFPw\xf9}%\x05\x03\x19\xe8') """
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2023/crypto/Futile/chall.py
ctfs/HeroCTF/2023/crypto/Futile/chall.py
#!/usr/bin/env python from pylfsr import LFSR from functools import reduce import os flag = os.environ.get('FLAG','Hero{fake_flag}').encode() def binl2int(l: list) -> int: return reduce(lambda x,y: 2*x+y, l) def lfsr() -> LFSR: return LFSR(fpoly=[8,6,5,4], initstate='random') def get_uint8() -> int: ret...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2023/crypto/Uniform/chall.py
ctfs/HeroCTF/2023/crypto/Uniform/chall.py
#!/usr/bin/env python import random import os # TODO: xanhacks told me that this was "too unoriginal" and # that I should change it, lets see how he likes this... # guess = lambda: random.getrandbits(32) guess = lambda: random.uniform(0, 2**32-1) for _ in range(624): print(guess()) secret = str(guess()) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2023/web/Blogodogo_12/config.py
ctfs/HeroCTF/2023/web/Blogodogo_12/config.py
from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager from redis import Redis from secrets import token_hex from os import getenv db = SQLAlchemy() login_manager = LoginManager() redis_client = Redis( host=getenv("REDIS_HOST"), port=int(getenv("REDIS_PORT")), ) class TestConfig: DE...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2023/web/Blogodogo_12/app.py
ctfs/HeroCTF/2023/web/Blogodogo_12/app.py
#!/usr/bin/env python3 from flask import Flask, request, redirect, url_for, flash import lorem from sqlalchemy.exc import IntegrityError import os import random from secrets import token_hex from datetime import datetime from config import TestConfig, db, login_manager from src.routes import bp_routes from src.models...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2023/web/Blogodogo_12/src/models.py
ctfs/HeroCTF/2023/web/Blogodogo_12/src/models.py
from flask_login import UserMixin from werkzeug.security import generate_password_hash, check_password_hash from datetime import datetime from config import db class Authors(db.Model, UserMixin): __tablename__ = "authors" id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(32), ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2023/web/Blogodogo_12/src/utils.py
ctfs/HeroCTF/2023/web/Blogodogo_12/src/utils.py
from datetime import datetime from random import seed, randbytes def generate_hash(timestamp=None): """Generate hash for post preview.""" if timestamp: seed(timestamp) else: seed(int(datetime.now().timestamp())) return randbytes(32).hex()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2023/web/Blogodogo_12/src/__init__.py
ctfs/HeroCTF/2023/web/Blogodogo_12/src/__init__.py
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2023/web/Blogodogo_12/src/routes.py
ctfs/HeroCTF/2023/web/Blogodogo_12/src/routes.py
#!/usr/bin/env python3 from flask import ( Blueprint, render_template, redirect, current_app, flash, url_for, request ) from flask_login import ( login_user, logout_user, login_required, current_user ) from sqlalchemy import and_ import re import os import subprocess from c...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2023/web/Blogodogo_12/src/forms.py
ctfs/HeroCTF/2023/web/Blogodogo_12/src/forms.py
from flask_wtf import FlaskForm from wtforms import ( PasswordField, StringField, BooleanField, TextAreaField, FileField, SubmitField, ValidationError ) from wtforms.validators import DataRequired, EqualTo from src.models import Authors from re import search as re_search class RegisterFo...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2023/web/Simple_Notes/web/src/api.py
ctfs/HeroCTF/2023/web/Simple_Notes/web/src/api.py
from __main__ import app, secret, connect_db from flask import request, session, jsonify from datetime import datetime from uuid import uuid4 import jwt def auth_required(func): def verify(*args, **kwargs): if "logged" in session and "Authorization" in request.headers and request.headers["Authorization"]:...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2023/web/Simple_Notes/web/src/app.py
ctfs/HeroCTF/2023/web/Simple_Notes/web/src/app.py
from flask import Flask, request, redirect, session, render_template, jsonify, g from flask_cors import CORS from subprocess import run from os import urandom from re import match import sqlite3 # Init secret = urandom(32) app = Flask(__name__) # app.config["DEBUG"] = True app.config["SECRET_KEY"] = secret app.config[...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2025/ppc/Whac_A_Mole/template.py
ctfs/HeroCTF/2025/ppc/Whac_A_Mole/template.py
from pwn import * # Adjust depending challenge adress HOST = "localhost" PORT = 8001 io = remote(HOST, PORT) while True: line = io.recvline() if b"IMAGE:" in line: # Read the base64 encoded image b64img = io.recvline().strip() log.info(f"Got image (length {len(b64img)})") # T...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2025/web/Revoked_Revenge/main.py
ctfs/HeroCTF/2025/web/Revoked_Revenge/main.py
import os import secrets import sqlite3 import time from functools import wraps import bcrypt import jwt from dotenv import load_dotenv from flask import ( Flask, flash, jsonify, make_response, redirect, render_template, request, ) app = Flask(__name__) app.static_folder = "static" load_do...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2025/web/Revoked/main.py
ctfs/HeroCTF/2025/web/Revoked/main.py
import os import secrets import sqlite3 import time from functools import wraps import bcrypt import jwt from dotenv import load_dotenv from flask import ( Flask, flash, jsonify, make_response, redirect, render_template, request, ) app = Flask(__name__) app.static_folder = "static" load_do...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2022/crypto/The_oracles_apprentice/chall.py
ctfs/HeroCTF/2022/crypto/The_oracles_apprentice/chall.py
#!/usr/bin/env python3 from Crypto.Util.number import getStrongPrime, bytes_to_long import random FLAG = open('flag.txt','rb').read() encrypt = lambda m: pow(m, e, n) decrypt = lambda c: pow(c, d, n) e = random.randrange(3, 65537, 2) p = getStrongPrime(1024, e=e) q = getStrongPrime(1024, e=e) n = p * q φ = (p-1) * ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2022/crypto/Poly321/encrypt.py
ctfs/HeroCTF/2022/crypto/Poly321/encrypt.py
#!/usr/bin/env python3 FLAG = "****************************" enc = [] for c in FLAG: v = ord(c) enc.append( v + pow(v, 2) + pow(v, 3) ) print(enc) """ $ python3 encrypt.py [378504, 1040603, 1494654, 1380063, 1876119, 1574468, 1135784, 1168755, 1534215, 866495, 1168755, 1534215, 866495, 1657074...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HeroCTF/2022/web/SmallMistakeBigMistake/main.py
ctfs/HeroCTF/2022/web/SmallMistakeBigMistake/main.py
#!/usr/bin/env python from flask import Flask, session, render_template from string import hexdigits from random import choice from os import getenv app = Flask(__name__) app.secret_key = choice(hexdigits) * 32 @app.route("/", methods=["GET"]) def index(): flag = "You are not admin !" if session and sessio...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Codefest/2025/crypto/AES_Decryption_Service/chall.py
ctfs/Codefest/2025/crypto/AES_Decryption_Service/chall.py
import os from Crypto.Cipher import AES from Crypto.Util.Padding import pad FLAG = ? KEY = ? def encryptflag(): cipher = AES.new(KEY, AES.MODE_ECB) ciphertext = cipher.encrypt(pad(FLAG, 16)) return ciphertext.hex() def decrypt(ciphertext, iv): cipher = AES.new(KEY, AES.MODE_CBC, iv) plaintext = c...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2021/pwn/flattened/chall.py
ctfs/BuckeyeCTF/2021/pwn/flattened/chall.py
#!/usr/bin/env python3 import qiling import pwn import subprocess import capstone.x86_const pwn.context.arch = "amd64" dump = [] def code_hook(ql, address, size): global dump buf = ql.mem.read(address, size) for i in md.disasm(buf, address): allowed_syscalls = {1, 0x3c} if ( c...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2021/pwn/guess-god/pow.py
ctfs/BuckeyeCTF/2021/pwn/guess-god/pow.py
#!/usr/bin/env python3 # This is from kCTF (modified to remove backdoor) # https://github.com/google/kctf/blob/69bf578e1275c9223606ab6f0eb1e69c51d0c688/docker-images/challenge/pow.py # -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not u...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2021/pwn/guess-god/server.py
ctfs/BuckeyeCTF/2021/pwn/guess-god/server.py
import hashlib import random import string import socket from socketserver import ThreadingTCPServer, StreamRequestHandler from multiprocessing import TimeoutError from multiprocessing.pool import ThreadPool import threading import subprocess import os import base64 from pathlib import Path import shutil import request...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2021/rev/Neurotic/src.py
ctfs/BuckeyeCTF/2021/rev/Neurotic/src.py
import torch from torch import nn import numpy as np from functools import reduce import base64 class NeuralNetwork(nn.Module): def __init__(self): super(NeuralNetwork, self).__init__() self.stack = nn.Sequential(*([nn.Linear(8, 8, bias=False)] * 7)) def forward(self, x): x = self.sta...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2021/crypto/Elliptigo/chall.py
ctfs/BuckeyeCTF/2021/crypto/Elliptigo/chall.py
from Crypto.Cipher import AES from Crypto.Util.Padding import pad from Crypto.Util.number import size, long_to_bytes import os import hashlib from collections import namedtuple FLAG = b"buckeye{???????????????????}" Point = namedtuple("Point", ("x", "z")) Curve = namedtuple("Curve", ("a", "b")) p = 2 ** 255 - 19 C =...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2021/crypto/Super_VDF/chall.py
ctfs/BuckeyeCTF/2021/crypto/Super_VDF/chall.py
from gmpy2 import is_prime, mpz from random import SystemRandom rand = SystemRandom() PRIMES = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53] def get_prime(bit_length): while True: x = mpz(1) while x.bit_length() < bit_length: x *= rand.choice(PRIMES) if is_prime...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2021/crypto/Key_exchange_2/server.py
ctfs/BuckeyeCTF/2021/crypto/Key_exchange_2/server.py
import random import hashlib # Mac/Linux: pip3 install pycryptodome # Windows: py -m pip install pycryptodome import Crypto.Util.number as cun from Crypto.Cipher import AES rand = random.SystemRandom() FLAG = b"buckeye{???????????????????????????????????????}" def diffie_hellman(message: bytes): p = cun.getPrim...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2021/crypto/Key_exchange/server.py
ctfs/BuckeyeCTF/2021/crypto/Key_exchange/server.py
import random import hashlib # Mac/Linux: pip3 install pycryptodome # Windows: py -m pip install pycryptodome import Crypto.Util.number as cun from Crypto.Cipher import AES rand = random.SystemRandom() FLAG = b"buckeye{???????????????????????????????????????????????????????}" def diffie_hellman(message: bytes): ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2021/crypto/Pseudo/chall.py
ctfs/BuckeyeCTF/2021/crypto/Pseudo/chall.py
#!/usr/bin/env python3 import random import os rand = random.SystemRandom() FLAG = b"buckeye{?????????????????????}" def is_prime(n, rounds=32): return all(pow(rand.randrange(2, n), n - 1, n) == 1 for _ in range(rounds)) class RNG: def __init__(self, p: int, a: int): self.p = p self.a = a ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2021/crypto/Defective_RSA/chall.py
ctfs/BuckeyeCTF/2021/crypto/Defective_RSA/chall.py
from Crypto.Util.number import getPrime, inverse, bytes_to_long e = 1440 p = getPrime(1024) q = getPrime(1024) n = p * q flag = b"buckeye{???????????????????????????????}" c = pow(bytes_to_long(flag), e, n) print(f"e = {e}") print(f"p = {p}") print(f"q = {q}") print(f"c = {c}") # e = 1440 # p = 1086258553037766495...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2021/web/jupyter/app/server.py
ctfs/BuckeyeCTF/2021/web/jupyter/app/server.py
import uvicorn from fastapi import FastAPI, File, Query import os from pathlib import Path import subprocess import requests UPLOADS_DIR = Path(os.environ["UPLOADS_DIR"]) APP_URL = os.environ["APP_URL"] BOT_URL = os.environ["BOT_URL"] BOT_TOKEN = os.environ["BOT_TOKEN"] app = FastAPI() @app.post("/upload_ipynb/") ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2021/web/tesseract/app.py
ctfs/BuckeyeCTF/2021/web/tesseract/app.py
import os from flask import ( Flask, flash, request, redirect, url_for, Blueprint, current_app, render_template_string, send_from_directory, ) from werkzeug.utils import secure_filename import subprocess from dotenv import load_dotenv load_dotenv() main = Blueprint("main", __name__...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2021/web/sozu/app/server.py
ctfs/BuckeyeCTF/2021/web/sozu/app/server.py
from flask import Flask, request, abort, Response, jsonify, Blueprint, render_template import os app = Flask(__name__) internal = Blueprint('internal', __name__) public = Blueprint('public', __name__) @internal.route('/') def internal_home(): return render_template("internal/home.html") @internal.route('/flag'...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2024/misc/fixpoint/fixpoint.py
ctfs/BuckeyeCTF/2024/misc/fixpoint/fixpoint.py
import base64 standard_alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' # alphabet = standard_alphabet # fixed_point = "Vm0wd2QyUXlVWGxWV0d4V1YwZDRWMVl3WkRSV01WbDNXa1JTVjAxV2JETlhhMUpUVmpBeFYySkVUbGhoTVVwVVZtcEJlRll5U2tWVWJHaG9UVlZ3VlZadGNFSmxSbGw1VTJ0V1ZXSkhhRzlVVmxaM1ZsWmFkR05GU214U2JHd...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2024/crypto/xnor/xnor.py
ctfs/BuckeyeCTF/2024/crypto/xnor/xnor.py
import os def xnor_bit(a_bit, b_bit): if a_bit == "1" and b_bit == "1": return "1" elif a_bit == "1" and b_bit == "0": return "0" elif a_bit == "0" and b_bit == "1": return "0" elif a_bit == "0" and b_bit == "0": return "1" def xnor_byte(a_byte, b_byte): a_bits = ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2024/crypto/zkwarmup/zkwarmup.py
ctfs/BuckeyeCTF/2024/crypto/zkwarmup/zkwarmup.py
from math import gcd import random import time from flag import flag class Verifier: def __init__(self, y, n): self.y = y self.n = n self.previous_ss = set() self.previous_zs = set() def flip_coin(self) -> int: return random.randrange(2) def verify(self, s, z, b) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2024/crypto/hashbrown/hashbrown.py
ctfs/BuckeyeCTF/2024/crypto/hashbrown/hashbrown.py
import os # pip install pycryptodome from Crypto.Cipher import AES flag = "bctf{????????????????}" secret = os.urandom(16) my_message = "\n".join( [ "Grate the raw potatoes with a cheese grater, place them into a bowl and cover completely with water. Let sit for 10 minutes.", "Drain the grated po...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2024/crypto/rsa/rsa.py
ctfs/BuckeyeCTF/2024/crypto/rsa/rsa.py
import Crypto.Util.number as cun import math message = b"bctf{fake_flag}" m = int.from_bytes(message, "big") p = cun.getPrime(128) q = cun.getPrime(128) e = 65537 n = p * q phi = (p - 1) * (q - 1) d = pow(e, -1, phi) assert (e * d) % phi == 1 assert math.gcd(e, phi) == 1 c = pow(m, e, n) print(f"e = {e}") print(f...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/pwn/flag_sharing/solve_template.py
ctfs/BuckeyeCTF/2023/pwn/flag_sharing/solve_template.py
from instancer.pow import solve_challenge from pwn import * # fill in port number here p_gateway = remote("chall.pwnoh.io", ...) # Solve the proof-of-work if enabled (limits abuse) pow = p_gateway.recvline() if pow.startswith(b"== proof-of-work: enabled =="): p_gateway.recvline() p_gateway.recvline() cha...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/pwn/flag_sharing/bot/bot.py
ctfs/BuckeyeCTF/2023/pwn/flag_sharing/bot/bot.py
import sys if sys.argv[1] == "": with open("flag.txt", "r") as f: flag = f.read() else: flag = sys.argv[1] flag = int.from_bytes(flag.encode(), "little") from pwn import * p = remote("chal", 5000) p.recvuntil(b"----") p.recvline() p.recvuntil(b"----") p.recvline() while flag != 0: match flag & ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/pwn/flag_sharing/instancer/pow.py
ctfs/BuckeyeCTF/2023/pwn/flag_sharing/instancer/pow.py
#!/usr/bin/env python3 # This is from kCTF (modified to remove backdoor) # https://github.com/google/kctf/blob/69bf578e1275c9223606ab6f0eb1e69c51d0c688/docker-images/challenge/pow.py # -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not u...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/pwn/flag_sharing/instancer/server.py
ctfs/BuckeyeCTF/2023/pwn/flag_sharing/instancer/server.py
import hashlib import random import string import socket from socketserver import ThreadingTCPServer, StreamRequestHandler from multiprocessing import TimeoutError from multiprocessing.pool import ThreadPool import threading import subprocess import os, time import base64 from pathlib import Path import shutil import r...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/pwn/chat_app/instancer/pow.py
ctfs/BuckeyeCTF/2023/pwn/chat_app/instancer/pow.py
#!/usr/bin/env python3 # This is from kCTF (modified to remove backdoor) # https://github.com/google/kctf/blob/69bf578e1275c9223606ab6f0eb1e69c51d0c688/docker-images/challenge/pow.py # -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not u...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/pwn/chat_app/instancer/server.py
ctfs/BuckeyeCTF/2023/pwn/chat_app/instancer/server.py
import hashlib import random import string import socket from socketserver import ThreadingTCPServer, StreamRequestHandler from multiprocessing import TimeoutError from multiprocessing.pool import ThreadPool import threading import subprocess import os import time import base64 from pathlib import Path import shutil im...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/rev/Skribl/chal/setup.py
ctfs/BuckeyeCTF/2023/rev/Skribl/chal/setup.py
from setuptools import find_packages, setup setup( name='flaskr', version='1.0.0', packages=find_packages(), include_package_data=True, zip_safe=False, install_requires=[ 'flask', 'Bootstrap-Flask', 'Flask-WTF' ], )
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/rev/Skribl/chal/__init__.py
ctfs/BuckeyeCTF/2023/rev/Skribl/chal/__init__.py
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/rev/Skribl/chal/skribl.py
ctfs/BuckeyeCTF/2023/rev/Skribl/chal/skribl.py
import math import time from flask import Flask, render_template, redirect, url_for, request from flask_bootstrap import Bootstrap5 from flask_wtf import FlaskForm, CSRFProtect from wtforms import StringField, SubmitField from wtforms.validators import DataRequired, Length # Don't try this at home, kids try: from...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/crypto/My_First_Hash/my-first-hash.py
ctfs/BuckeyeCTF/2023/crypto/My_First_Hash/my-first-hash.py
import hashlib from sys import exit flag = '8f163b472e2164f66a5cd751098783f9' str = input("Enter the flag\n") str = hashlib.md5(str.encode()) if str.digest().hex() == flag: print("Congrats! You got the flag!") else: print("Nope. Try again!") exit()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/crypto/Turtle_Tree/util.py
ctfs/BuckeyeCTF/2023/crypto/Turtle_Tree/util.py
import secrets import hashlib empty_node_identifier = b"E" leaf_node_identifier = b"L" def bytes_to_bits(bs: bytes) -> list[int]: bits = [0] * (len(bs) * 8) for i in range(len(bits)): byte_index = i // 8 bit_of_byte = i % 8 bits[i] = int((bs[byte_index] << bit_of_byte) & (1 << 7) > 0)...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/crypto/Turtle_Tree/main.py
ctfs/BuckeyeCTF/2023/crypto/Turtle_Tree/main.py
from merkle_tree import * import json import hashlib import secrets import random from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import ec from cryptography.hazmat.primitives.serialization import ( Encoding, PublicFormat, load_pem_public_key, ) from cryptogr...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/crypto/Turtle_Tree/proof.py
ctfs/BuckeyeCTF/2023/crypto/Turtle_Tree/proof.py
from util import * import hashlib import struct class ProofNode: level: int index: bytes value: bytes | None def hash(self, tree_nonce: bytes) -> bytes: h = b"" if self.value == None: h = hashlib.sha256( empty_node_identifier + tree_nonce ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/crypto/Turtle_Tree/merkle_tree.py
ctfs/BuckeyeCTF/2023/crypto/Turtle_Tree/merkle_tree.py
from __future__ import annotations from abc import ABC, abstractmethod import hashlib import struct import secrets from util import * from proof import * class Node(ABC): parent: Node | None level: int @abstractmethod def hash(self, merkle_tree: MerkleTree) -> bytes: pass class InteriorNode...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/crypto/Rivest_Shamir_Adleman/dist.py
ctfs/BuckeyeCTF/2023/crypto/Rivest_Shamir_Adleman/dist.py
message = b"[REDACTED]" m = int.from_bytes(message, "big") p = 3782335750369249076873452958462875461053 q = 9038904185905897571450655864282572131579 e = 65537 n = p * q et = (p - 1) * (q - 1) d = pow(e, -1, et) c = pow(m, e, n) print(f"e = {e}") print(f"n = {n}") print(f"c = {c}") # OUTPUT: # e = 65537 # n = 341...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/crypto/Real_Smooth/main.py
ctfs/BuckeyeCTF/2023/crypto/Real_Smooth/main.py
from Crypto.Cipher import ChaCha20 from Crypto.Random import get_random_bytes def encrypt(key, nonce, plaintext): chacha = ChaCha20.new(key=key, nonce=nonce) return chacha.encrypt(plaintext) def main(): lines = open("passwords.txt", "rb").readlines() key = get_random_bytes(32) nonce = get_random...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2023/web/Text_Adventure_API/server.py
ctfs/BuckeyeCTF/2023/web/Text_Adventure_API/server.py
#!/usr/local/bin/python import os import io import pickle from flask import Flask, Response, request, jsonify, session from waitress import serve app = Flask(__name__) app.secret_key = os.environ.get("FLASK_SECRET_KEY", "") rooms = { "start": { "description": "You are in a kitchen. There's a table, a cab...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2025/misc/monkeys/monkeys-template.py
ctfs/BuckeyeCTF/2025/misc/monkeys/monkeys-template.py
from pwn import * io = remote("monkeys.challs.pwnoh.io", 1337, ssl=True) io.recvuntil(b"code:\n") io.sendline(b""" function(input) return input .. string.char(0x98) end """) io.sendline(b"EOF") data = io.recvline() + io.recvline() if b"Output bytestring: " in data: output = bytes.fromhex(data.split(b": ")[1]...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2025/rev/Square_Cipher/square_cipher.py
ctfs/BuckeyeCTF/2025/rev/Square_Cipher/square_cipher.py
(lambda x=int(input('> '),16):(all((int(bin(y).translate(str.maketrans('1b','fx')),0)&x).bit_count()==15 for y in[511,261632,1838599,14708792,117670336,133955584,68585259008,35115652612096,246772580483072,1974180643864576,15793445150916608,17979214137393152,9205357638345293824,4713143110832790437888,4731607904558235517...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2025/crypto/nitwit/nitwit.py
ctfs/BuckeyeCTF/2025/crypto/nitwit/nitwit.py
import hashlib import random import ast from math import log from flag import flag """ This implements Winternitz one-time signatures as defined in http://toc.cryptobook.us """ # Define Winternitz parameters v = 256 # maximum bits for message size hash_size = 32 d = 15 # base n_0 = 64 assert (d + 1) ** n_0 == 2**...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2025/crypto/Augury/main.py
ctfs/BuckeyeCTF/2025/crypto/Augury/main.py
import hashlib stored_data = {} def generate_keystream(i): return (i * 3404970675 + 3553295105) % (2 ** 32) def upload_file(): print("Choose a name for your file") name = input() if name in stored_data: print("There is already a file with that name") return print("Remember that yo...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2022/rev/tokenstokens/interact.py
ctfs/BuckeyeCTF/2022/rev/tokenstokens/interact.py
import time import random import subprocess from transformers import AutoTokenizer import os tokenizer = AutoTokenizer.from_pretrained("etokenizer") # tokenize user input x = input('enter ONE command: ') tokens = tokenizer.convert_tokens_to_ids(tokenizer.tokenize(x)) args = [os.path.join(os.getcwd(),'tokenstokens')]...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2022/crypto/TwinPrimeRSA/chall.py
ctfs/BuckeyeCTF/2022/crypto/TwinPrimeRSA/chall.py
import Crypto.Util.number as cun while True: p = cun.getPrime(1024) q = p + 2 if cun.isPrime(q): break n = p * q e = 0x10001 phi = (p - 1) * (q - 1) d = pow(e, -1, phi) FLAG = cun.bytes_to_long(b"buckeye{?????????????????????????????????????????????????????????????}") c = pow(FLAG, e, n) assert ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2022/crypto/QuadPrimeRSA/chall.py
ctfs/BuckeyeCTF/2022/crypto/QuadPrimeRSA/chall.py
import Crypto.Util.number as cun p = cun.getPrime(500) while True: q = cun.getPrime(1024) r = q + 2 if cun.isPrime(r): break s = cun.getPrime(500) n_1 = p * q n_2 = r * s e = 0x10001 d_1 = pow(e, -1, (p - 1) * (q - 1)) d_2 = pow(e, -1, (r - 1) * (s - 1)) FLAG = cun.bytes_to_long(b"buckeye{????...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2022/crypto/fastfor/check_hash.py
ctfs/BuckeyeCTF/2022/crypto/fastfor/check_hash.py
from PIL import Image import numpy def check_hash(fi): image = numpy.asarray(Image.open('static/IMG.png')) submission = numpy.asarray(Image.open(fi)) if image.shape != submission.shape: return False same = numpy.bitwise_xor(image, submission) if (numpy.sum(same) == 0): return False ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BuckeyeCTF/2022/crypto/SSSHIT/chall.py
ctfs/BuckeyeCTF/2022/crypto/SSSHIT/chall.py
import Crypto.Util.number as cun import random import ast def evaluate_polynomial(polynomial: list, x: int, p: int): return ( sum( (coefficient * pow(x, i, p)) % p for i, coefficient in enumerate(polynomial) ) % p ) N_SHARES = 3 def main(): print( f"I wrote ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false