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/0xL4ugh/2024/crypto/RSA_GCD/chall2.py | ctfs/0xL4ugh/2024/crypto/RSA_GCD/chall2.py | import math
from Crypto.Util.number import *
from secret import flag,p,q
from gmpy2 import next_prime
m = bytes_to_long(flag.encode())
n=p*q
power1=getPrime(128)
power2=getPrime(128)
out1=pow((p+5*q),power1,n)
out2=pow((2*p-3*q),power2,n)
eq1 = next_prime(out1)
c = pow(m,eq1,n)
with open('chall2.txt', 'w') as f:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/0xL4ugh/2024/crypto/L4ugh/src/challenge.py | ctfs/0xL4ugh/2024/crypto/L4ugh/src/challenge.py | from Crypto.Util.number import *
from utils import *
Flag = '0xL4ugh{Fak3_Fl@g}'
key = os.urandom(16)
x = random.randint(2**10, 2**20)
seed = "It's (666) the work of the devil..."
print(seed)
d = evilRSA(seed)
d_evil = d >> (int(seed[6:9])//2)
d_good = d % pow(2,int(seed[6:9])//2)
z='''1.d_evil
2.d_good
3.pass d to ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/0xL4ugh/2024/crypto/L4ugh/src/utils.py | ctfs/0xL4ugh/2024/crypto/L4ugh/src/utils.py | from Crypto.Util.number import *
from Crypto.Util.Padding import pad, unpad
from Crypto.Cipher import AES
import os
import random
import json
key = os.urandom(16)
Flag = '0xL4ugh{Fak3_Fl@g}'
max_retries=19
def evilRSA(seed):
d = 1
while d.bit_length() != int(seed[6:9]):
d = getPrime(int(seed[6:9]))
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/0xL4ugh/2024/web/Micro/app.py | ctfs/0xL4ugh/2024/web/Micro/app.py | from flask import Flask, request
import mysql.connector, hashlib
app = Flask(__name__)
# MySQL connection configuration
mysql_host = "127.0.0.1"
mysql_user = "ctf"
mysql_password = "ctf123"
mysql_db = "CTF"
def authenticate_user(username, password):
try:
conn = mysql.connector.connect(
host=m... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SunshineCTF/2021/crypto/MultipleExponents/source.py | ctfs/SunshineCTF/2021/crypto/MultipleExponents/source.py | from Crypto.Util.number import getPrime
from sunshine_secrets import FLAG
p = getPrime(512)
q = getPrime(512)
assert p != q
n = p * q
phi = (p-1) * (q-1)
e1 = getPrime(512)
e2 = getPrime(512)
d1 = pow(e1, -1, phi)
d2 = pow(e2, -1, phi)
f = int(FLAG.encode("utf-8").hex(), 16)
c1 = pow(f, e1, n)
c2 = pow(f, e2, n)
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SunshineCTF/2025/rev/Space_Race/client.py | ctfs/SunshineCTF/2025/rev/Space_Race/client.py | import sys, socket, json, threading, queue, time
import pygame
WIDTH, HEIGHT = 900, 600
BG = (8, 10, 16)
FG = (230, 235, 240)
TRACK_CLR = (40, 40, 48)
FINISH_CLR = (220, 220, 220)
ROVER_CLR = (120, 200, 255)
OBST_CLR = (255, 120, 120)
PX_PER_WU = 2.2
class Net:
def __init__(self, host, port):
self.sock = ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SunshineCTF/2025/crypto/Plutonian_Crypto/main.py | ctfs/SunshineCTF/2025/crypto/Plutonian_Crypto/main.py | #!/usr/bin/env python3
import sys
import time
from binascii import hexlify
from Crypto.Cipher import AES
from Crypto.Util import Counter
from Crypto.Random import get_random_bytes
from ctf_secrets import MESSAGE
KEY = get_random_bytes(16)
NONCE = get_random_bytes(8)
WELCOME = '''
,-.
/ \\
: \\ ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SunshineCTF/2025/crypto/Bits_of_Space/relay.py | ctfs/SunshineCTF/2025/crypto/Bits_of_Space/relay.py | import socket
import struct
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad
from secrets import key
HOST = "0.0.0.0"
PORT = 25401
VALID_DEVICES = {
0x13371337: b"Status Relay\n",
0x1337babe: b"Ground Station Alpha\n",
0xdeadbeef: b"Lunar Relay\n",
0xdeadbabe: b"Restricted Relay\n"
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SunshineCTF/2022/crypto/AESChall/aeschall.py | ctfs/SunshineCTF/2022/crypto/AESChall/aeschall.py | #!/usr/bin/env python
"""
Copyright (C) 2012 Bo Zhu http://about.bozhu.me
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
th... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlazCTF/2023/Maze/challenge.py | ctfs/BlazCTF/2023/Maze/challenge.py | from typing import Dict
from ctf_launchers.pwn_launcher import PwnChallengeLauncher
from ctf_server.types import LaunchAnvilInstanceArgs
class Challenge(PwnChallengeLauncher):
def get_anvil_instances(self) -> Dict[str, LaunchAnvilInstanceArgs]:
return {
"main": self.get_anvil_instance(fork_url... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlazCTF/2023/Rock_Scissor_Paper/challenge.py | ctfs/BlazCTF/2023/Rock_Scissor_Paper/challenge.py | from typing import Dict
from ctf_launchers.pwn_launcher import PwnChallengeLauncher
from ctf_server.types import LaunchAnvilInstanceArgs
class Challenge(PwnChallengeLauncher):
def get_anvil_instances(self) -> Dict[str, LaunchAnvilInstanceArgs]:
return {
"main": self.get_anvil_instance(fork_url... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlazCTF/2023/Lockless_Swap/challenge.py | ctfs/BlazCTF/2023/Lockless_Swap/challenge.py | from typing import Dict
from ctf_launchers.pwn_launcher import PwnChallengeLauncher
from ctf_server.types import LaunchAnvilInstanceArgs
class Challenge(PwnChallengeLauncher):
def get_anvil_instances(self) -> Dict[str, LaunchAnvilInstanceArgs]:
return {
"main": self.get_anvil_instance(fork_url... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlazCTF/2023/Tornado_Crash/challenge.py | ctfs/BlazCTF/2023/Tornado_Crash/challenge.py | from typing import Dict
from ctf_launchers.pwn_launcher import PwnChallengeLauncher
from ctf_server.types import LaunchAnvilInstanceArgs
class Challenge(PwnChallengeLauncher):
def get_anvil_instances(self) -> Dict[str, LaunchAnvilInstanceArgs]:
return {
"main": self.get_anvil_instance(fork_url... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlazCTF/2023/Ketai/challenge.py | ctfs/BlazCTF/2023/Ketai/challenge.py | from typing import Dict
from ctf_launchers.pwn_launcher import PwnChallengeLauncher
from ctf_server.types import LaunchAnvilInstanceArgs
class Challenge(PwnChallengeLauncher):
def get_anvil_instances(self) -> Dict[str, LaunchAnvilInstanceArgs]:
return {
"main": self.get_anvil_instance(fork_url... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlazCTF/2023/Eazy_NFT/challenge.py | ctfs/BlazCTF/2023/Eazy_NFT/challenge.py | from typing import Dict
from ctf_launchers.pwn_launcher import PwnChallengeLauncher
from ctf_server.types import LaunchAnvilInstanceArgs
class Challenge(PwnChallengeLauncher):
def get_anvil_instances(self) -> Dict[str, LaunchAnvilInstanceArgs]:
return {
"main": self.get_anvil_instance(fork_url... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlazCTF/2023/Be_biLlionAireS_Today/challenge.py | ctfs/BlazCTF/2023/Be_biLlionAireS_Today/challenge.py | from typing import Dict
from ctf_launchers.pwn_launcher import PwnChallengeLauncher
from ctf_server.types import (
LaunchAnvilInstanceArgs,
UserData,
get_privileged_web3,
)
from foundry.anvil import anvil_setBalance
MULTISIG = "0x67CA7Ca75b69711cfd48B44eC3F64E469BaF608C"
ADDITIONAL_OWNER1 = "0x6813Eb9362... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlazCTF/2023/Hide_on_Bush/challenge.py | ctfs/BlazCTF/2023/Hide_on_Bush/challenge.py | from typing import Dict
from ctf_launchers.pwn_launcher import PwnChallengeLauncher
from ctf_server.types import (
get_privileged_web3,
DaemonInstanceArgs,
LaunchAnvilInstanceArgs,
UserData,
)
BLOCK_TIME = 12
class Challenge(PwnChallengeLauncher):
def deploy(self, user_data: UserData, mnemonic: st... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BlazCTF/2023/Hide_on_Bush/frontrun-bot/daemon.py | ctfs/BlazCTF/2023/Hide_on_Bush/frontrun-bot/daemon.py | import signal
import subprocess
import sys
from ctf_server.types import UserData, get_privileged_web3, get_additional_account
from ctf_launchers.daemon import Daemon
def exit_handler(signal, frame):
print("Terminating the process")
exit(-1)
class BotDaemon(Daemon):
def __init__(self):
super().__i... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Aero/2021/crypto/boggart/boggart.py | ctfs/Aero/2021/crypto/boggart/boggart.py | #!/usr/bin/env python3.8
from gmpy import next_prime
from random import getrandbits
def bytes_to_long(data):
return int.from_bytes(data, 'big')
class Wardrobe:
@staticmethod
def create_boggarts(fear, danger):
# for each level of danger we're increasing fear
while danger > 0:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Aero/2021/crypto/horcrux/horcrux.py | ctfs/Aero/2021/crypto/horcrux/horcrux.py | #!/usr/bin/env python3.8
from os import urandom
from gmpy2 import next_prime
from random import randrange, getrandbits
from Crypto.Cipher import AES
from fastecdsa.curve import Curve
def bytes_to_long(data):
return int.from_bytes(data, 'big')
def generate_random_point(p):
while True:
a, x, y = (ran... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Aero/2022/pwn/balloon/balloon.py | ctfs/Aero/2022/pwn/balloon/balloon.py | #!/usr/bin/env python3
import os
VERY_NICE = 1337
def execute(payload: str) -> object:
try:
return eval(payload)
except Exception as e:
return f'[-] {e}'
def main() -> None:
os.nice(VERY_NICE)
os.write(1, b'[*] Please, input a payload:\n> ')
payload = os.read(0, 512).decode()... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Aero/2022/crypto/astronaut/astronaut.py | ctfs/Aero/2022/crypto/astronaut/astronaut.py | #!/usr/bin/env python3
import os
import random
from typing import List, Generator
def flight(galaxy: List[int], black_holes: List[int]) -> Generator[int, None, None]:
while True:
yield (
black_holes := black_holes[1:] + [
sum(x * y for x, y in zip(galaxy, black_holes))
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Aero/2022/web/empathy/api/service/providers.py | ctfs/Aero/2022/web/empathy/api/service/providers.py | #!/usr/bin/env python3
import jwt
import typing
import models
import storages
class SessionProvider:
def __init__(self, users: storages.UserStorage, tokens: storages.TokenStorage):
self._users = users
self._tokens = tokens
async def create(self, credentials: models.Credentials) -> typing.Op... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Aero/2022/web/empathy/api/service/storages.py | ctfs/Aero/2022/web/empathy/api/service/storages.py | #!/usr/bin/env python3
import json
import typing
import aioredis
class AbstractStorage:
PREFIX: str = 'prefix'
EXPIRATION: int = 0 # seconds
def __init__(self, storage: aioredis.Redis):
self._storage = storage
async def search(self, key: str) -> typing.Optional[object]:
result = aw... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Aero/2022/web/empathy/api/service/models.py | ctfs/Aero/2022/web/empathy/api/service/models.py | #!/usr/bin/env python3
import pydantic
class User(pydantic.BaseModel):
session: str
username: str
class Note(pydantic.BaseModel):
id: str
text: str
title: str
author: str
class Credentials(pydantic.BaseModel):
username: str = pydantic.Field(..., min_length=5)
password: str = pydan... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Aero/2022/web/empathy/api/service/app.py | ctfs/Aero/2022/web/empathy/api/service/app.py | #!/usr/bin/env python3
import os
import secrets
import fastapi
import fastapi.responses
import aioredis
import models
import storages
import providers
app = fastapi.FastAPI()
redis = aioredis.Redis(host=os.getenv('REDIS_HOST'))
Notes = storages.NoteStorage(redis)
Users = storages.UserStorage(redis)
Tokens = stora... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2021/Quals/pwn/V8_for_dummies_1/connect.py | ctfs/ASIS/2021/Quals/pwn/V8_for_dummies_1/connect.py | #!/usr/bin/python3
import sys
import os
import binascii
import re
import subprocess
import signal
def handler(x, y):
sys.exit(-1)
signal.signal(signal.SIGALRM, handler)
signal.alarm(30)
def gen_filename():
return '/tmp/' + binascii.hexlify(os.urandom(16)).decode('utf-8')
EOF = 'ASIS-CTF'
MAX_SIZE = 10000
d... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2021/Quals/pwn/minimemo/pow.py | ctfs/ASIS/2021/Quals/pwn/minimemo/pow.py | """
i.e.
sha256("????v0iRhxH4SlrgoUd5Blu0") = b788094e2d021fa16f30c83346f3c80de5afab0840750a49a9254c2a73ed274c
Suffix: v0iRhxH4SlrgoUd5Blu0
Hash: b788094e2d021fa16f30c83346f3c80de5afab0840750a49a9254c2a73ed274c
"""
import itertools
import hashlib
import string
table = string.ascii_letters + string.digits + "._"
suff... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2021/Quals/crypto/Warmup/Warmup.py | ctfs/ASIS/2021/Quals/crypto/Warmup/Warmup.py | #!/usr/bin/env python3
from Crypto.Util.number import *
import string
from secret import is_valid, flag
def random_str(l):
rstr = ''
for _ in range(l):
rstr += string.printable[:94][getRandomRange(0, 93)]
return rstr
def encrypt(msg, nbit):
l, p = len(msg), getPrime(nbit)
rstr = random_str(p - l)
msg += rstr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2021/Quals/crypto/LagLeg/LagLeg.py | ctfs/ASIS/2021/Quals/crypto/LagLeg/LagLeg.py | #!/usr/bin/env python3
from Crypto.Util.number import *
from gmpy import *
from math import gcd
from flag import flag
def lag(k, a, n):
s, t = 2, a
if k == 0:
return 2
r = 0
while k % 2 == 0:
r += 1
k //= 2
B = bin(k)[2:]
for b in B:
if b == '0':
t = (s * t - a) % n
s = (s **2 - 2) % n
else:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2021/Quals/crypto/madras/Madras.py | ctfs/ASIS/2021/Quals/crypto/madras/Madras.py | #!/usr/bin/env python3
from Crypto.Util.number import *
from flag import FLAG
def gentuple(nbit):
a, b, c = [getPrime(nbit // 3) for _ in '012']
return a, b, c
def encrypt(msg, params):
a, b, c = params
e, n = 65537, a * b * c
m = bytes_to_long(msg)
assert m < n
enc = pow(m, e, n)
return enc
nbit = 513
a, b... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2021/Quals/web/phphphp/app/run.py | ctfs/ASIS/2021/Quals/web/phphphp/app/run.py | #!/usr/bin/env python3
import secrets
import os
import time
os.chdir("/app")
requestID = secrets.token_hex(16)
os.mkdir(f"./request/{requestID}")
pidPath = f"{os.getcwd()}/request/{requestID}/fpm.pid"
sockPath = f"{os.getcwd()}/request/{requestID}/fpm.sock"
confPath = f"{os.getcwd()}/request/{requestID}/php-fpm.conf"... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2021/Quals/web/phphphp/app/FastCgiClient.py | ctfs/ASIS/2021/Quals/web/phphphp/app/FastCgiClient.py | import socket
import random
import argparse
import sys
from io import BytesIO
PY2 = True if sys.version_info.major == 2 else False
def bchr(i):
if PY2:
return force_bytes(chr(i))
else:
return bytes([i])
def bord(c):
if isinstance(c, int):
return c
else:
return ord(c)
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2021/Quals/web/phphphp/app/app.py | ctfs/ASIS/2021/Quals/web/phphphp/app/app.py | #!/usr/bin/python3
import sys
import time
import FastCgiClient
import re
from os import path,environ,getcwd
readCounter = 0
statusCodeDescs = {
200 : "OK",
405 : "Method Not Allowed",
400 : "Bad request",
412 : "Payload Too Large"
}
def sendResponse(html,statusCode):
buf = ""
buf+= f"HTTP/1.1 {... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2021/Finals/crypto/RAS/ras.py | ctfs/ASIS/2021/Finals/crypto/RAS/ras.py | #!/usr/bin/env python3
from Crypto.Util.number import *
from flag import flag
def genparam(nbit):
while True:
a, b = getRandomRange(2, nbit), getRandomRange(32, nbit)
if (a ** b).bit_length() == nbit:
return a ** b
def genkey(nbit):
p, q = [_ + (_ % 2) for _ in [genparam(nbit) for _ in '01']]
while True:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2023/Quals/pwn/night_js/stuff/run.py | ctfs/ASIS/2023/Quals/pwn/night_js/stuff/run.py | #!/usr/bin/env python3
import tempfile
import pathlib
import os
os.chdir(pathlib.Path(__file__).parent.resolve())
with tempfile.NamedTemporaryFile() as tmp:
print('Send the file: (ended with "\\n-- EOF --\\n"):')
s = input()
while(s != '-- EOF --'):
tmp.write((s+'\n').encode())
s = input()
tmp.flush()
os.clo... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2023/Quals/crypto/Bruce_Lee/bruce_lee.py | ctfs/ASIS/2023/Quals/crypto/Bruce_Lee/bruce_lee.py | #!/usr/bin/env python3
from Crypto.Util.number import *
from gmpy2 import *
from flag import flag
def gen_prime(nbit, density):
while True:
rar = [2 ** getRandomRange(1, nbit - 1) for _ in range(density)]
p = sum(rar) + 2**(nbit - 1) + 2**(nbit - 2) + 1
if isPrime(p):
return p
nbit, density = 1024, getRand... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2023/Quals/crypto/Crand_all/Crand_all.py | ctfs/ASIS/2023/Quals/crypto/Crand_all/Crand_all.py | #!/usr/bin/env python3
from Crypto.Util.number import *
from flag import flag
def gen_prime(nbit):
while True:
p = 0
for i in range(nbit, nbit>>1, -1):
p += getRandomRange(0, 2) * 2 ** i
p += getRandomNBitInteger(nbit>>3)
if isPrime(p):
return p
nbit = 512
p, q, r = [gen_prime(nbit) for _ in '012']
e,... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2023/Quals/crypto/Cognitive/cognitive.py | ctfs/ASIS/2023/Quals/crypto/Cognitive/cognitive.py | #!/usr/bin/env python3
from Crypto.Util.number import *
from random import *
from os import urandom
from flag import flag
hubbub = 3
def mulvec(columns, vec):
c = len(columns)
assert(c == len(vec))
r = len(columns[0])
result = [0 for _ in range(r)]
for i, bit in zip(range(c), vec):
assert(len(columns[... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2023/Quals/crypto/Refactor/refactor.py | ctfs/ASIS/2023/Quals/crypto/Refactor/refactor.py | #!/usr/bin/env python3
from Crypto.Util.number import *
from flag import flag
def pgen(nbit):
x, y = 0, 1
while True:
u, v = getRandomRange(1, 110), getRandomRange(1, 313)
x, y = u * x + 31337 * v * y, v * x - u * y
if x.bit_length() <= nbit // 2 and x.bit_length() <= nbit // 2:
p = x**2 + 31337 * y**2 | 1... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2023/Quals/crypto/Renamiara/renamiara.py | ctfs/ASIS/2023/Quals/crypto/Renamiara/renamiara.py | #!/usr/bin/env python3
from Crypto.Util.number import *
import sys
from flag import flag
def die(*args):
pr(*args)
quit()
def pr(*args):
s = " ".join(map(str, args))
sys.stdout.write(s + "\n")
sys.stdout.flush()
def sc():
return sys.stdin.buffer.readline()
def main():
border = "|"
pr(border*72)
pr(border,... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2023/Finals/pwn/Backdooredness/env/stuff/run.py | ctfs/ASIS/2023/Finals/pwn/Backdooredness/env/stuff/run.py | #!/usr/bin/env python3
import tempfile
import pathlib
import os
import re
import json
import time
if not os.path.exists('/tmp/ips.json'):
f = open('/tmp/ips.json','w')
f.write('{}')
f.close()
ipFile = open('/tmp/ips.json','r+')
peerIp = os.environ['SOCAT_PEERADDR']
ips = {}
ips = json.loads(ipFile.read())
if(peer... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2023/Finals/pwn/isWebP.js/env/stuff/run.py | ctfs/ASIS/2023/Finals/pwn/isWebP.js/env/stuff/run.py | #!/usr/bin/env python3
import tempfile
import pathlib
import os
import re
import json
import time
import signal
if not os.path.exists('/tmp/ips.json'):
f = open('/tmp/ips.json','w')
f.write('{}')
f.close()
ipFile = open('/tmp/ips.json','r+')
peerIp = os.environ['SOCAT_PEERADDR']
ips = {}
ips = json.loads(ipFile.r... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2023/Finals/crypto/Larisa/larisa.py | ctfs/ASIS/2023/Finals/crypto/Larisa/larisa.py | #!/usr/bin/env sage
from Crypto.Util.number import *
from flag import flag
def next_prime(r):
while True:
if isPrime(r):
return r
r += 1
def keygen(nbit):
p = getPrime(nbit // 2)
P, Q = [next_prime(p * getPrime(nbit // 2 - 10)) for _ in '01']
n, K = P * Q, 2 ** (nbit >> 1)
u, y = getRandomRange(1, n), ge... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2023/Finals/crypto/M7P/m7p.py | ctfs/ASIS/2023/Finals/crypto/M7P/m7p.py | #!/usr/bin/env python3
import os
from hashlib import *
from binascii import *
from Crypto.Cipher import AES
from Crypto.Util.number import *
from flag import flag
def next_prime(n):
while True:
if isPrime(n):
return n
n += 1
def find(s, ch):
return [i for i, ltr in enumerate(ch) if ltr == s]
def worth(c, m... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2023/Finals/web/Pupptear/deploy.py | ctfs/ASIS/2023/Finals/web/Pupptear/deploy.py | #!/usr/bin/env python3
# socat TCP-LISTEN:2323,reuseaddr,fork EXEC:"./deploy.py"
import tempfile
import pathlib
import os
import string
import time
import random
import atexit
import json
import re
if not os.path.exists('/tmp/ips.json'):
f = open('/tmp/ips.json','w')
f.write('{}')
f.close()
ipFile = open('/tmp/ips... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2023/Finals/web/phphphphphp/deploy.py | ctfs/ASIS/2023/Finals/web/phphphphphp/deploy.py | #!/usr/bin/env python3
# socat TCP-LISTEN:2323,reuseaddr,fork EXEC:"./deploy.py"
import tempfile
import pathlib
import os
import string
import time
import random
import atexit
import json
if not os.path.exists('/tmp/ips.json'):
f = open('/tmp/ips.json','w')
f.write('{}')
f.close()
ipFile = open('/tmp/ips.json','r+... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Quals/pwn/readable/deploy.py | ctfs/ASIS/2022/Quals/pwn/readable/deploy.py | #!/usr/bin/env python3
# socat TCP-LISTEN:2323,reuseaddr,fork EXEC:"./deploy.py"
import tempfile
import pathlib
import os
import string
import time
import random
import json
if not os.path.exists('/tmp/ips.json'):
f = open('/tmp/ips.json','w')
f.write('{}')
f.close()
ipFile = open('/tmp/ips.json','r+')
peerIp = os... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Quals/pwn/jsy/stuff/run.py | ctfs/ASIS/2022/Quals/pwn/jsy/stuff/run.py | #!/usr/bin/env python3
import tempfile
import pathlib
import os
os.chdir(pathlib.Path(__file__).parent.resolve())
with tempfile.NamedTemporaryFile() as tmp:
print('Send the file: (ended with "\\n-- EOF --\\n"):')
s = input()
while(s != '-- EOF --'):
tmp.write((s+'\n').encode())
s = input()
tmp.flush()
os.clo... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Quals/pwn/jsy/source/original/genucd.py | ctfs/ASIS/2022/Quals/pwn/jsy/source/original/genucd.py | # Create utfdata.h from UnicodeData.txt
tolower = []
toupper = []
isalpha = []
for line in open("UnicodeData.txt").readlines():
line = line.split(";")
code = int(line[0],16)
# if code > 65535: continue # skip non-BMP codepoints
if line[2][0] == 'L':
isalpha.append(code)
if line[12]:
toupper.append((code,int(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Quals/pwn/jsy/source/challenge/genucd.py | ctfs/ASIS/2022/Quals/pwn/jsy/source/challenge/genucd.py | # Create utfdata.h from UnicodeData.txt
tolower = []
toupper = []
isalpha = []
for line in open("UnicodeData.txt").readlines():
line = line.split(";")
code = int(line[0],16)
# if code > 65535: continue # skip non-BMP codepoints
if line[2][0] == 'L':
isalpha.append(code)
if line[12]:
toupper.append((code,int(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Quals/crypto/mariana/mariana.py | ctfs/ASIS/2022/Quals/crypto/mariana/mariana.py | #!/usr/bin/env python3
from Crypto.Util.number import *
import sys
from flag import flag
def die(*args):
pr(*args)
quit()
def pr(*args):
s = " ".join(map(str, args))
sys.stdout.write(s + "\n")
sys.stdout.flush()
def sc():
return sys.stdin.buffer.readline()
def main():
border = "|"
pr(border*72)
pr(border,... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Quals/crypto/mindseat_updated/mindseat_updated.py | ctfs/ASIS/2022/Quals/crypto/mindseat_updated/mindseat_updated.py | #!/usr/bin/env python3
from Crypto.Util.number import *
from secret import params, flag
def keygen(nbit, k): # Pubkey function
_p = 1
while True:
p, q = [_p + (getRandomNBitInteger(nbit - k) << k) for _ in '01']
if isPrime(p) and isPrime(q):
while True:
s = getRandomRange(2, p * q)
if pow(s, (p - 1) ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Quals/crypto/chaffymasking/chaffymasking.py | ctfs/ASIS/2022/Quals/crypto/chaffymasking/chaffymasking.py | #!/usr/bin/env python3
import numpy as np
import binascii
import os, sys
from flag import FLAG
def die(*args):
pr(*args)
quit()
def pr(*args):
s = " ".join(map(str, args))
sys.stdout.write(s + "\n")
sys.stdout.flush()
def sc():
return sys.stdin.buffer.readline()
def pad(inp, length):
result = inp + os.uran... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Quals/crypto/binned/binned.py | ctfs/ASIS/2022/Quals/crypto/binned/binned.py | #!/usr/bin/env python3
from Crypto.Util.number import *
from gensafeprime import *
from flag import flag
def keygen(nbit):
p, q = [generate(nbit) for _ in range(2)]
return (p, q)
def encrypt(m, pubkey):
return pow(pubkey + 1, m, pubkey ** 3)
p, q = keygen(512)
n = p * q
flag = bytes_to_long(flag)
enc = encrypt(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Quals/web/xtr/deploy.py | ctfs/ASIS/2022/Quals/web/xtr/deploy.py | #!/usr/bin/env python3
# socat TCP-LISTEN:2323,reuseaddr,fork EXEC:"./deploy.py"
import os
import re
import json
import time
import subprocess
if not os.path.exists('/tmp/ips.json'):
f = open('/tmp/ips.json','w')
f.write('{}')
f.close()
ipFile = open('/tmp/ips.json','r+')
peerIp = os.environ['SOCAT_PEERADDR']
ips... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Quals/web/hugeblog/app.py | ctfs/ASIS/2022/Quals/web/hugeblog/app.py | #!/usr/bin/env python
from Crypto.Cipher import AES
from flask_session import Session
import base64
import datetime
import flask
import glob
import hashlib
import io
import json
import os
import re
import zipfile
app = flask.Flask(__name__)
app.secret_key = os.urandom(16)
app.encryption_key = os.urandom(16)
app.config... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Quals/web/firewalled/flag-container/stuff/app.py | ctfs/ASIS/2022/Quals/web/firewalled/flag-container/stuff/app.py | #!/usr/bin/env python3
from flask import Flask,request
import requests
import json
import os
app = Flask(__name__)
application = app
flag = os.environ.get('FLAG')
@app.route('/flag')
def index():
args = request.args.get('args')
try:
r = requests.post('http://firewalled-curl/req',json=json.loads(args)).json()
i... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Quals/web/firewalled/firewalled-curl/stuff/app.py | ctfs/ASIS/2022/Quals/web/firewalled/firewalled-curl/stuff/app.py | #!/usr/bin/env python3
from flask import Flask,Response,request
import time
import socket
import re
import base64
import json
isSafeAscii = lambda s : not re.search(r'[^\x20-\x7F]',s)
isSafeHeader = lambda s : isSafeAscii(s)
isSafePath = lambda s : s[0] == '/' and isSafeAscii(s) and ' ' not in s
badHeaderNames = ['enc... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Quals/web/beginner-duck/main.py | ctfs/ASIS/2022/Quals/web/beginner-duck/main.py | #!/usr/bin/env python3
from flask import Flask,request,Response
import random
import re
app = Flask(__name__)
availableDucks = ['duckInABag','duckLookingAtAHacker','duckWithAFreeHugsSign']
indexTemplate = None
flag = None
@app.route('/duck')
def retDuck():
what = request.args.get('what')
duckInABag = './images/e146... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Finals/pwn/readable-v2/deploy.py | ctfs/ASIS/2022/Finals/pwn/readable-v2/deploy.py | #!/usr/bin/env python3
# socat TCP-LISTEN:2323,reuseaddr,fork EXEC:"./deploy.py"
import tempfile
import pathlib
import os
import string
import time
import random
import json
if not os.path.exists('/tmp/ips.json'):
f = open('/tmp/ips.json','w')
f.write('{}')
f.close()
ipFile = open('/tmp/ips.json','r+')
peerIp = os... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Finals/pwn/permissions/deploy.py | ctfs/ASIS/2022/Finals/pwn/permissions/deploy.py | #!/usr/bin/env python3
# socat TCP-LISTEN:2323,reuseaddr,fork EXEC:"./deploy.py"
import os
import re
import json
import time
import subprocess
if not os.path.exists('/tmp/ips.json'):
f = open('/tmp/ips.json','w')
f.write('{}')
f.close()
ipFile = open('/tmp/ips.json','r+')
peerIp = os.environ[... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Finals/pwn/jry/stuff/run.py | ctfs/ASIS/2022/Finals/pwn/jry/stuff/run.py | #!/usr/bin/env python3
import tempfile
import pathlib
import os
os.chdir(pathlib.Path(__file__).parent.resolve())
with tempfile.NamedTemporaryFile() as tmp:
print('Send the file: (ended with "\\n-- EOF --\\n"):')
s = input()
while(s != '-- EOF --'):
tmp.write((s+'\n').encode())
s = input()
tmp.flush()
os.clo... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Finals/crypto/rhyton/rhyton.py | ctfs/ASIS/2022/Finals/crypto/rhyton/rhyton.py | #!/usr/bin/env python3
from Crypto.Util.number import *
from flag import flag
def gen_rhyton(nbit, delta, L):
p, q = [getPrime(nbit) for _ in '01']
n = p * q
D = int(n ** (1 - delta))
phi = (p - 1) * (q - 1)
V = [getRandomRange(1, n - 1) for _ in range(L)]
U = [phi * v // n for v in V]
W, i = [], 0
while ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2022/Finals/crypto/bedouin/bedouin.py | ctfs/ASIS/2022/Finals/crypto/bedouin/bedouin.py | #!/usr/bin/env python3
from Crypto.Util.number import *
from secret import nbit, l, flag
def genbed(nbit, l):
while True:
zo = bin(getPrime(nbit))[2:]
OZ = zo * l + '1'
if isPrime(int(OZ)):
return int(OZ)
p, q = [genbed(nbit, l) for _ in '01']
n = p * q
d = 1 ^ l ** nbit << 3 ** 3
phi = (p - 1) * (q - 1)
e... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2020/Quals/safari_park/server.py | ctfs/ASIS/2020/Quals/safari_park/server.py | #!/usr/bin/env python3.7
import os
import random
import signal
import subprocess
import sys
def jsc(code):
try:
path = f'/tmp/exploit-{random.randrange(0, 1<<128):032x}.js'
with open(path, "w") as f:
f.write(code)
subprocess.run(["./jsc", path], timeout=10)
except Exception ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ASIS/2020/Finals/babyauth/bin/server.py | ctfs/ASIS/2020/Finals/babyauth/bin/server.py | #!/usr/bin/env python3
import os
import random
import shutil
import string
ctable = string.ascii_letters + string.digits
rndstr = lambda n: ''.join([random.choice(ctable) for i in range(n)])
PATH = '/tmp/babyauth_' + rndstr(16)
USERNAME = 'admin'
PASSWORD = rndstr(16)
if __name__ == '__main__':
# Setup
os.ma... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HackPack/2024/misc/Pirate_Bay/server.py | ctfs/HackPack/2024/misc/Pirate_Bay/server.py | import html
import os
import re
import requests
import sqlite3
from urllib.parse import parse_qs
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
from langserve import RemoteRunnable
import threading
db_path = 'fishy.db'
conn = sqlite3.connect(db_path, check_same_threa... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HackPack/2023/web/Wiki_world/note-app/app.py | ctfs/HackPack/2023/web/Wiki_world/note-app/app.py | from flask import *
app = Flask(__name__)
@app.route('/')
def default():
return send_file('index.html')
@app.route('/<path:path>')
def send_artifacts(path):
return send_from_directory('', path)
if __name__ == '__main__':
app.run(host='0.0.0.0') | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HackPack/2022/crypto/paiaiai/paiaiai.py | ctfs/HackPack/2022/crypto/paiaiai/paiaiai.py | #!/usr/bin/env python3
#
# Polymero
#
# Imports
from Crypto.Util.number import getPrime, inverse
from secrets import randbelow
# Local imports
with open("flag.txt",'rb') as f:
FLAG = f.read().decode()
f.close()
# Just for you sanity
assert len(FLAG) > 64
HDR = r"""|
| __________ ___ _____ .___ __... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HackPack/2022/crypto/RepeatingOffense/repeatingoffense.py | ctfs/HackPack/2022/crypto/RepeatingOffense/repeatingoffense.py | #!/usr/bin/env python3
#
# Polymero
#
# Imports
from Crypto.Util.number import getPrime, inverse, GCD
from secrets import randbelow
import os, hashlib
# Local imports
with open('flag.txt','rb') as f:
FLAG = f.read().decode().strip()
f.close()
HDR = r"""|
| _______ _______ _______ _______ ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HackPack/2022/web/ImportedKimchi/app.py | ctfs/HackPack/2022/web/ImportedKimchi/app.py | import uuid
from flask import *
from flask_bootstrap import Bootstrap
import pickle
import os
app = Flask(__name__)
Bootstrap(app)
app.secret_key = 'sup3r s3cr3t k3y'
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg'])
images = set()
images.add('bibimbap.jpg')
images.add('galbi.jpg')
images.add('pickled_kimchi.jpg')
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HackPack/2022/web/ImportedKimchi2/app.py | ctfs/HackPack/2022/web/ImportedKimchi2/app.py | import uuid
from flask import *
from flask_bootstrap import Bootstrap
import pickle
import os
app = Flask(__name__)
Bootstrap(app)
app.secret_key = 'sup3r s3cr3t k3y'
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg'])
images = set()
images.add('bibimbap.jpg')
images.add('galbi.jpg')
images.add('pickled_kimchi.jpg')
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HackPack/2020/jsclean/jsclean.py | ctfs/HackPack/2020/jsclean/jsclean.py | import os
import sys
import subprocess
def main(argv):
print("Welcome To JavaScript Cleaner")
js_name = input("Enter Js File Name To Clean: ")
code = input("Submit valid JavaScript Code: ")
js_name = os.path.basename(js_name) # No Directory Traversal for you
if not ".js" in js_name:
prin... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2021/Quals/pwn/secret/auth/app.py | ctfs/ISITDTU/2021/Quals/pwn/secret/auth/app.py | #!/usr/bin/env python3
import base64
import binascii
import os
import hashlib
import socket
from Crypto.Util.number import long_to_bytes, bytes_to_long
from flask import Flask, session, request
app = Flask(__name__)
app.secret_key = 'VerySecretSecretKey'
N = '''00:c7:cc:f7:ce:7c:15:63:d5:84:c1:eb:18:a4:08:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2021/Quals/crypto/wheres_your_ticket/wheres_your_ticket.py | ctfs/ISITDTU/2021/Quals/crypto/wheres_your_ticket/wheres_your_ticket.py | from Crypto.Cipher import AES
from hashlib import md5
import hmac
from os import urandom
import sys
import random
from binascii import hexlify, unhexlify
import secret
import socket
import threading
import socketserver
import signal
host, port = '0.0.0.0', 5000
BUFF_SIZE = 1024
class ThreadedTCPServer(socketserver.Th... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2021/Quals/web/Ez_Get_Flag/files/app.py | ctfs/ISITDTU/2021/Quals/web/Ez_Get_Flag/files/app.py | from flask import Flask, render_template, render_template_string, url_for, redirect, session, request
from lib import sql, waf,captcha
app = Flask(__name__)
app.config['SECRET_KEY'] = '[CENSORED]'
HOST = '0.0.0.0'
PORT = '5000'
@app.route('/')
def index():
if 'username' in session:
return redirect(url_for('home')... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2021/Quals/web/Ez_Get_Flag/files/lib/captcha.py | ctfs/ISITDTU/2021/Quals/web/Ez_Get_Flag/files/lib/captcha.py | SECRET = '[CENSORED]' # this is captcha
CHECK = '203c0617e3bde7ec99b5b657417a75131e3629b8ffdfdbbbbfd02332'
def check_captcha(cc):
msg = b'hello '
msg += cc.encode()
if calculate(msg) == CHECK:
return True
return False
def calculate(msg):
c = []
a = ord(b'[CENSORED]')
b = ord(b'[CENSORED]')
for m in msg:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2021/Quals/web/Ez_Get_Flag/files/lib/sql.py | ctfs/ISITDTU/2021/Quals/web/Ez_Get_Flag/files/lib/sql.py | import sqlite3
import hashlib
def login_check(username, password):
conn = sqlite3.connect('database/users.db')
row = conn.execute("SELECT * from users where username = ? and password = ?", (username, hashlib.sha1(password.encode()).hexdigest(), )).fetchall()
return len(row)
def reg(username,password):
conn = sqli... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2021/Quals/web/Ez_Get_Flag/files/lib/waf.py | ctfs/ISITDTU/2021/Quals/web/Ez_Get_Flag/files/lib/waf.py | import string, re
WHITE_LIST = string.ascii_letters + string.digits
BLACK_LIST = [
'class', 'mro', 'base', 'request', 'app',
'sleep', 'add', '+', 'config', 'subclasses', 'format', 'dict', 'get', 'attr', 'globals', 'time', 'read',
'import', 'sys', 'cookies', 'headers', 'doc', 'url', 'encode', 'decode', 'chr', 'ord',... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2024/Quals/crypto/somesomesome/somesomesome.py | ctfs/ISITDTU/2024/Quals/crypto/somesomesome/somesomesome.py | from Crypto.Util.number import getPrime
# usual stuff
p = getPrime(1024)
q = getPrime(1024)
n = p*q
flag = int.from_bytes(b'ISITDTU{--REDACTED--}', byteorder='big')
c = pow(flag, 65537, n)
print(f'{n = }')
print(f'{c = }')
hint = f'{p:x}'
mask = "????????????????????---------------------------------------------------... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2024/Quals/crypto/ShareMixer2/chall.py | ctfs/ISITDTU/2024/Quals/crypto/ShareMixer2/chall.py | import random # TODO: heard that this is unsafe but nvm
from Crypto.Util.number import getPrime, bytes_to_long
flag = bytes_to_long(open("flag.txt", "rb").read())
p = getPrime(256)
assert flag < p
l = 32
def share_mixer(xs):
cs = [random.randint(1, p - 1) for _ in range(l - 1)]
cs.append(flag)
# mi... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2024/Quals/crypto/Sign/chall.py | ctfs/ISITDTU/2024/Quals/crypto/Sign/chall.py | #!/usr/bin/env python3
import os
from Crypto.Util.number import *
from Crypto.Signature import PKCS1_v1_5
from Crypto.PublicKey import RSA
from Crypto.Hash import SHA256
flag = b'ISITDTU{aaaaaaaaaaaaaaaaaaaaaaaaaa}'
flag = os.urandom(255 - len(flag)) + flag
def genkey(e=11):
while True:
p = getPrime(10... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2024/Quals/crypto/thats_so_random/chall.py | ctfs/ISITDTU/2024/Quals/crypto/thats_so_random/chall.py | import random
flag = random.randbytes(random.randint(13, 1337))
flag += open("flag.txt", "rb").read()
flag += random.randbytes(random.randint(13, 1337))
random.seed(flag)
print(len(flag) < 1337*1.733 and [random.randrange(0, int(0x13371337*1.337)) for _ in range(0x13337)])
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2024/Quals/crypto/ShareMixer1/chall.py | ctfs/ISITDTU/2024/Quals/crypto/ShareMixer1/chall.py | import random # TODO: heard that this is unsafe but nvm
from Crypto.Util.number import getPrime, bytes_to_long
flag = bytes_to_long(open("flag.txt", "rb").read())
p = getPrime(256)
assert flag < p
l = 32
def share_mixer(xs):
cs = [random.randint(1, p - 1) for _ in range(l - 1)]
cs.append(flag)
# mixy ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2019/Quals/prisonbreak/backend.py | ctfs/ISITDTU/2019/Quals/prisonbreak/backend.py | import time
from subprocess32 import run, STDOUT, PIPE, CalledProcessError
print("5 years in prison! Wanna escape???")
payload = input()[:0xc0].encode('utf-8', 'surrogateescape')
st = time.time()
try:
result = run(['/home/prisonbreak/prisonbreak'], input=payload, stdout=PIPE, stderr=STDOUT, timeout=2, check=True).st... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2023/Quals/crypto/MemeStorage/MemeStorage.py | ctfs/ISITDTU/2023/Quals/crypto/MemeStorage/MemeStorage.py | #!/usr/bin/env python3
import json
import os
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
import re
def check_name(password):
if re.fullmatch(r"\w*", password, flags=re.ASCII) and \
re.search(r"\d", password) and \
re.search(r"[a-z]", password):
return True
r... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2023/Quals/crypto/MagicPrime/MagicPrime_new.py | ctfs/ISITDTU/2023/Quals/crypto/MagicPrime/MagicPrime_new.py | import os
import signal
from random import SystemRandom
from Crypto.Util.number import isPrime, bytes_to_long
random = SystemRandom()
def challenge():
signal.alarm(30)
salt = bytes_to_long(os.urandom(20)) | 1
print(f"{salt = }")
P = int(input("P: "))
assert P.bit_length() >= 4096 # Nist recommended
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2023/Quals/crypto/d_low/chall.py | ctfs/ISITDTU/2023/Quals/crypto/d_low/chall.py | from Crypto.Util.number import *
from FLAG import flag
flag = bytes_to_long(flag)
p = getPrime(1024)
q = getPrime(1024)
n = p*q
e = 12721
c = pow(flag, e, n)
print(f"{n = }")
print(f"{c = }")
# hints :)
def hx(x):
return hex(x)[2:]
d = pow(e, -1, (p-1)*(q-1))
print(hx(d)[-64:])
print(hx(p)[:64])
print(hx(p)[96:1... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2023/Quals/crypto/homemade_primes/chall.py | ctfs/ISITDTU/2023/Quals/crypto/homemade_primes/chall.py | from Crypto.Util.number import bytes_to_long, isPrime
from functools import reduce
from secret import FLAG, SEED
class LFSR:
def __init__(self, seed: int) -> None:
assert 0 <= seed < 2**32, "Please provide a 32-bit seed."
self.__state = list(map(int, "{:032b}".format(seed)))
self.__taps = [... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2023/Quals/crypto/babyRSA/chall.py | ctfs/ISITDTU/2023/Quals/crypto/babyRSA/chall.py | from Crypto.Util.number import bytes_to_long
from FLAG import flag
p1 = 401327687854144602104262478345650053155149834850813791388612732559616436344229998525081674131271
p2 = 500233813775302774885494989064149819654733094475237733501199023993441312997760959607567274704359
p3 = 9695686799036729247385977368809031334151333... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2023/Quals/web/Naruchu/server.py | ctfs/ISITDTU/2023/Quals/web/Naruchu/server.py | #!/usr/local/bin/python
import os
import io
import pickle
from flask import Flask, Response, request, jsonify, session
from waitress import serve
app = Flask(__name__)
app.secret_key = os.environ.get("FLASK_SECRET_KEY", "")
naruchu = {
"Myoboku": {
"des": "You are Nagato, the leader of the criminal organi... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2023/Quals/web/thru_the_filter/src/app.py | ctfs/ISITDTU/2023/Quals/web/thru_the_filter/src/app.py | from flask import Flask, request, render_template_string,redirect
app = Flask(__name__)
def check_payload(payload):
blacklist = ['import', 'request', 'init', '_', 'b', 'lipsum', 'os', 'globals', 'popen', 'mro', 'cycler', 'joiner', 'u','x','g','args', 'get_flashed_messages', 'base', '[',']','builtins', 'namespace',... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2023/Quals/web/Quibuu/app.py | ctfs/ISITDTU/2023/Quals/web/Quibuu/app.py | from flask import Flask, render_template, request
import random
import re
import urllib.parse
import sqlite3
app = Flask(__name__)
def waf_cuc_chill(ans):
# idk, I thought too much of a good thing
ans = urllib.parse.quote(ans)
pattern = re.compile(r'(and|0r|substring|subsrt|if|case|cast|like|>|<|(?:/\%2A... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2022/Quals/crypto/Halloweens_magix/chall.py | ctfs/ISITDTU/2022/Quals/crypto/Halloweens_magix/chall.py | from struct import pack
import random, time
def bytes2matrix(b):
return [list(map(lambda x : x, list(b[i:i+4]))) for i in range(0, len(b), 4)]
def matrix2bytes(m):
return b''.join(map(lambda x : b''.join(map(lambda y : pack('!H', y), x)), m))
def multiply(A,B):
C = [[0 for i in range(4)] for j in range(4)]
for i... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2022/Quals/crypto/dp_high/chall.py | ctfs/ISITDTU/2022/Quals/crypto/dp_high/chall.py | from Crypto.Util.number import bytes_to_long, getPrime
from SECRET import FLAG
e = getPrime(128)
p = getPrime(1024)
q = getPrime(1024)
n = p * q
c = pow(bytes_to_long(FLAG), e, n)
d = pow(e, -1, (p - 1) * (q - 1))
dp = d % (p - 1)
dp_high = dp >> 205
print(f"{n = }")
print(f"{e = }")
print(f"{c = }")
print(f"{dp_hig... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ISITDTU/2022/Quals/crypto/glitch_in_the_matrix/chall.py | ctfs/ISITDTU/2022/Quals/crypto/glitch_in_the_matrix/chall.py | #!/usr/bin/env python3
from secret import SECRET_BASIS
from secrets import token_hex
import random
import os
assert len(SECRET_BASIS) == len(SECRET_BASIS[0]) == 128
def f(M: list[list[int]], C: list[int]) -> list[int]:
v = [0] * len(M[0])
for c, m in zip(C, M):
if c:
v = [x ^ y for x, y in... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/b01lers/2021/pwn/boiledvm/boiledvm.py | ctfs/b01lers/2021/pwn/boiledvm/boiledvm.py | #!/usr/bin/env python
import struct
import random
import subprocess
import os
import sys
pipe = subprocess.PIPE
PTRACE_TRACEME = 0
PTRACE_PEEKTEXT = 1
PTRACE_PEEKDATA = 2
PTRACE_PEEKUSER = 3
PTRACE_POKETEXT = 4
PTRACE_POKEDATA = 5
PTRACE_POKEUSER = 6
PTRACE_CONT = 7
PTRACE_KILL = 8
PTRACE_SINGLESTEP = 9
PTR... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/b01lers/2021/crypto/Cold_War_Gets_Hotter/coldwar.py | ctfs/b01lers/2021/crypto/Cold_War_Gets_Hotter/coldwar.py | #!/usr/bin/env python3
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
import os
import re
import sys
BASE_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
IU_MANIFESTO = '''
"Indiana, Our Indiana"
Indiana, our Indiana
Indiana, we're all for you!
We will fight for the cream and crimson
For... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/b01lers/2021/crypto/Unlucky_Strike/server.py | ctfs/b01lers/2021/crypto/Unlucky_Strike/server.py | from Crypto.Random import get_random_bytes
from Crypto.Cipher import AES
import sys, base64, time
from proprietary_data import *
def pkcs7(msg):
padlen = 16 - (len(msg) & 0xf)
return msg + bytes([padlen]*padlen)
def unpkcs7(padded):
while True:
if (len(padded) & 0xf) != 0 or len(padded) == 0: break
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.