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/Paradigm/2023/pwn/100percent/challenge.py
ctfs/Paradigm/2023/pwn/100percent/challenge.py
from eth_launchers.pwn_launcher import PwnChallengeLauncher from eth_launchers.team_provider import get_team_provider PwnChallengeLauncher( project_location="project", provider=get_team_provider(), ).run()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/pwn/Enterprise_Blockchain/challenge.py
ctfs/Paradigm/2023/pwn/Enterprise_Blockchain/challenge.py
from anvil_server.database import UserData from anvil_server.socket import ( CreateInstanceRequest, CreateInstanceResponse, UnixClient, ) from eth_abi import abi from eth_launchers.launcher import ETH_RPC_URL from eth_launchers.pwn_launcher import PwnChallengeLauncher from eth_launchers.team_provider import...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/pwn/Enterprise_Blockchain/relayer.py
ctfs/Paradigm/2023/pwn/Enterprise_Blockchain/relayer.py
import json import time import traceback from threading import Thread from anvil_server.database import UserData from eth_abi import abi from eth_launchers.daemon import Daemon from web3 import Web3 from web3.contract.contract import Contract from web3.middleware.signing import construct_sign_and_send_raw_middleware ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/pwn/Skill_Based_Game/challenge.py
ctfs/Paradigm/2023/pwn/Skill_Based_Game/challenge.py
from eth_launchers.pwn_launcher import PwnChallengeLauncher from eth_launchers.team_provider import get_team_provider PwnChallengeLauncher( project_location="project", provider=get_team_provider(), ).run()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/pwn/Black_Sheep/challenge.py
ctfs/Paradigm/2023/pwn/Black_Sheep/challenge.py
import os from typing import Optional from anvil_server.database import UserData from eth_launchers.pwn_launcher import PwnChallengeLauncher from eth_launchers.team_provider import get_team_provider from eth_launchers.utils import deploy def concat_env(a: Optional[str], b: Optional[str]): if not a and not b: ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/pwn/Dai++/challenge.py
ctfs/Paradigm/2023/pwn/Dai++/challenge.py
from anvil_server.socket import ( CreateInstanceRequest, CreateInstanceResponse, UnixClient, ) from eth_launchers.pwn_launcher import PwnChallengeLauncher from eth_launchers.team_provider import get_team_provider from eth_launchers.launcher import ETH_RPC_URL from foundry.anvil import LaunchAnvilInstanceArg...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/pwn/Dai++/project/lib/chainlink/core/gethwrappers/generation/fastgen.py
ctfs/Paradigm/2023/pwn/Dai++/project/lib/chainlink/core/gethwrappers/generation/fastgen.py
#!/usr/bin/env python3 '''Quick-and-dirty (very quick!) compiler and generator of go contract wrappers Usage: {fastgen_dir}/fastgen.py [<pkg_name> ...] DO NOT check in the outputs from this script! Instead, run `go generate` in the parent directory. We are using solc-select for compilation of solidity contracts, and...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/pwn/Hopping_into_Place/challenge.py
ctfs/Paradigm/2023/pwn/Hopping_into_Place/challenge.py
from eth_launchers.pwn_launcher import PwnChallengeLauncher from eth_launchers.team_provider import get_team_provider PwnChallengeLauncher(project_location="project", provider=get_team_provider()).run()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/pwn/Token_Locker/challenge.py
ctfs/Paradigm/2023/pwn/Token_Locker/challenge.py
from anvil_server.database import UserData from eth_account.account import LocalAccount from eth_launchers.pwn_launcher import PwnChallengeLauncher from eth_launchers.team_provider import get_team_provider from eth_launchers.utils import anvil_setCodeFromFile class Challenge(PwnChallengeLauncher): def deploy(self...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/pwn/Suspicious_Charity/watcher.py
ctfs/Paradigm/2023/pwn/Suspicious_Charity/watcher.py
import ast import asyncio import pickle import sys import time import traceback import typing from anvil_server.database import UserData from anvil_server.socket import GetInstanceRequest, UnixClient, UpdateMetadataRequest from eth_account import Account from eth_account.signers.local import LocalAccount from web3 imp...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/pwn/Suspicious_Charity/challenge.py
ctfs/Paradigm/2023/pwn/Suspicious_Charity/challenge.py
from anvil_server.database import UserData from anvil_server.socket import ( CreateInstanceRequest, CreateInstanceResponse, UnixClient, ) from eth_launchers.launcher import ETH_RPC_URL from eth_launchers.pwn_launcher import PwnChallengeLauncher from eth_launchers.team_provider import get_team_provider from ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/pwn/DODONT/challenge.py
ctfs/Paradigm/2023/pwn/DODONT/challenge.py
from eth_launchers.pwn_launcher import PwnChallengeLauncher from eth_launchers.team_provider import get_team_provider PwnChallengeLauncher( project_location="project", provider=get_team_provider(), ).run()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/crypto/Oven/challenge.py
ctfs/Paradigm/2023/crypto/Oven/challenge.py
#!/usr/bin/env python3 from Crypto.Util.number import * import random import os import hashlib FLAG = os.getenv("FLAG", "PCTF{flag}").encode("utf8") FLAG = bytes_to_long(FLAG[5:-1]) assert FLAG.bit_length() < 384 BITS = 1024 def xor(a, b): return bytes([i ^ j for i, j in zip(a, b)]) # This doesn't really matt...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/crypto/Dragon_Tyrant/watcher.py
ctfs/Paradigm/2023/crypto/Dragon_Tyrant/watcher.py
import asyncio import json import sys import time from typing import List import random from anvil_server.database import UserData from anvil_server.socket import GetInstanceRequest, UnixClient from eth_abi import abi from eth_account.signers.local import LocalAccount from eth_launchers.daemon import Daemon from web3 ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2023/crypto/Dragon_Tyrant/challenge.py
ctfs/Paradigm/2023/crypto/Dragon_Tyrant/challenge.py
from anvil_server.socket import ( CreateInstanceRequest, CreateInstanceResponse, UnixClient, ) from eth_launchers.launcher import ETH_RPC_URL from eth_launchers.pwn_launcher import PwnChallengeLauncher from eth_launchers.team_provider import get_team_provider from foundry.anvil import LaunchAnvilInstanceArg...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2022/pwn/just-in-time/deploy/chal.py
ctfs/Paradigm/2022/pwn/just-in-time/deploy/chal.py
import json from pathlib import Path import eth_sandbox from web3 import Web3 def deploy(web3: Web3, deployer_address: str, player_address: str) -> str: rcpt = eth_sandbox.sendTransaction(web3, { "from": deployer_address, "value": Web3.toWei(50, 'ether'), "data": json.loads(Path("compiled...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2022/pwn/rescue/deploy/chal.py
ctfs/Paradigm/2022/pwn/rescue/deploy/chal.py
import json from pathlib import Path import eth_sandbox from web3 import Web3 def deploy(web3: Web3, deployer_address: str, player_address: str) -> str: rcpt = eth_sandbox.sendTransaction(web3, { "from": deployer_address, "value": Web3.toWei(10, 'ether'), "data": json.loads(Path("compiled...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2022/pwn/vanity/deploy/chal.py
ctfs/Paradigm/2022/pwn/vanity/deploy/chal.py
import json from pathlib import Path import eth_sandbox from web3 import Web3 def deploy(web3: Web3, deployer_address: str, player_address: str) -> str: rcpt = eth_sandbox.sendTransaction(web3, { "from": deployer_address, "data": json.loads(Path("compiled/Setup.sol/Setup.json").read_text())["byte...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2022/pwn/cairo-proxy/deploy/chal.py
ctfs/Paradigm/2022/pwn/cairo-proxy/deploy/chal.py
import cairo_sandbox from pathlib import Path from starknet_py.net import AccountClient from starknet_py.contract import Contract from starkware.starknet.public.abi import get_storage_var_address from starkware.starknet.core.os.contract_address.contract_address import calculate_contract_address_from_hash async def ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2022/pwn/hint-finance/deploy/chal.py
ctfs/Paradigm/2022/pwn/hint-finance/deploy/chal.py
import json from pathlib import Path import eth_sandbox from web3 import Web3 def deploy(web3: Web3, deployer_address: str, player_address: str) -> str: rcpt = eth_sandbox.sendTransaction(web3, { "gas": 15_000_000, "from": deployer_address, "value": Web3.toWei(30, 'ether'), "data"...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2022/pwn/merkledrop/deploy/chal.py
ctfs/Paradigm/2022/pwn/merkledrop/deploy/chal.py
import json from pathlib import Path import eth_sandbox from web3 import Web3 def deploy(web3: Web3, deployer_address: str, player_address: str) -> str: rcpt = eth_sandbox.sendTransaction(web3, { "from": deployer_address, "value": Web3.toWei(50, 'ether'), "data": json.loads(Path("compiled...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2022/pwn/stealing-sats/deploy/chal.py
ctfs/Paradigm/2022/pwn/stealing-sats/deploy/chal.py
import json from pathlib import Path import eth_sandbox from web3 import Web3 def deploy(web3: Web3, deployer_address: str, player_address: str) -> str: rcpt = eth_sandbox.sendTransaction(web3, { "from": deployer_address, "data": json.loads(Path("compiled/Setup.sol/Setup.json").read_text())["byte...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2022/pwn/electric-sheep/deploy/chal.py
ctfs/Paradigm/2022/pwn/electric-sheep/deploy/chal.py
import json from pathlib import Path import eth_sandbox from web3 import Web3 def deploy(web3: Web3, deployer_address: str, player_address: str) -> str: rcpt = eth_sandbox.sendTransaction(web3, { "from": deployer_address, "data": json.loads(Path("compiled/Setup.sol/Setup.json").read_text())["byte...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2022/pwn/cairo-auction/deploy/chal.py
ctfs/Paradigm/2022/pwn/cairo-auction/deploy/chal.py
import cairo_sandbox from pathlib import Path from starknet_py.net import AccountClient from starknet_py.contract import Contract from starkware.python.utils import from_bytes async def deploy(client: AccountClient, player_address: int) -> int: print("[+] deploying erc20") erc20_deployment = await Contract.d...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2022/pwn/cairo-auction/contracts/openzeppelin/__init__.py
ctfs/Paradigm/2022/pwn/cairo-auction/contracts/openzeppelin/__init__.py
"""StarkNet/Cairo development toolbelt.""" try: from importlib import metadata as importlib_metadata except ImportError: import importlib_metadata try: __version__ = importlib_metadata.version("openzeppelin-cairo-contracts") except importlib_metadata.PackageNotFoundError: __version__ = None
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2022/pwn/trapdoor/deploy/chal.py
ctfs/Paradigm/2022/pwn/trapdoor/deploy/chal.py
import binascii import os import subprocess import tempfile import json import requests import eth_sandbox from Crypto.Util import number FLAG = os.getenv("FLAG", "PCTF{placeholder}") def new_factorize_action(): def action() -> int: ticket = eth_sandbox.check_ticket(input("ticket please: ")) if ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Paradigm/2022/rev/fun-reversing-challenge/deploy/chal.py
ctfs/Paradigm/2022/rev/fun-reversing-challenge/deploy/chal.py
import json from pathlib import Path import eth_sandbox from web3 import Web3 def deploy(web3: Web3, deployer_address: str, player_address: str) -> str: rcpt = eth_sandbox.sendTransaction(web3, { "from": deployer_address, "data": json.loads(Path("compiled/Setup.sol/Setup.json").read_text())["byte...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BDSec/2023/web/Injection/main.py
ctfs/BDSec/2023/web/Injection/main.py
from flask import Flask, request , render_template import textwrap import sqlite3 import os import hashlib os.environ['FLAG'] ='test{flag}' app = Flask(__name__) @app.route('/login', methods=['POST' , 'GET']) def root_data(): data = request.form if 'username' not in data or 'password' not in data: e...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BDSec/2022/crypto/Dominoes/encrypt.py
ctfs/BDSec/2022/crypto/Dominoes/encrypt.py
#! /usr/bin/python3 def x(a, b): h = "" for i in range(len(a), len(b)): t.push(y(b[i])) return "".join(a) def y(c): a = list(c) for i in range(len(c)): b = c[i] for j in range(i + 1, len(c)): b = chr(ord(b) ^ ord(c[j])) a[i] = b return "".join(a) def z(): flag = open("flag....
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BDSec/2022/crypto/LoopLover/enc.py
ctfs/BDSec/2022/crypto/LoopLover/enc.py
def f(t): c = list(t) for i in range(len(t)): for j in range(i, len(t) - 1): for k in range(j, len(t) - 2): c[k], c[k+1] = c[k+1], c[k] return "".join(c) if __name__ == "__main__": flag = open("flag.txt", "r").read() open("ciphertext.txt", "w").write(f(flag))
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BDSec/2022/web/Jungle_Templating/app.py
ctfs/BDSec/2022/web/Jungle_Templating/app.py
from flask import * app = Flask(__name__) @app.route('/',methods=['GET', 'POST']) def base(): person = "" if request.method == 'POST': if request.form['name']: person = request.form['name'] palte = ''' <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="vi...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2024/misc/Perfect_Score/chall.py
ctfs/bi0sCTF/2024/misc/Perfect_Score/chall.py
import random import os from math import gcd flag = open("flag.txt").read().strip() menu = """ ╔══════════════════════════════════════════════════════════════════════════════╗ ║ ║ ║ 50 shots, hit the spot! ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2024/misc/bfs/test.py
ctfs/bi0sCTF/2024/misc/bfs/test.py
#!/bin/python3 # THIS WOULD BE A TEST INTERPRETER PROGRAMME FOR BRAINF*CK THAT YOU CAN MODIFY AND USE # TO TEST OUT YOUR SOLUTIONS TO THE GIVEN PROBLEMS # THIS IS SIMILAR TO THE REMOTE VERSION BUT IS NOT THE SAME AND THE REMOTE HAS WAY MORE FUNCTIONALITY THAN THE FOLLOWING CODE from time import * import sys import os...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2024/pwn/ezv8/server.py
ctfs/bi0sCTF/2024/pwn/ezv8/server.py
#!/usr/bin/python3 import sys import tempfile import os sys.stdout.write("File size >> ") sys.stdout.flush() size = int(sys.stdin.readline().strip()) if size > 1024*1024: sys.stdout.write("Too large!") sys.stdout.flush() sys.exit(1) sys.stdout.write("Data >> ") sys.stdout.flush() script = sys.stdin.read(s...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2024/pwn/ezv8_revenge/server.py
ctfs/bi0sCTF/2024/pwn/ezv8_revenge/server.py
#!/usr/bin/python3 import sys import tempfile import os sys.stdout.write("File size >> ") sys.stdout.flush() size = int(sys.stdin.readline().strip()) if size > 1024*1024: sys.stdout.write("Too large!") sys.stdout.flush() sys.exit(1) sys.stdout.write("Data >> ") sys.stdout.flush() script = sys.stdin.read(s...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2024/pwn/tallocator/script.py
ctfs/bi0sCTF/2024/pwn/tallocator/script.py
#!/usr/bin/env python3 import os import signal import subprocess import sys import time from random import randint def PoW(l=25): x = randint(2**(l-1), 2**l) g = randint(2**16, 2**18) p = 1306659962906624283786643276295324748495772749536799053189842345721562137197253687939694378092071502566360143204442050...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2024/crypto/daisy_bell/chall.py
ctfs/bi0sCTF/2024/crypto/daisy_bell/chall.py
from Crypto.Util.number import * from FLAG import flag p = getPrime(1024) q = getPrime(1024) n = p*q c = pow(bytes_to_long(flag), 65537, n) print(f"{n = }") print(f"{c = }") print(f"{p>>545 = }") print(f"{pow(q, -1, p) % 2**955 = }") """ n = 13588728652719624755959883276683763133718032506385075564663911572182122683...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2024/crypto/Katyushas_Campervan/chall.py
ctfs/bi0sCTF/2024/crypto/Katyushas_Campervan/chall.py
from Crypto.Util.number import * from random import randint from FLAG import flag p = getPrime(1024) q = getPrime(1024) e = getPrime(132) n = p*q hint = pow(e, -1, (p-1)*(q-1)) hint %= p-1 hint %= 2**892 c = pow(3, int.from_bytes(flag), n**5) * pow(randint(0, n**5), n**4, n**5) % n**5 print(f"{n = }") print(f"{e = }"...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2024/crypto/rr/chall.py
ctfs/bi0sCTF/2024/crypto/rr/chall.py
from Crypto.Util.number import * from FLAG import flag from random import randint flag = bytes_to_long(flag) n = 47299327472187103710372659980514936672753155233324975003597729193323906758848158954477739761319227311435422182719657937995406992560409191124965570708092776980858717651529561401899284851798437230687955224751...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
true
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2024/crypto/challengename/server.py
ctfs/bi0sCTF/2024/crypto/challengename/server.py
from ecdsa.ecdsa import Public_key, Private_key from ecdsa import ellipticcurve from hashlib import md5 import random import os import json flag = open("flag", "rb").read()[:-1] magic = os.urandom(16) p = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff a = ###REDACTED### b = ###REDACTED### G = ###...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2024/web/bad_Notes/src/app.py
ctfs/bi0sCTF/2024/web/bad_Notes/src/app.py
from flask import Flask,render_template,request,session,redirect,Response from flask_caching import Cache import sqlite3 import os from urllib.parse import urlsplit import base64 import uuid cache = Cache() curr_dir = os.path.dirname(os.path.abspath(__file__)) app = Flask(__name__) UPLOAD_FOLDER = os.path.join(curr_d...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2025/crypto/apna_AES/chall.py
ctfs/bi0sCTF/2025/crypto/apna_AES/chall.py
from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad from os import urandom import json key = urandom(16) iv1, iv2 = urandom(16), urandom(16) class AES_APN: def __init__(self): self.key = key def xor(self, a, b): return bytes([x^y for x,y in zip(a,b)]) def encrypt(sel...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2025/crypto/...Like_PRNGS_to_Heaven/chall.py
ctfs/bi0sCTF/2025/crypto/...Like_PRNGS_to_Heaven/chall.py
from tinyec.ec import SubGroup, Curve from RMT import R_MT19937_32bit as special_random from decor import HP, death_message, menu_box, title_drop from Crypto.Util.number import bytes_to_long as b2l from Crypto.Cipher import AES from Crypto.Util.Padding import pad from Crypto.Random.random import getrandbits from hashli...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2025/crypto/...Like_PRNGS_to_Heaven/decor.py
ctfs/bi0sCTF/2025/crypto/...Like_PRNGS_to_Heaven/decor.py
# Place for the brainrot class HP: bars = 20 remaining_health_symbol = "█" lost_health_symbol = "░" color_green = "\033[92m" color_yellow = "\33[33m" color_red = "\033[91m" color_default = "\033[0m" def __init__(self, max_health, current_health, name, health_color): self.max...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2025/crypto/...Like_PRNGS_to_Heaven/RMT.py
ctfs/bi0sCTF/2025/crypto/...Like_PRNGS_to_Heaven/RMT.py
class R_MT19937_32bit: def __init__(self, seed=0): self.f = 1812433253 (self.w, self.n, self.m, self.r) = (32, 624, 397, 31) (self.u, self.s, self.t, self.l)= (11, 7, 15, 18) (self.a, self.b, self.c) = (0x9908b0df, 0x9d2c5680, 0xefc60000) (self.lower, self.upper, self.d) = (0...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2025/crypto/Veiled_XOR/chall.py
ctfs/bi0sCTF/2025/crypto/Veiled_XOR/chall.py
from Crypto.Util.number import getPrime, bytes_to_long n = (p := getPrime(1024)) * (q := getPrime(1024)) print(f"n : {n}\nc : {pow(bytes_to_long(flag), 65537, n)}\nVeil XOR: {p ^ int(bin(q)[2:][::-1], 2)}")
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/bi0sCTF/2025/forensic/Bombardino_Exfilrino/pow.py
ctfs/bi0sCTF/2025/forensic/Bombardino_Exfilrino/pow.py
import re def solve_discrete_log(equation_text): pattern = r'(\d+)\^x mod (\d+) == (\d+)' match = re.search(pattern, equation_text) if not match: print("Could not parse equation. Expected format: base^x mod modulus == target") return None base = int(match.group(1)) modulu...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2021/crypto/Alkaloid_Stream/gen.py
ctfs/perfectblue/pbctf/2021/crypto/Alkaloid_Stream/gen.py
#!/usr/bin/env python3 import random from flag import flag def keygen(ln): # Generate a linearly independent key arr = [ 1 << i for i in range(ln) ] for i in range(ln): for j in range(i): if random.getrandbits(1): arr[j] ^= arr[i] for i in range(ln): for j ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2021/crypto/GoodHash/main.py
ctfs/perfectblue/pbctf/2021/crypto/GoodHash/main.py
#!/usr/bin/env python3 from Crypto.Cipher import AES from Crypto.Util.number import * from flag import flag import json import os import string ACCEPTABLE = string.ascii_letters + string.digits + string.punctuation + " " class GoodHash: def __init__(self, v=b""): self.key = b"goodhashGOODHASH" s...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2021/crypto/Steroid_Stream/gen.py
ctfs/perfectblue/pbctf/2021/crypto/Steroid_Stream/gen.py
#!/usr/bin/env python3 import random from flag import flag def keygen(ln): # Generate a linearly independent key arr = [ 1 << i for i in range(ln) ] for i in range(ln): for j in range(i): if random.getrandbits(1): arr[j] ^= arr[i] for i in range(ln): for j ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2021/crypto/Yet_Another_PRNG/gen.py
ctfs/perfectblue/pbctf/2021/crypto/Yet_Another_PRNG/gen.py
#!/usr/bin/env python3 from Crypto.Util.number import * import random import os from flag import flag def urand(b): return int.from_bytes(os.urandom(b), byteorder='big') class PRNG: def __init__(self): self.m1 = 2 ** 32 - 107 self.m2 = 2 ** 32 - 5 self.m3 = 2 ** 32 - 209 self....
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2021/crypto/Yet_Another_RSA/gen.py
ctfs/perfectblue/pbctf/2021/crypto/Yet_Another_RSA/gen.py
#!/usr/bin/env python3 from Crypto.Util.number import * import random def genPrime(): while True: a = random.getrandbits(256) b = random.getrandbits(256) if b % 3 == 0: continue p = a ** 2 + 3 * b ** 2 if p.bit_length() == 512 and p % 3 == 1 and isPrime(p): ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2021/web/WYSIWYG/web/app.py
ctfs/perfectblue/pbctf/2021/web/WYSIWYG/web/app.py
#!/usr/bin/env python3 import os import socket from flask import Flask from flask import render_template from flask import request from flask_recaptcha import ReCaptcha app = Flask(__name__) app.config["RECAPTCHA_SITE_KEY"] = os.environ["RECAPTCHA_SITE_KEY"] app.config["RECAPTCHA_SECRET_KEY"] = os.environ["RECAPTCH...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2021/web/Vault/web/app.py
ctfs/perfectblue/pbctf/2021/web/Vault/web/app.py
#!/usr/bin/env python3 import os import socket from flask import Flask from flask import render_template from flask import request from flask_caching import Cache from flask_recaptcha import ReCaptcha app = Flask(__name__) app.config["RECAPTCHA_SITE_KEY"] = os.environ["RECAPTCHA_SITE_KEY"] app.config["RECAPTCHA_SE...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2021/web/TBDXSS/app/app.py
ctfs/perfectblue/pbctf/2021/web/TBDXSS/app/app.py
from flask import Flask, request, session, jsonify, Response import json import redis import random import os import time app = Flask(__name__) app.secret_key = os.environ.get("SECRET_KEY", "tops3cr3t") app.config.update( SESSION_COOKIE_SECURE=True, SESSION_COOKIE_HTTPONLY=True, SESSION_COOKIE_SAMESITE='L...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/pwn/babygc/upload.py
ctfs/perfectblue/pbctf/2023/pwn/babygc/upload.py
from pwn import * import sys if len(sys.argv) < 2: print("provide path to js source") raise Exception r = remote("babygc.chal.perfect.blue", 1337) f = open(sys.argv[1],"r") src = f.read() f.close() r.sendlineafter("Your js file size:",str(len(src))) r.sendlineafter(":",src) r.interactive()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/pwn/babygc/wrapper.py
ctfs/perfectblue/pbctf/2023/pwn/babygc/wrapper.py
#!/usr/bin/python3 -u # (script from hitcon..) import atexit import os import random import signal import string import subprocess import sys import tempfile MAX_INPUT = 100 * 1024 TIMEOUT = 120 JSC_PATH = "/home/user/jsc" LIB_PATH = "/home/user/lib/" def main(): size = None try: print(f"Your js file ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/crypto/Blocky-4/Cipher.py
ctfs/perfectblue/pbctf/2023/crypto/Blocky-4/Cipher.py
from GF import GF SBOX, INV_SBOX = dict(), dict() for i in range(3 ** 5): v = GF(23) + (GF(0) if i == 0 else GF(i).inverse()) SBOX[GF(i)] = v INV_SBOX[v] = GF(i) class BlockCipher: def __init__(self, key: bytes, rnd: int): assert len(key) == 9 sks = [GF(b) for b in key] for i i...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/crypto/Blocky-4/task.py
ctfs/perfectblue/pbctf/2023/crypto/Blocky-4/task.py
#!/usr/bin/env python3 import os import signal from Cipher import BlockCipher def handler(_signum, _frame): print("Time out!") exit(0) def get_key(): key = b'' while len(key) < 9: b = os.urandom(1) if b[0] < 243: key += b return key def main(): signal.signal(sig...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/crypto/Blocky-4/GF.py
ctfs/perfectblue/pbctf/2023/crypto/Blocky-4/GF.py
class GF: def __init__(self, value): if type(value) == int: self.value = [(value // (3 ** i)) % 3 for i in range(5)] elif type(value) == list and len(value) == 5: self.value = value else: assert False, "Wrong input to the constructor" def __str__(self...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/crypto/My_ECC_Service/challenge.py
ctfs/perfectblue/pbctf/2023/crypto/My_ECC_Service/challenge.py
from Crypto.Util.number import inverse from hashlib import sha256 import os import signal class NonceGenerator: def __init__(self): self.state = os.urandom(10) self.db = {} def gen(self): self.state = sha256(self.state + b'wow').digest()[:10] key = sha256(self.state).digest...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/crypto/My_ECC_Service2/challenge.py
ctfs/perfectblue/pbctf/2023/crypto/My_ECC_Service2/challenge.py
from Crypto.Util.number import inverse from hashlib import sha256 import os import signal class NonceGenerator: def __init__(self, count): self.state = os.urandom(16) self.count = count self.db = {} def gen(self): new_state = b'' res = [] last = 0 fo...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/crypto/Blocky-5/Cipher.py
ctfs/perfectblue/pbctf/2023/crypto/Blocky-5/Cipher.py
from GF import GF SBOX, INV_SBOX = dict(), dict() for i in range(3 ** 5): v = GF(23) + (GF(0) if i == 0 else GF(i).inverse()) SBOX[GF(i)] = v INV_SBOX[v] = GF(i) class BlockCipher: def __init__(self, key: bytes, rnd: int): assert len(key) == 9 sks = [GF(b) for b in key] for i i...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/crypto/Blocky-5/task.py
ctfs/perfectblue/pbctf/2023/crypto/Blocky-5/task.py
#!/usr/bin/env python3 import os import signal from Cipher import BlockCipher def handler(_signum, _frame): print("Time out!") exit(0) def get_key(): key = b'' while len(key) < 9: b = os.urandom(1) if b[0] < 243: key += b return key def main(): signal.signal(sig...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/crypto/Blocky-5/GF.py
ctfs/perfectblue/pbctf/2023/crypto/Blocky-5/GF.py
class GF: def __init__(self, value): if type(value) == int: self.value = [(value // (3 ** i)) % 3 for i in range(5)] elif type(value) == list and len(value) == 5: self.value = value else: assert False, "Wrong input to the constructor" def __str__(self...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/crypto/Blocky-0/Cipher.py
ctfs/perfectblue/pbctf/2023/crypto/Blocky-0/Cipher.py
from GF import GF SBOX, INV_SBOX = dict(), dict() for i in range(3 ** 5): v = GF(23) + (GF(0) if i == 0 else GF(i).inverse()) SBOX[GF(i)] = v INV_SBOX[v] = GF(i) class BlockCipher: def __init__(self, key: bytes, rnd: int): assert len(key) == 9 sks = [GF(b) for b in key] for i i...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/crypto/Blocky-0/task.py
ctfs/perfectblue/pbctf/2023/crypto/Blocky-0/task.py
#!/usr/bin/env python3 import hashlib import os import signal from Cipher import BlockCipher from GF import GF def handler(_signum, _frame): print("Time out!") exit(0) def get_random_block(): block = b'' while len(block) < 9: b = os.urandom(1) if b[0] < 243: block += b ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/crypto/Blocky-0/GF.py
ctfs/perfectblue/pbctf/2023/crypto/Blocky-0/GF.py
class GF: def __init__(self, value): if type(value) == int: self.value = [(value // (3 ** i)) % 3 for i in range(5)] elif type(value) == list and len(value) == 5: self.value = value else: assert False, "Wrong input to the constructor" def __str__(self...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/web/Makima/cdn/app.py
ctfs/perfectblue/pbctf/2023/web/Makima/cdn/app.py
from flask import * import requests app = Flask(__name__) @app.errorhandler(requests.exceptions.MissingSchema) @app.errorhandler(requests.exceptions.InvalidSchema) def bad_schema(e): return 'no HTTP/S?', 400 @app.errorhandler(requests.exceptions.ConnectionError) def no_connect(e): print("CONNECT ERR") re...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2023/web/XSPS/app/app.py
ctfs/perfectblue/pbctf/2023/web/XSPS/app/app.py
from flask import Flask, request, session, jsonify, Response, make_response, g import json import redis import random import os import binascii import time app = Flask(__name__) app.secret_key = os.environ.get("SECRET_KEY", "tops3cr3t") app.config.update( SESSION_COOKIE_SECURE=False, SESSION_COOKIE_HTTPONLY=T...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/perfectblue/pbctf/2020/blacklist/genfiles.py
ctfs/perfectblue/pbctf/2020/blacklist/genfiles.py
import string, random, os, sys pool = string.ascii_letters + string.digits random.seed(open('/dev/random', 'rb').read(16)) flag_parts = ['F', 'f', 'L', 'l', 'A', 'a', 'G', 'g', '70', '102', '76', '108', '65', '97', '71', '103', '0x46', '0x66', '0x4c', '0x6c', '0x41', '0x61', '0x47', '0x67', 'fl', 'la'...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlackhatMEA/2022/Quals/crypto/UrsaMinor/ursaminor.py
ctfs/BlackhatMEA/2022/Quals/crypto/UrsaMinor/ursaminor.py
#!/usr/local/bin/python # # Polymero # # Imports from Crypto.Util.number import isPrime, getPrime, inverse import hashlib, time, os # Local import FLAG = os.environ.get('FLAG').encode() class URSA: # Upgraded RSA (faster and with cheap key cycling) def __init__(self, pbit, lbit): p, q = self.prime_g...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlackhatMEA/2022/Quals/crypto/NothingUpMySbox/nothingupmysbox.py
ctfs/BlackhatMEA/2022/Quals/crypto/NothingUpMySbox/nothingupmysbox.py
#!/usr/local/bin/python # # Polymero # # Imports import os, time from secrets import randbelow from hashlib import sha256 # Local imports FLAG = os.environ.get('FLAG').encode() class NUMSBOX: def __init__(self, seed, key): self.sbox = self.gen_box('SBOX :: ' + seed) self.pbox = self.gen_box(str(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/4N0NYM0US3/2023/Milk_Road/Python_ZWSP_Browser.py
ctfs/4N0NYM0US3/2023/Milk_Road/Python_ZWSP_Browser.py
# Importing required libraries from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtWebEngineWidgets import * from PyQt5.QtWebEngineCore import * from PyQt5.QtPrintSupport import * import os import sys import webbrowser # Creating main window class class MainWindow(QMainWindo...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/De1CTF/2019/ABJudge/bin/server.py
ctfs/De1CTF/2019/ABJudge/bin/server.py
#! /bin/python from flask import Flask,render_template,request import uuid import os import lorun import multiprocessing app = Flask(__name__) RESULT_STR = [ 'Accepted', 'Presentation Error', 'Time Limit Exceeded', 'Memory Limit Exceeded', 'Wrong Answer', 'Runtime Error', 'Output Limit Exc...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Block/2021/crypto/collatzeral_damage/collatzeral-damage.py
ctfs/Block/2021/crypto/collatzeral_damage/collatzeral-damage.py
# idk just pick some random numbers for that 's box' thing, there might be a couple repeats... stupid_box = [99, 171, 124, 123, 89, 76, 120, 89, 26, 91, 136, 26, 37, 190, 27, 59, 91, 123, 155, 91, 11, 19, 153, 11, 225, 27, 139, 155, 27, 155, 19, 147] def ben_seq(starter): sequence = [] current_step = starter ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Block/2024/crypto/Glitch_in_the_Crypt_Exploiting_Faulty_RSA_Decryption/server.py
ctfs/Block/2024/crypto/Glitch_in_the_Crypt_Exploiting_Faulty_RSA_Decryption/server.py
import os import random from Crypto.Util.number import inverse # RSA public parameters # Corrected modulus n = p * q p = None # Hidden q = None # Hidden n = 30392456691103520456566703629789883376981975074658985351907533566054217142999128759248328829870869523368987496991637114688552687369186479700671810414151842146871...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Block/2024/crypto/Wheres_My_Key/server.py
ctfs/Block/2024/crypto/Wheres_My_Key/server.py
import os import socketserver import json import x25519 from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes HOST_PORT = int(os.environ.get("HOST_PORT", "8000")) FLAG = os.environ.get("FLAG", "flag{this-is-not-the-real-flag}") X25519_KEY_SIZE = 32 class Handler(socketserver.BaseRequestHandle...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Block/2023/crypto/enCRCroach/server.py
ctfs/Block/2023/crypto/enCRCroach/server.py
import hashlib import os import secrets import fastcrc import werkzeug.security from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from flask import Flask, Response, request, send_from_directory app = Flask(__name__) SERVER_KEY = bytes.fromhex(os.environ.get("SERVER_KEY", "")) IV_LEN = 16 #...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/pwn/faster-python/challenge/main.py
ctfs/GDGAlgiers/2022/pwn/faster-python/challenge/main.py
#!/usr/bin/env python3 import cext as module from binascii import unhexlify MAXSIZE = 0x50 class CBytes: def __init__(self, size): b = module.input(size) self.b = b def __len__(self): return module.len(self.b) def print(self): return module.print(self.b) def getsize(max...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/pwn/encryptor/challenge/run_server.py
ctfs/GDGAlgiers/2022/pwn/encryptor/challenge/run_server.py
import socketserver import os import sys import encryptor BUFFER_SIZE = 1024 class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler): allow_reuse_address = True def handle(self): self.request.send( b"choose an option:\n1) Try our fast AES implementation\n2) Try our fast RC4 imp...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/jail/PY_explorer/chall.py
ctfs/GDGAlgiers/2022/jail/PY_explorer/chall.py
#!/usr/local/bin/python3 def customDir(obj, expr): result = dir(obj) print("\n".join(f"{i}] {sub}" for i, sub in enumerate(result))) ind = input("index of next object -> ") if checkInt(ind) and -len(result) <= int(ind) < len(result): try : obj, expr = getattr(obj, result[int(ind)]), exp...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/jail/Type_it/chal.py
ctfs/GDGAlgiers/2022/jail/Type_it/chal.py
#!/usr/bin/env python3 FLAG = "CyberErudites{fake_flag}" BLACKLIST = '"%&\',-/_:;@\\`{|}~*<=>[] \t\n\r' def check(s): return all(ord(x) < 0x7f for x in s) and all(x not in s for x in BLACKLIST) def safe_eval(s, func): if not check(s): print("Input is bad") else: try: print(eva...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/jail/Type_it2/jail.py
ctfs/GDGAlgiers/2022/jail/Type_it2/jail.py
#!/usr/bin/env python3 with open("./flag.txt") as f: FLAG = f.read().strip() BLACKLIST = '"%&\',-/_:;@\\`{|}~*<=>[] \t\n\r\x0b\x0c' OPEN_LIST = '([' CLOSE_LIST = ')]' class BadInput(Exception): pass def check_balanced(s): stack = [] for i in s: if i in OPEN_LIST: stack.append(i)...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/jail/kevin-higgs-the-revenge/challenge/challenge.py
ctfs/GDGAlgiers/2022/jail/kevin-higgs-the-revenge/challenge/challenge.py
#!/usr/bin/env python3 import pickle import pickletools import io import sys BLACKLIST_OPCODES = { "BUILD", "SETITEM", "SETITEMS", "DICT", "EMPTY_DICT", "INST", "OBJ", "NEWOBJ", "EXT1", "EXT2", "EXT4", "EMPTY_SET", "ADDITEMS", "FROZENSET", "NEWOBJ_EX", "...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/crypto/franklin-last-words/main.py
ctfs/GDGAlgiers/2022/crypto/franklin-last-words/main.py
from Crypto.Util.number import bytes_to_long, getStrongPrime from math import gcd from flag import FLAG from Crypto.Random import get_random_bytes def encrypt_message(m): return pow(m,e,N) def advanced_encrypt(a,m): return encrypt_message(pow(a,3,N)+(m << 24)) e = 3 p = getStrongPrime(512) q = getStrongPrime...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/crypto/franklin-last-words/message.py
ctfs/GDGAlgiers/2022/crypto/franklin-last-words/message.py
N = 128704452311502431858930198880251272310127835853066867118127724648453996065794849896361864026440048456920428841973494939542251652347755395656512696329757941393301819624888067640984628166587498928291226622894829126692225620665358415985778838076183290137030890396001916620456369124216429276076622486278042629001 e = 3 ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/crypto/eXORcist/server.py
ctfs/GDGAlgiers/2022/crypto/eXORcist/server.py
#!/usr/bin/env python3 # Crypto challenge of eXORciste import os from flag import FLAG import random def xor(message, key): return ''.join([chr(m^k) for m,k in zip(message, key)] ) def generate_key(length): random_seed = os.urandom(16) key = random_seed * (length //16) + random_seed[:(length % 16)]...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/crypto/Nitro/nitro_server.py
ctfs/GDGAlgiers/2022/crypto/Nitro/nitro_server.py
#!/usr/bin/sage from sage.all import * from nitro import Nitro with open("flag.txt","r") as f: flag = f.readline() assert len(flag)==32 def str2bin(s): return ''.join(bin(ord(i))[2:].zfill(8) for i in s) def main(): print("********** NITRO ORCALE **********") print(" Welcome to the nit...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/crypto/Nitro/nitro.py
ctfs/GDGAlgiers/2022/crypto/Nitro/nitro.py
from sage.all import * class Nitro: f_x = None g_x = None Fp_x = None Fq_x = None hx = None R = None Rq = None Rp = None def __init__(self, N, p, q, d): self.N = N self.p = p self.q = q self.d = d def random_poly(self, N, d1, d2): coef_...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/crypto/The_Messager/main.py
ctfs/GDGAlgiers/2022/crypto/The_Messager/main.py
from Crypto.Util.number import bytes_to_long, getStrongPrime from math import gcd from flag import FLAG from Crypto.Random import get_random_bytes def encrypt(m): return pow(m,e,N) e = 65537 p = getStrongPrime(512) q = getStrongPrime(512) # generate secure keys result = 0 while (result !=1): p = getStro...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/crypto/The_Messager/values.py
ctfs/GDGAlgiers/2022/crypto/The_Messager/values.py
N = 98104793775314212094769435239703971612667878931942709323496314311667226421821897454047455384364608911477616865967419199078405667657976292973268348872702988831334377069809925141829484522654208638838107410232921531587371072553811548927714437673444716295120279177952417246053452081185183736591850104338774924467 e = 655...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/crypto/the_matrix/the_matrix.py
ctfs/GDGAlgiers/2022/crypto/the_matrix/the_matrix.py
import json from os import urandom from Crypto.Hash import SHA256 from Crypto.Cipher import AES from Crypto.Util.Padding import pad from sage.all import * from Crypto.Util.number import getPrime from random import randint p = getPrime(64) def read_matrix(file_name): data = open(file_name, 'r').read().strip() ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/crypto/Eddy/challenge.py
ctfs/GDGAlgiers/2022/crypto/Eddy/challenge.py
from pure25519.basic import (bytes_to_clamped_scalar,scalar_to_bytes, bytes_to_scalar, bytes_to_element, Base) import hashlib, binascii import os def H(m): return hashlib.sha512(m).digest() def publickey(seed): # turn first half of SHA512(seed) into ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/crypto/Eddy/server.py
ctfs/GDGAlgiers/2022/crypto/Eddy/server.py
#!/usr/bin/python3 import sys from challenge import * from Crypto.Util.number import * with open("flag.txt","r") as f: flag = f.read() flag = flag.encode() sk = create_signing_key() pk = create_verifying_key(sk) R_flag,S_flag,e_flag = signature(flag,sk,pk) def start(): print("Welcom to my singing server !...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/web/Pipe_your_way/app.py
ctfs/GDGAlgiers/2022/web/Pipe_your_way/app.py
from pickle import FALSE from flask import Flask, request,render_template from jinja2 import Template app = Flask(__name__) @app.route('/') def home(): return render_template('./index.html') @app.route( '/follow_the_light', methods=['GET']) def F0LL0WM3(): the_light = request.args.get("input", None) if ...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/web/Validator/challenge/app/app.py
ctfs/GDGAlgiers/2022/web/Validator/challenge/app/app.py
import os from flask import Flask, request, redirect, render_template, session, send_from_directory from dotenv import load_dotenv from schema import Schema, And, SchemaError import json load_dotenv() app = Flask(__name__) app.secret_key = os.getenv("SECRET_KEY") app.config["DEBUG"] = os.getenv("FLASK_ENV") == "deve...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/GDGAlgiers/2022/web/Validator/challenge/app/wsgi.py
ctfs/GDGAlgiers/2022/web/Validator/challenge/app/wsgi.py
from app import app if __name__ == "__main__": app.run()
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CYBERGON/2023/rev/Super_Secure_Encryption/encrypt.py
ctfs/CYBERGON/2023/rev/Super_Secure_Encryption/encrypt.py
import sys from algorithm import encrypt def encrypt_file(input_file: str, output_file: str): with open(input_file, 'rb') as infile: data = infile.read() encrypted_data = encrypt(data) with open(output_file, 'wb') as outfile: outfile.write(encrypted_data) print(f"File {input_file} ha...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false
sajjadium/ctf-archives
https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CYBERGON/2023/crypto/EZ_RSA/Crypto3.py
ctfs/CYBERGON/2023/crypto/EZ_RSA/Crypto3.py
from Crypto.Util.number import getStrongPrime, bytes_to_long import re from random import randint flag = open("flag.txt").read() m = bytes_to_long(flag.encode()) p = getStrongPrime(512) q = getStrongPrime(512) n = p*q e = 0x10001 c = pow(m,e,n) num = randint(100,999) p_encode = [] q_encode = [] p_list = re.findall(...
python
MIT
129a3a9fe604443211fa4d493a49630c30689df7
2026-01-05T01:34:13.869332Z
false