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/CakeCTF/2022/web/openbio/service/app.py
ctfs/CakeCTF/2022/web/openbio/service/app.py
import base64 import flask from flask_wtf.csrf import CSRFProtect import hashlib import json import os import re import redis import requests REDIS_HOST = os.getenv('REDIS_HOST', 'redis') REDIS_PORT = int(os.getenv('REDIS_PORT', 6379)) RECAPTCHA_KEY = os.getenv('RECAPTCHA_KEY', '') SALT = os.getenv('SALT', os.urandom(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GCC/2024/misc/Diabolical_Grumpy_Analyst/challenge.py
ctfs/GCC/2024/misc/Diabolical_Grumpy_Analyst/challenge.py
#!/usr/bin/env python3 print("Loading data... Can take 1-2 minutes") import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) import numpy as np import random import pandas as pd import json from secret import FLAG with open("other_dataset_dga.txt", 'r') as file: content = file.read() dg...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GCC/2024/misc/Legerdemain/auto_chall.py
ctfs/GCC/2024/misc/Legerdemain/auto_chall.py
# YAPAMS, Yet Another Pyjail Automated Making Script # Author: Shy # Desc.: Setup a basic pyjail with parameters and special pre-setup code you can set ## πŸ‘‡ SET YOUR PARAMETERS HERE πŸ‘‡ p = { # Filter testing "banned words": ["get","any","all","print","in","char","or","and","len","flag"], "banned char...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GCC/2024/crypto/SuperAES/chall.py
ctfs/GCC/2024/crypto/SuperAES/chall.py
import random from Crypto.Cipher import AES import time import os from flag import flag m = 288493873028852398739253829029106548736 a = int(time.time()) b = a%16 s = random.randint(1,m-1) class LCG: def __init__(self, a, b, m, seed): self.a = a self.b = b self.m = m self.state =...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GCC/2024/crypto/GCC_News/app.py
ctfs/GCC/2024/crypto/GCC_News/app.py
from flask import Flask, render_template, request, redirect, url_for, jsonify import hashlib import base64 import json import time import random import hashlib from Crypto.Util.number import bytes_to_long, isPrime import math app = Flask(__name__) def hash_string_sha256(message): message_bytes = message.encode('u...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GCC/2024/crypto/Too_Many_Leaks/chall.py
ctfs/GCC/2024/crypto/Too_Many_Leaks/chall.py
#!/usr/bin/env python3 from Crypto.Util.number import getStrongPrime import hashlib from secret import flag import os from Crypto.Cipher import AES from Crypto.Util.Padding import pad def encrypt_flag(secret_key): sha1 = hashlib.sha1() sha1.update(str(secret_key).encode('ascii')) key = sha1.digest()[:16] ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/OFPPT/2022/pwn/trickster/game.py
ctfs/OFPPT/2022/pwn/trickster/game.py
import pygame from random import randrange from time import sleep from binascii import unhexlify abc = b'4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a31323' \ b'3343536373839305f2d7b7d' pygame.init() class Game: def __init__(self, dW, dH, caption): ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/OFPPT/2022/crypto/MeetMeInMiddle/challenge.py
ctfs/OFPPT/2022/crypto/MeetMeInMiddle/challenge.py
from random import randint from Crypto.Cipher import AES from Crypto.Util.Padding import pad import json flag = b'OFPPT-CTF{Not_the_real_flag}' def gen_key(option=0): alphabet = b'0123456789abcdef' const = b'0fpptCTF5!@#' key = b'' for i in range(16-len(const)): key += bytes([alphabet[randint(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/OFPPT/2022/crypto/XOR/honey.py
ctfs/OFPPT/2022/crypto/XOR/honey.py
import os FLAG = b'OFPPT-CTF{...REDACTED...}' class HoneyComb: def __init__(self, key): self.vals = [i for i in key] def turn(self): self.vals = [self.vals[-1]] + self.vals[:-1] def encrypt(self, msg): keystream = [] while len(keystream) < len(msg): keystream...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/OFPPT/2022/crypto/RSASmall/beezy.py
ctfs/OFPPT/2022/crypto/RSASmall/beezy.py
#! /usr/bin/env python3 from Crypto.PublicKey import RSA from Crypto.Util.number import bytes_to_long, long_to_bytes key = RSA.generate(4096, e = 5) msg = b"Congrats! Your flag is: OFPPT-CTF{XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}." m = bytes_to_long(msg) print("e = ".format(key.e)) print("n = ".format(key.n)) c = pow...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/DEADFACE/2023/prog/Dead_Drop/deaddrop.py
ctfs/DEADFACE/2023/prog/Dead_Drop/deaddrop.py
# Password recovery: # buA9kvZ=T_A}b[J8l:@ob_tviPZtb_<olOpxkvZ=T_=xju]olOpxkvZ=T_bxlu]olOpxkvZ=QIEE arr = ['empty', 'interest', 'current', 'valuable', 'influence', 'from', 'scolded', 'would', 'got', 'key', 'facility', 'run', 'great', 'tack', 'scent', 'close', 'are', 'a', 'plan', 'counter', 'earth', 'self', 'we', 'sick'...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2021/JunkAV/wrap.py
ctfs/RealWorld/2021/JunkAV/wrap.py
import subprocess from hashlib import sha256 import string import random import base64 import os import signal import sys import time MAX_FILE_SIZE = 1024 * 1024 * 8 WORK_PATH = b'/home/ctf/check/' def rand_str(length): return ''.join(random.choice(string.ascii_letters) for i in range(length)).encode('latin1'...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2024/blockchain/SafeBridge/challenge.py
ctfs/RealWorld/2024/blockchain/SafeBridge/challenge.py
from typing import Dict from eth_abi import abi from ctf_launchers.pwn_launcher import PwnChallengeLauncher from ctf_launchers.types import (DaemonInstanceArgs, LaunchAnvilInstanceArgs, UserData, get_additional_account, get_privileged_web3) from ctf_la...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2024/blockchain/SafeBridge/relayer.py
ctfs/RealWorld/2024/blockchain/SafeBridge/relayer.py
import json import os import time import traceback from threading import Thread import requests from eth_abi import abi from web3 import Web3 from web3.contract.contract import Contract from web3.middleware.signing import construct_sign_and_send_raw_middleware from ctf_launchers.types import (UserData, get_additional...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2024/blockchain/SafeBridge/ctf_launchers/pwn_launcher.py
ctfs/RealWorld/2024/blockchain/SafeBridge/ctf_launchers/pwn_launcher.py
import os import requests from eth_abi import abi from ctf_launchers.launcher import ORCHESTRATOR_HOST, Action, Launcher from ctf_launchers.team_provider import TeamProvider, get_team_provider from ctf_launchers.types import UserData, get_privileged_web3 FLAG = os.getenv("FLAG", "rwctf{flag}") class PwnChallengeLa...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2024/blockchain/SafeBridge/ctf_launchers/launcher.py
ctfs/RealWorld/2024/blockchain/SafeBridge/ctf_launchers/launcher.py
import abc import os import traceback from dataclasses import dataclass from typing import Callable, Dict, List import requests from eth_account.hdaccount import generate_mnemonic from ctf_launchers.team_provider import TeamProvider from ctf_launchers.types import (CreateInstanceRequest, DaemonInstanceArgs, ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2024/blockchain/SafeBridge/ctf_launchers/team_provider.py
ctfs/RealWorld/2024/blockchain/SafeBridge/ctf_launchers/team_provider.py
import abc import os from hashlib import md5 from typing import Optional import requests class TeamProvider(abc.ABC): @abc.abstractmethod def get_team(self) -> Optional[str]: pass class LocalTeamProvider(TeamProvider): def __init__(self, team_id): self.__team_id = team_id def get_t...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2024/blockchain/SafeBridge/ctf_launchers/utils.py
ctfs/RealWorld/2024/blockchain/SafeBridge/ctf_launchers/utils.py
import json import os import subprocess from typing import Dict from web3 import Web3 from web3.types import RPCResponse def deploy( web3: Web3, project_location: str, mnemonic: str, deploy_script: str = "script/Deploy.s.sol:Deploy", env: Dict = {}, ) -> str: anvil_autoImpersonateAccount(web3...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2024/blockchain/SafeBridge/ctf_launchers/__init__.py
ctfs/RealWorld/2024/blockchain/SafeBridge/ctf_launchers/__init__.py
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2024/blockchain/SafeBridge/ctf_launchers/types.py
ctfs/RealWorld/2024/blockchain/SafeBridge/ctf_launchers/types.py
from typing import Dict, NotRequired, Optional, TypedDict from eth_account import Account from eth_account.account import LocalAccount from eth_account.hdaccount import key_from_seed, seed_from_mnemonic from web3 import Web3 DEFAULT_DERIVATION_PATH = "m/44'/60'/0'/0/" class LaunchAnvilInstanceArgs(TypedDict): i...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2024/blockchain/SafeBridge/project/lib/forge-std/scripts/vm.py
ctfs/RealWorld/2024/blockchain/SafeBridge/project/lib/forge-std/scripts/vm.py
#!/usr/bin/env python3 import copy import json import re import subprocess from enum import Enum as PyEnum from typing import Callable from urllib import request VoidFn = Callable[[], None] CHEATCODES_JSON_URL = "https://raw.githubusercontent.com/foundry-rs/foundry/master/crates/cheatcodes/assets/cheatcodes.json" OU...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2024/misc/LLM_sanitizer/main.py
ctfs/RealWorld/2024/misc/LLM_sanitizer/main.py
#!/usr/bin/env python # pip install langchain==0.1.1 langchain-openai==0.0.3 docker==7.0.0 ecdsa==0.18.0 import logging import os import struct import sys import signal import docker from docker.models.containers import Container from langchain.prompts import ChatPromptTemplate from langchain_core.output_parsers impor...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2024/pwn/YouKnowHowToFuzz/chal.py
ctfs/RealWorld/2024/pwn/YouKnowHowToFuzz/chal.py
#!/usr/local/bin/python3 from grammar import Grammar print("define your own rule >> ") your_rule = "" while True: line = input() if line == "<EOF>": break your_rule += line + "\n" rwctf_grammar = Grammar() err = rwctf_grammar.parse_from_string(your_rule) if err > 0: print("Grammer Parse Error...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2024/pwn/hoshmonster/chal.py
ctfs/RealWorld/2024/pwn/hoshmonster/chal.py
from unicorn import Uc, UcError, UC_ARCH_X86, UC_ARCH_ARM64, UC_ARCH_RISCV, UC_MODE_64, UC_MODE_ARM, UC_MODE_RISCV64, UC_PROT_READ, UC_PROT_EXEC, UC_SECOND_SCALE, UC_HOOK_BLOCK from unicorn.x86_const import UC_X86_REG_RAX, UC_X86_REG_RIP from unicorn.arm64_const import UC_ARM64_REG_X0, UC_ARM64_REG_PC from unicorn.risc...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2024/pwn/T_Box/main.py
ctfs/RealWorld/2024/pwn/T_Box/main.py
import sys import subprocess import pathlib import argparse work_dir = pathlib.Path(__file__).parent.absolute() instance_dir = pathlib.Path("/var/run/tbox") class CmdFailed(Exception): pass def build_docker(name: str): cmd = ["docker", "build", "-t", name, work_dir / name] run_cmd(cmd) def run_cmd(ar...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2023/crypto/OKPROOF/setup.py
ctfs/RealWorld/2023/crypto/OKPROOF/setup.py
# -*- coding: utf-8 -*- from setuptools import setup, find_packages with open('README.md') as f: readme = f.read() with open('LICENSE') as f: license = f.read() setup( name='py_ecc', version='1.0.0', description='Elliptic curve crypto in python including secp256k1 and alt_bn128', long_descr...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2023/crypto/OKPROOF/task.py
ctfs/RealWorld/2023/crypto/OKPROOF/task.py
#!/usr/bin/env python3 import signal import socketserver import string import os from secret import flag from py_ecc import bn128 lib = bn128 FQ, FQ2, FQ12, field_modulus = lib.FQ, lib.FQ2, lib.FQ12, lib.field_modulus G1, G2, G12, b, b2, b12, is_inf, is_on_curve, eq, add, double, curve_order, multiply = \ lib.G1, l...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/__init__.py
ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/__init__.py
from . import secp256k1 from . import bn128 from . import optimized_bn128
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/secp256k1/secp256k1.py
ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/secp256k1/secp256k1.py
import hashlib, hmac import sys if sys.version[0] == '2': safe_ord = ord else: safe_ord = lambda x: x # Elliptic curve parameters (secp256k1) P = 2**256 - 2**32 - 977 N = 115792089237316195423570985008687907852837564279074904382605163141518161494337 A = 0 B = 7 Gx = 5506626302227734366957871889516853432625060...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/secp256k1/__init__.py
ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/secp256k1/__init__.py
from .secp256k1 import privtopub, ecdsa_raw_sign, ecdsa_raw_recover, N, P, G
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/optimized_bn128/optimized_curve.py
ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/optimized_bn128/optimized_curve.py
from .optimized_field_elements import FQ2, FQ12, field_modulus, FQ curve_order = 21888242871839275222246405745257275088548364400416034343698204186575808495617 # Curve order should be prime assert pow(2, curve_order, curve_order) == 2 # Curve order should be a factor of field_modulus**12 - 1 assert (field_modulus ** 1...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/optimized_bn128/__init__.py
ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/optimized_bn128/__init__.py
from .optimized_field_elements import field_modulus, FQ, FQP, FQ2, FQ12 from .optimized_curve import add, double, multiply, is_inf, is_on_curve, eq, neg, twist, b, b2, b12, curve_order, G1, G2, G12, normalize from .optimized_pairing import pairing, final_exponentiate
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/optimized_bn128/optimized_field_elements.py
ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/optimized_bn128/optimized_field_elements.py
field_modulus = 21888242871839275222246405745257275088696311157297823662689037894645226208583 FQ12_modulus_coeffs = [82, 0, 0, 0, 0, 0, -18, 0, 0, 0, 0, 0] # Implied + [1] FQ12_mc_tuples = [(i, c) for i, c in enumerate(FQ12_modulus_coeffs) if c] # python3 compatibility try: foo = long except: long = int # Ext...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/optimized_bn128/optimized_pairing.py
ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/optimized_bn128/optimized_pairing.py
from .optimized_curve import double, add, multiply, is_on_curve, neg, twist, b, b2, b12, curve_order, G1, G2, G12, normalize from .optimized_field_elements import FQ2, FQ12, field_modulus, FQ ate_loop_count = 29793968203157093288 log_ate_loop_count = 63 pseudo_binary_encoding = [0, 0, 0, 1, 0, 1, 0, -1, 0, 0, 1, -1, 0...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/bn128/bn128_curve.py
ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/bn128/bn128_curve.py
from .bn128_field_elements import field_modulus, FQ, FQ2, FQ12 curve_order = 21888242871839275222246405745257275088548364400416034343698204186575808495617 # Curve order should be prime assert pow(2, curve_order, curve_order) == 2 # Curve order should be a factor of field_modulus**12 - 1 assert (field_modulus ** 12 - ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/bn128/bn128_pairing.py
ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/bn128/bn128_pairing.py
from .bn128_curve import double, add, multiply, is_on_curve, neg, twist, b, b2, b12, curve_order, G1, G2, G12 from .bn128_field_elements import field_modulus, FQ, FQ2, FQ12 ate_loop_count = 29793968203157093288 log_ate_loop_count = 63 # Create a function representing the line between P1 and P2, # and evaluate it at T...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/bn128/bn128_field_elements.py
ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/bn128/bn128_field_elements.py
import sys sys.setrecursionlimit(10000) # python3 compatibility try: foo = long except: long = int # The prime modulus of the field field_modulus = 21888242871839275222246405745257275088696311157297823662689037894645226208583 # See, it's prime! assert pow(2, field_modulus, field_modulus) == 2 # The modulus o...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/bn128/__init__.py
ctfs/RealWorld/2023/crypto/OKPROOF/py_ecc/bn128/__init__.py
from .bn128_field_elements import field_modulus, FQ, FQP, FQ2, FQ12 from .bn128_curve import add, double, multiply, is_inf, is_on_curve, eq, neg, twist, b, b2, b12, curve_order, G1, G2, G12 from .bn128_pairing import pairing, final_exponentiate
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2022/pwn/secured-java/secured_java.py
ctfs/RealWorld/2022/pwn/secured-java/secured_java.py
#!/usr/bin/env python import os import base64 import tempfile import subprocess SOURCE_FILE = "Main.java" DEP_FILE = "dep.jar" def get_file(filename: str): print(f"Please send me the file {filename}.") content = input("Content: (base64 encoded)") data = base64.b64decode(content) if len(data) > 1024 *...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2022/pwn/flag/flag.py
ctfs/RealWorld/2022/pwn/flag/flag.py
import requests import time url = "http://localhost:5555/action/backdoor" flag_path = "/mnt/flag.txt" def get_flag(path: str): with open(path, 'r') as fp: return fp.read().strip() def check_backdoor(): r = requests.get(url) if r.status_code == 200: resp = r.json() if "status" in...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2022/pwn/QLaaS/main.py
ctfs/RealWorld/2022/pwn/QLaaS/main.py
#!/usr/bin/env python3 import os import sys import base64 import tempfile # pip install qiling==1.4.1 from qiling import Qiling def my_sandbox(path, rootfs): ql = Qiling([path], rootfs) ql.run() def main(): sys.stdout.write('Your Binary(base64):\n') line = sys.stdin.readline() binary = base64.b64...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RealWorld/2022/web/hack_into_skynet/server.py
ctfs/RealWorld/2022/web/hack_into_skynet/server.py
#!/usr/bin/env python3 import flask import psycopg2 import datetime import hashlib from skynet import Skynet app = flask.Flask(__name__, static_url_path='') skynet = Skynet() def skynet_detect(): req = { 'method': flask.request.method, 'path': flask.request.full_path, 'host': flask.reques...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MCTF/2021/Quals/web/Starlights_File_Saver/config.py
ctfs/MCTF/2021/Quals/web/Starlights_File_Saver/config.py
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config(object): SECRET_KEY = os.environ.get("SECRET_KEY") SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") SQLALCHEMY_TRACK_MODIFICATIONS = False UPLOAD_FOLDER = os.path.join(basedir, "uploads") CACHE_TYPE = 'FileSystemC...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MCTF/2021/Quals/web/Starlights_File_Saver/app.py
ctfs/MCTF/2021/Quals/web/Starlights_File_Saver/app.py
from app import app
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MCTF/2021/Quals/web/Starlights_File_Saver/app/models.py
ctfs/MCTF/2021/Quals/web/Starlights_File_Saver/app/models.py
from flask_login import UserMixin from app import db, login from werkzeug.security import generate_password_hash, check_password_hash from dataclasses import dataclass class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(120), index=True, unique=True) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MCTF/2021/Quals/web/Starlights_File_Saver/app/__init__.py
ctfs/MCTF/2021/Quals/web/Starlights_File_Saver/app/__init__.py
from flask import Flask from config import Config from flask_caching import Cache from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager app = Flask(__name__) app.config.from_object(Config) db = SQLAlchemy(app) cache = Cache(app) login = LoginManager(app) from app import routes, models db.create...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MCTF/2021/Quals/web/Starlights_File_Saver/app/routes.py
ctfs/MCTF/2021/Quals/web/Starlights_File_Saver/app/routes.py
import os from flask import redirect, url_for, send_from_directory, escape, jsonify, request from app import app, cache, db from flask_login import login_required, current_user, login_user, logout_user from app.models import User, File from werkzeug.utils import secure_filename @app.route('/api/') def index(): i...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MCTF/2024/Quals/pwn/Achilles/75fbfc64-2398-4f0c-b74b-2f42815ef7ca.py
ctfs/MCTF/2024/Quals/pwn/Achilles/75fbfc64-2398-4f0c-b74b-2f42815ef7ca.py
import sys from keyword import iskeyword from keyword import issoftkeyword from os import environ print( ''' .. . .. .. .x+=:. :**888H: `: .xH"" .uef^" @88> x .d88" x .d88" z` ^% X `8888k XX888 ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MCTF/2023-Junior/Quals/crypto/Outer_space/algorithm.py
ctfs/MCTF/2023-Junior/Quals/crypto/Outer_space/algorithm.py
import random from string import ascii_lowercase, digits FLAG = 'mctf{redacted}' alphabet = digits + ascii_lowercase encrypt_table = {i: v for i, v in enumerate(alphabet)} decrypt_table = {v: i for i, v in enumerate(alphabet)} def encrypt(index: int) -> str: return encrypt_table[index // 36] + encrypt_table[ind...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MCTF/2023-Junior/Quals/web/CatoCloud/main.py
ctfs/MCTF/2023-Junior/Quals/web/CatoCloud/main.py
import os import time import requests from string import ascii_lowercase from itertools import product from flask import * ALPHABET = product(ascii_lowercase, repeat=3) app = Flask(__name__) import utils @app.route('/') def main_page(): return render_template('index.html') @app.route('/upload', methods=['POS...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/MCTF/2023/Quals/rev/Anaconda/anaconda.py
ctfs/MCTF/2023/Quals/rev/Anaconda/anaconda.py
exec(__import__('zlib').decompress(b'x\x9c\xad\x97\xcd\x8e-\xdbq\x9c_\x853\xf2\xc2\x82\x91\xe9\x91\xa0W\x114 e\xda\x96!S\x80\xe0\x81\x1f\xdf\x90NeD\xe4\xaa\x95?u\xcf\x01\xd9gww\xad\x95?\x11_\xec\xde\xf7\xaf\xff\xef\xaf\xff\xfc\xa7?\xfd\xeb\x9f\xff\xcf_\xfe\xfb\x9f\xff\xf0\xe7\x7f\xf8\xe3\x1f\xff\xeb\xff\xfe\xb7\x7f\xf9...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
true
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CyberLeague/2025/pwn/doublemap/template.py
ctfs/CyberLeague/2025/pwn/doublemap/template.py
#!/usr/bin/env python3 from pwn import * elf = ELF("dist/bo") if args.REMOTE: io = remote("localhost", 8080) else: io = elf.process() io.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CyberLeague/2025/pwn/file_storage/template.py
ctfs/CyberLeague/2025/pwn/file_storage/template.py
#!/usr/bin/env python3 from pwn import * elf = ELF("dist/bo") if args.REMOTE: io = remote("localhost", 8080) else: io = elf.process() io.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CyberLeague/2025/pwn/Buffer_Overflow_1/template.py
ctfs/CyberLeague/2025/pwn/Buffer_Overflow_1/template.py
#!/usr/bin/env python3 from pwn import * elf = ELF("dist/bo") if args.REMOTE: io = remote("localhost", 8080) else: io = elf.process() io.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CyberLeague/2025/pwn/pprotocol/template.py
ctfs/CyberLeague/2025/pwn/pprotocol/template.py
#!/usr/bin/env python3 from pwn import * elf = ELF("dist/bo") if args.REMOTE: io = remote("localhost", 8080) else: io = elf.process() io.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CyberLeague/2025/crypto/Baby_LCG/enc.py
ctfs/CyberLeague/2025/crypto/Baby_LCG/enc.py
from Crypto.Cipher import AES from Crypto.Random.random import getrandbits from Crypto.Util.number import getPrime, long_to_bytes from Crypto.Util.Padding import pad import binascii while True: key = getrandbits(128) mult = getrandbits(128) inc = getrandbits(128) mod = getPrime(128) if key < mod an...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CyberLeague/2025/crypto/one_time_pin/app.py
ctfs/CyberLeague/2025/crypto/one_time_pin/app.py
#!/usr/bin/env python3 import asyncio import logging import random from pathlib import Path logger = logging.basicConfig(level=logging.INFO) HOST = "0.0.0.0" PORT = 10008 FLAG = Path("flag.txt").read_bytes() async def print_prompt(writer: asyncio.StreamWriter): writer.writelines( ( b"Welcom...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2018/simulator/pow.py
ctfs/RCTF/2018/simulator/pow.py
#!/usr/bin/python -u # encoding: utf-8 import random, string, subprocess, os, sys from hashlib import sha256 os.chdir(os.path.dirname(os.path.realpath(__file__))) def proof_of_work(): chal = ''.join(random.choice(string.letters+string.digits) for _ in xrange(16)) print chal sol = sys.stdin.read(4) if...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/magic_sign/task.py
ctfs/RCTF/2022/crypto/magic_sign/task.py
from magic import Magic with open('flag.txt', 'rb') as f: flag = f.read() banner = ''' β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β•šβ–ˆ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/magic_sign/magic.py
ctfs/RCTF/2022/crypto/magic_sign/magic.py
from secrets import randbits from Crypto.Hash import SHAKE256 import re Magic_Latin_Square = [[5, 3, 1, 6, 7, 2, 0, 4], [3, 5, 0, 2, 4, 6, 1, 7], [6, 2, 4, 5, 0, 3, 7, 1], [4, 7, 6, 1, 3, 0, 2, 5], [0, 1, 3, 7, 6, 4, 5, 2], ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/Derek/app/util.py
ctfs/RCTF/2022/crypto/Derek/app/util.py
from Crypto.Cipher import AES def nsplit(s: list, n: int): return [s[k: k + n] for k in range(0, len(s), n)] def aes(data: int, key: bytes) -> int: data = data.to_bytes(16, 'big') E = AES.new(key, AES.MODE_ECB) return int.from_bytes(E.encrypt(data), 'big')
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/Derek/app/task.py
ctfs/RCTF/2022/crypto/Derek/app/task.py
import os from Derek import Derek with open('flag.txt', 'rb') as f: flag = f.read() banner = ''' β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•— β•šβ•β•β•β•β•β• β•šβ•β•...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/Derek/app/LFSR.py
ctfs/RCTF/2022/crypto/Derek/app/LFSR.py
class LFSR(): def __init__(self, init, mask=int.from_bytes(b'RCTF2022Hack4fun', 'big'), length=128): self.init = init self.mask = mask self.lengthmask = 2**(length+1)-1 def next(self): nextdata = (self.init << 1) & self.lengthmask i = self.init & self.mask & self.lengthm...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/Derek/app/Derek.py
ctfs/RCTF/2022/crypto/Derek/app/Derek.py
from LFSR import LFSR from ctypes import c_uint64 from util import aes, nsplit from Crypto.Util.Padding import pad class Derek(): def __init__(self, key, rnd=10): self.key = key self.rnd = rnd self.keys = list() self.generatekeys(self.key) def generatekeys(self, key: bytes) ->...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/guess/chall.py
ctfs/RCTF/2022/crypto/guess/chall.py
from Crypto.Util.number import getPrime, bytes_to_long from random import randint, choices from string import ascii_uppercase, digits import signal with open('flag.txt', 'rb') as f: flag = f.read() signal.alarm(300) q = getPrime(160) while True: key = "rctf_" + "".join(choices(ascii_uppercase + digits, k=15)...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/easyRSA/chall.py
ctfs/RCTF/2022/crypto/easyRSA/chall.py
from Crypto.Util.number import getPrime, inverse, bytes_to_long with open('flag.txt', 'rb') as f: flag = f.read() def v(k): if k == 0: return 2 if k == 1: return r return (r * v(k - 1) - v(k - 2)) % (N * N) def encrypt(m, e, N): c = (1 + m * N) * v(e) % (N * N) return c p ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/IS_THIS_LCG/task/util.py
ctfs/RCTF/2022/crypto/IS_THIS_LCG/task/util.py
def mt2dec(X, n, m): x = 0 for i in range(n): for j in range(n): x = x + int(X[i, j]) * (m ** (i * n + j)) return x
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/IS_THIS_LCG/task/task.py
ctfs/RCTF/2022/crypto/IS_THIS_LCG/task/task.py
""" As we known, LCG is NOT cryptographically secure. So we designed these variants. Prove us wrong! """ from partial_challenge import gen_p1 from curve_challenge import gen_p2 from matrix_challenge import gen_p3 from secret import flag from Crypto.Util.number import bytes_to_long, getStrongPrime from os import urand...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/IS_THIS_LCG/task/matrix_challenge.py
ctfs/RCTF/2022/crypto/IS_THIS_LCG/task/matrix_challenge.py
""" As we known, with some clever arithmetic, we can do fast skipping on LCG. So we designed this challenge! """ from sage.all import * from util import mt2dec def gen_p3(): n, m = 8, next_prime(2^16) A, B, X = [random_matrix(Zmod(m), n, n) for _ in range(3)] for i in range(1337**1337): if i < 10...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/IS_THIS_LCG/task/partial_challenge.py
ctfs/RCTF/2022/crypto/IS_THIS_LCG/task/partial_challenge.py
""" As we known, LCG state can be regained with some given output. But this time we only give partial output each time! """ from sage.all import * from Crypto.Util.number import bytes_to_long, getRandomInteger def gen_p1(): m = 2 ** 1024 a = bytes_to_long(b'Welcome to RCTF 2022') b = bytes_to_long(b'IS_TH...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/IS_THIS_LCG/task/secret.py
ctfs/RCTF/2022/crypto/IS_THIS_LCG/task/secret.py
flag = b'RCTF{----REDACTED----}'
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/crypto/IS_THIS_LCG/task/curve_challenge.py
ctfs/RCTF/2022/crypto/IS_THIS_LCG/task/curve_challenge.py
""" As we known, Linear means vulnerable. So we put LCG on a curve to make it stronger. """ from sage.all import * from Crypto.Util.number import getStrongPrime, getRandomRange def gen_p2(): p = getStrongPrime(1024) A = getRandomRange(p//2, p) B = getRandomRange(p//2, p) assert (4*A**3+27*B**2) % p !...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RCTF/2022/web/filechecker_mini/app/app.py
ctfs/RCTF/2022/web/filechecker_mini/app/app.py
from flask import Flask, request, render_template, render_template_string from waitress import serve import os import subprocess app_dir = os.path.split(os.path.realpath(__file__))[0] app = Flask(__name__) app.config['UPLOAD_FOLDER'] = f'{app_dir}/upload/' @app.route('/', methods=['GET','POST']) def index(): try:...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TRX/2025/crypto/factordb.com/chall.py
ctfs/TRX/2025/crypto/factordb.com/chall.py
from Crypto.Util.number import getPrime, bytes_to_long p,q = getPrime(512), getPrime(512) N = p*q e = 65537 flag = b"TRX{??????????????????????}" print(f"n = {N}") print(f"e = {e}") print(f"c = {pow(bytes_to_long(flag), e, N)}") print(f"leak = {(0x1337 + p + q) ^ (0x1337 * p * q) & (p | 0x1337137)}") # n = 485122406...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TRX/2025/crypto/Vectorial_RSA/challenge.py
ctfs/TRX/2025/crypto/Vectorial_RSA/challenge.py
from Crypto.Util.number import getPrime, bytes_to_long, long_to_bytes, getRandomInteger from Crypto.Util.Padding import pad from Crypto.Cipher import AES import numpy as np import secrets import hashlib import random FLAG = b"TRX{fake_flag_for_testing}" # The great Roman modulus, the foundation of the Pact p = getPri...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TRX/2025/crypto/factor.com/server.py
ctfs/TRX/2025/crypto/factor.com/server.py
import random from Crypto.Util.number import getPrime, bytes_to_long flag = open('flag.txt', 'rb').read().strip() def encrypt_flag(): N = 1 while N.bit_length() < 2048: N *= getPrime(random.randint(1,512)) e = getPrime(random.randint(1024,2048)) c = pow(bytes_to_long(flag), e, N) return N,...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/misc/ZIP_Extractor_3000/src/challenge.py
ctfs/TeamItaly/2023/misc/ZIP_Extractor_3000/src/challenge.py
import os import zipfile import subprocess import hmac, hashlib key = os.environ["KEY"] def cleanup(filename): os.system(f"rm -rf ./files/{filename}.zip") os.system(f"rm -rf ./files/{filename}") def verify_zip(filename): try: s = open(f"./files/{filename}.zip", "rb").read(4) if s != b"P...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/misc/ZIP_Extractor_3000/src/main.py
ctfs/TeamItaly/2023/misc/ZIP_Extractor_3000/src/main.py
#! /usr/bin/env python3 import os from flask import Flask, request from challenge import compute app = Flask(__name__) if not os.path.exists("./files"): os.mkdir("./files") # Fixare path traversal def allowed_file(filename): return "." in filename and filename.rsplit(".", 1)[1].lower() == "zip" @app.route...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/misc/Subarray_Sums_101/server.py
ctfs/TeamItaly/2023/misc/Subarray_Sums_101/server.py
import random import os import signal FLAG = os.environ.get("FLAG", "flag{test_flag}") n = 128 secret = [random.randint(0, 1) for _ in range(n)] queries_results = {} for i in range(0, n): subarray_sum = 0 for j in range(i+1, n+1): subarray_sum += secret[j-1] if subarray_sum in queries_result...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/crypto/Big_RSA/encrypt.py
ctfs/TeamItaly/2023/crypto/Big_RSA/encrypt.py
from Crypto.Util.number import getPrime, getStrongPrime, bytes_to_long from sympy import factorial from random import randint from secret import flag p, q = getStrongPrime(1024), getStrongPrime(1024) def RSAgen(e = None): d = 0 if not e: while(d.bit_length() < 2047): e = getPrime(2047) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/crypto/Duality/chall.py
ctfs/TeamItaly/2023/crypto/Duality/chall.py
from Crypto.Util.number import * from Crypto.Cipher import AES from Crypto.Util.Padding import pad import hashlib import secrets import random FLAG = open('flag.txt','rb').read() class LFSR: def __init__(self, seed): self.state = list(map(int, list(f"{seed:0128b}"))) self.taps = [0, 16, 32, 64, 96,...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/crypto/Scrambled_Pizzeria/pizzeria.py
ctfs/TeamItaly/2023/crypto/Scrambled_Pizzeria/pizzeria.py
#!/usr/bin/python3 import numpy as np import numpy.typing as npt from PIL import Image import os def permutation( img: npt.NDArray[np.uint8], c: npt.NDArray[np.uint64] ) -> npt.NDArray[np.uint8]: height, width = img.shape cm = c[np.arange(max(height, width)) % len(c)] rows = np.argsort(cm[:height]) ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/app.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/app.py
import os import uuid from datetime import datetime from time import sleep from flask import Flask, render_template from utils.models import * SECRET_KEY = os.getenv("SECRET_KEY") DOMAIN = os.getenv("DOMAIN") CHAT_PORT = os.getenv("CHAT_PORT") app = Flask(__name__) app.config["SECRET_KEY"] = SECRET_KEY app.config["S...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/routes/api.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/routes/api.py
import uuid import logging from datetime import datetime from flask import Blueprint, Response, redirect, request, session from functools import wraps from utils.db import db from utils.models import * API_PATH = "/api/v1" bp = Blueprint("api", __name__) # auth wrapper def request_auth(f): @wraps(f) def wrap...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/routes/pages.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/routes/pages.py
import re import uuid import timeago import logging from datetime import datetime from flask import Blueprint, request, session, redirect, render_template from utils.models import * from utils.auth import * DOMAIN = os.getenv("DOMAIN") CHAT_PORT = os.getenv("CHAT_PORT") bp = Blueprint("pages", __name__) @bp.route("/...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/routes/__init__.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/routes/__init__.py
__all__ = ["api", "pages"]
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/utils/db.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/utils/db.py
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/utils/models.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/utils/models.py
from .db import db class User(db.Model): id = db.Column(db.String(36), primary_key=True) username = db.Column(db.String(32), unique=True) password = db.Column(db.String(128)) propic = db.Column(db.String(20)) powTarget = db.Column(db.String(64)) def __repr__(self): return f"<User {self...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/utils/__init__.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/utils/__init__.py
__all__ = ["db", "models", "auth"]
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/utils/auth.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-spaces/utils/auth.py
import os from flask import session, redirect from functools import wraps DOMAIN = os.getenv("DOMAIN") CHAT_PORT = os.getenv("CHAT_PORT") # auth wrapper def request_auth(f): @wraps(f) def wrapper(*args, **kwargs): if "id" not in session: return redirect(f"//chat.{DOMAIN}:{CHAT_PORT}/login?...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/app.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/app.py
import os import uuid from datetime import datetime from flask import Flask from utils.models import * SECRET_KEY = os.getenv("SECRET_KEY") DOMAIN = os.getenv("DOMAIN") CHAT_PORT = os.getenv("CHAT_PORT") SPACES_PORT = os.getenv("SPACES_PORT") ADMIN_PASSWORD = os.getenv("ADMIN_PASSWORD") app = Flask(__name__) app.conf...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/routes/client.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/routes/client.py
import os from flask import Blueprint, session, redirect, render_template from utils.models import * DOMAIN = os.getenv("DOMAIN") SPACES_PORT = os.getenv("SPACES_PORT") bp = Blueprint("client", __name__) @bp.route("/") def index(): return redirect("/login") @bp.route("/logout") def logout(): session.pop("id...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/routes/api.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/routes/api.py
import os import uuid from datetime import datetime from functools import wraps from flask import Blueprint, Response, request, session from argon2.exceptions import VerifyMismatchError from utils.db import db from utils.models import * from hashlib import sha256 import logging API_PATH = "/api/v1" SPACES_PORT = os.ge...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/routes/__init__.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/routes/__init__.py
__all__ = ["api", "client"]
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/utils/socket.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/utils/socket.py
import os from time import sleep from hashlib import sha256 from flask import session, request from flask_socketio import ( emit, send, rooms, SocketIO, join_room, ConnectionRefusedError ) from .models import * from .chatUtils import * CHECKER_TOKEN = os.getenv("CHECKER_TOKEN") socket = Socket...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/utils/db.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/utils/db.py
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() # Database optimizations """@db.event.listens_for(Engine, "connect") def set_sqlite_pragma(dbapi_connection, connection_record): # Uninteresting sqlite optimizations, copied by BeatBuddy cursor = dbapi_connection.cursor() cursor.execute("pragma jou...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/utils/models.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/utils/models.py
from argon2 import PasswordHasher from .db import db ALLOWED_LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!$-.@^_~" PROPIC_BASE = "/static/propic" ALLOWED_PROPICS = [ "cannoli.jpg", "iris.jpg", "pane-e-panelle.jpg", "arancina.jpg", "tofu.png", "tofu-tongue.jpg", ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/utils/chatUtils.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/utils/chatUtils.py
import os import uuid import random import requests from datetime import datetime from flask_socketio import send from .db import * from .models import * def create_message(sender, receiver, msgType, content, room): message = Message( str(uuid.uuid4()), msgType, content, datetime.ut...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/utils/__init__.py
ctfs/TeamItaly/2023/web/Modern_Sicilian_Network/msn-chat/utils/__init__.py
__all__ = ["db", "models", "socket", "chatUtils"]
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TeamItaly/2023/web/Borraccia/challenge/app.py
ctfs/TeamItaly/2023/web/Borraccia/challenge/app.py
from Borraccia import App, render_template, set_status_code app = App(__name__) def index(ctx): return render_template("index.html") def documentation_test(ctx): return render_template("documentation_test.html") def login(ctx): return render_template("login.html") def register(ctx): return render_t...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false