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/Crypto/2022/soda/soda_server.py | ctfs/Crypto/2022/soda/soda_server.py | #!/usr/bin/env python3
from Crypto.Util.number import *
import sys
from secret import p, q, flag
def soda(g, p, q, m):
n, phi = p * q, (p - 1) * (q - 1)
if isPrime(m) and m.bit_length() <= 128:
e = m
else:
e = 2 * (pow(g, m**2, n) % 2**152) ^ 1
if GCD(e, phi) == 1:
d = inverse(e, phi)
return pow(g, d, n)
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Crypto/2022/versace/versace.py | ctfs/Crypto/2022/versace/versace.py | #!/usr/bin/env python3
# In the name of Allah
from Crypto.Util.number import *
from flag import flag
def keygen(n):
e = 65537
x, y = [getRandomRange(2, n - 2) for _ in '01']
fi = pow(5, x, n)
th = pow(13, y, n)
return (n, e, fi, th)
def encrypt(m, pubkey):
n, e, fi, th = pubkey
k, u, v = [getRandomRange(2, n ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Crypto/2022/polyRSA/polyRSA.py | ctfs/Crypto/2022/polyRSA/polyRSA.py | #!/usr/bin/env python3
from Crypto.Util.number import *
from flag import flag
def keygen(nbit = 64):
while True:
k = getRandomNBitInteger(nbit)
p = k**6 + 7*k**4 - 40*k**3 + 12*k**2 - 114*k + 31377
q = k**5 - 8*k**4 + 19*k**3 - 313*k**2 - 14*k + 14011
if isPrime(p) and isPrime(q):
return p, q
def encrypt... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/pwn/atelier/client.py | ctfs/LINE/2021/pwn/atelier/client.py | #!/usr/bin/env python3
import sys
import json
import asyncio
import importlib
# from sqlalchemy import *
class AtelierException:
def __init__(self, e):
self.message = repr(e)
class MaterialRequest:
pass
class MaterialRequestReply:
pass
class RecipeCreateRequest:
def __init__(self, material... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/crypto/babycrypto1/babycrypto1.py | ctfs/LINE/2021/crypto/babycrypto1/babycrypto1.py | #!/usr/bin/env python
from base64 import b64decode
from base64 import b64encode
import socket
import multiprocessing
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
from Crypto.Util.Padding import pad, unpad
import hashlib
import sys
class AESCipher:
def __init__(self, key):
self.... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/crypto/babycrypto2/babycrypto2.py | ctfs/LINE/2021/crypto/babycrypto2/babycrypto2.py | #!/usr/bin/env python
from base64 import b64decode
from base64 import b64encode
import socket
import multiprocessing
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
from Crypto.Util.Padding import pad, unpad
import hashlib
import sys
class AESCipher:
def __init__(self, key):
self.... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/web/YourNote/web/src/models.py | ctfs/LINE/2021/web/YourNote/web/src/models.py | from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy_utils import UUIDType
from sqlalchemy.orm import relationship, backref
from flask_marshmallow import Marshmallow
import uuid
from datab... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/web/YourNote/web/src/database.py | ctfs/LINE/2021/web/YourNote/web/src/database.py | from flask_sqlalchemy import SQLAlchemy
from retrying import retry
db = SQLAlchemy()
@retry(wait_fixed=2000, stop_max_attempt_number=10)
def init_db(app):
db.init_app(app)
with app.app_context():
db.create_all() | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/web/YourNote/web/src/config.py | ctfs/LINE/2021/web/YourNote/web/src/config.py | import os
class BaseConfig(object):
DEBUG = False
TESTING = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
SESSION_TYPE = 'filesystem'
class DevConfig(BaseConfig):
DEBUG = True
TESTING = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///dev.sqlite3'
SECRET_KEY = 'dev_secret'
ADMIN_PASSWORD ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/web/YourNote/web/src/app.py | ctfs/LINE/2021/web/YourNote/web/src/app.py | from flask import Flask, flash, redirect, url_for, render_template, request, jsonify, send_file, Response, session
from flask_login import LoginManager, login_required, login_user, logout_user, current_user
from flask_wtf.csrf import CSRFProtect
from flask_sqlalchemy import SQLAlchemy
from flask_session import Session
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/web/diveinternal/private/app/datamodel.py | ctfs/LINE/2021/web/diveinternal/private/app/datamodel.py | import os
from datetime import date, datetime, timedelta
from sqlalchemy import create_engine, ForeignKeyConstraint
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String, Integer, Date, Table, Boolean, ForeignKey, DateTime, BLOB, Text, JSO... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/web/diveinternal/private/app/coinapi.py | ctfs/LINE/2021/web/diveinternal/private/app/coinapi.py | import json,os,sys, random
import requests, urllib.parse,subprocess,time
from requests.auth import HTTPBasicAuth
from requests_toolbelt.utils import dump
from datetime import datetime, timedelta
import logging
logger = logging.getLogger('KillCoinapi')
headers = {'content-encoding': 'gzip','content-type':'application... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/web/diveinternal/private/app/main.py | ctfs/LINE/2021/web/diveinternal/private/app/main.py | import schedule, signal, queue, threading, time,sys, os, datetime, multiprocessing, requests, telegram, jsonify, threading, requests, re, hashlib, hmac, random, base64
from threading import Thread
import flask
from flask import Flask, request, render_template, json
from flask_bootstrap import Bootstrap
from flask_cors... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/web/diveinternal/private/app/rollback.py | ctfs/LINE/2021/web/diveinternal/private/app/rollback.py | import subprocess,time,os, sys
import logging
from dotenv import load_dotenv
load_dotenv()
logger = logging.getLogger('KillCoinapi')
subprocess.SW_HIDE = 1
def RunRollbackDB(dbhash):
try:
if os.environ['ENV'] == 'LOCAL':
return
if dbhash is None:
return "dbhash is None"
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/web/babyweb/gen.py | ctfs/LINE/2021/web/babyweb/gen.py | from uuid import uuid4
USERNAME_HEADER = f"x-user-{uuid4()}"
PASSWORD_HEADER = f"x-pass-{uuid4()}"
USERNAME_ADMIN = "admin"
PASSWORD_ADMIN = f"{uuid4()}"
with open("docker-compose_tmp.yml") as f:
dcyml = f.read()
dcyml = dcyml.replace("USERNAME_HEADER_DUMMY", USERNAME_HEADER)
dcyml = dcyml.replace("PASSWORD_HE... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/web/babyweb/public/src/utils.py | ctfs/LINE/2021/web/babyweb/public/src/utils.py | import hyper
from uuid import uuid4
from config import cfg
def create_connection():
hyper.tls.cert_loc="./cert.pem"
return hyper.HTTPConnection(cfg["INTERNAL"]["HOST"], secure=True)
def get_uuid():
return str(uuid4()) | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/web/babyweb/public/src/internal.py | ctfs/LINE/2021/web/babyweb/public/src/internal.py | import functools
import requests
from flask import (
Blueprint, flash, g, redirect, render_template, request, session, url_for, jsonify
)
from utils import *
from config import cfg
internal_bp = Blueprint('internal', __name__, url_prefix='/internal')
@internal_bp.route("/auth", methods=["POST"])
def auth():
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/web/babyweb/public/src/config.py | ctfs/LINE/2021/web/babyweb/public/src/config.py | from os import getenv
cfg = {
"HEADER": {
"USERNAME": getenv("USERNAME_HEADER"),
"PASSWORD": getenv("PASSWORD_HEADER")
},
"ADMIN": {
"USERNAME": getenv("USERNAME_ADMIN"),
"PASSWORD": getenv("PASSWORD_ADMIN")
},
"INTERNAL": {
"HOST": getenv("INTERNAL_HOST")
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2021/web/babyweb/public/src/app.py | ctfs/LINE/2021/web/babyweb/public/src/app.py | from functools import wraps
from flask import Flask, render_template, g, jsonify, request, session, redirect, url_for, abort
from hyper import HTTPConnection
import sqlite3
from internal import internal_bp
from utils import get_uuid
DATABASE = 'database/sql.db'
app = Flask(__name__)
app.register_blueprint(internal_... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/models.py | ctfs/LINE/2023/pwn/catgle/catgle/models.py | from sqlalchemy import Column, Boolean, Integer, String, Text, DateTime, ForeignKey, Table
from sqlalchemy.orm import relationship, backref
from database import Base
question_voter = Table(
'question_voter',
Base.metadata,
Column('user_id', Integer, ForeignKey('users.id'), primary_key=True),
Column('qu... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/main.py | ctfs/LINE/2023/pwn/catgle/catgle/main.py | from fastapi import FastAPI, Request
from starlette.middleware.cors import CORSMiddleware
from starlette_validation_uploadfile import ValidateUploadFileMiddleware
from domain.question import question_router
from domain.answer import answer_router
from domain.user import user_router
from domain.chall import chall_route... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/database.py | ctfs/LINE/2023/pwn/catgle/catgle/database.py | from sqlalchemy import create_engine, MetaData
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import os
SQLALCHEMY_DATABASE_URL = "mysql+mysqldb://{username}:{password}@{host}:{port}/catgle".format(
username=os.environ['MY... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/config.py | ctfs/LINE/2023/pwn/catgle/catgle/config.py | from pydantic import BaseSettings
class Settings(BaseSettings):
ACCESS_TOKEN_EXPIRATION_MIN: int
# REFRESH_TOKEN_EXPIRATION_MIN: int
# JWT_PUBLIC_KEY: str
JWT_PRIVATE_KEY: str
ALGORITHM: str
class Config:
env_file = ".env"
def get_envs():
return Settings() | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/domain/chall/chall_schema.py | ctfs/LINE/2023/pwn/catgle/catgle/domain/chall/chall_schema.py | from pydantic import BaseModel, validator
class UploadedModel(BaseModel):
source: str
file_name: str
file_size: int | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/domain/chall/chall_router.py | ctfs/LINE/2023/pwn/catgle/catgle/domain/chall/chall_router.py | import os
from datetime import datetime
from fastapi import APIRouter, Depends, HTTPException, UploadFile
from sqlalchemy.orm import Session
from starlette import status
from database import get_db
from domain.answer import answer_schema, answer_crud
from domain.question import question_crud
from domain.chall import c... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/domain/chall/chall_crud.py | ctfs/LINE/2023/pwn/catgle/catgle/domain/chall/chall_crud.py | from datetime import datetime
from sqlalchemy.orm import Session
from domain.answer.answer_schema import AnswerCreate, AnswerUpdate
from models import User, Chall
def create_chall(db: Session,
source: str,
user: User,
category: str,
file_name: str,
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/domain/user/user_schema.py | ctfs/LINE/2023/pwn/catgle/catgle/domain/user/user_schema.py | from pydantic import BaseModel, validator
import datetime
class UserCreate(BaseModel):
username: str
password: str
password_confirm: str
@validator('username', 'password', 'password_confirm')
def not_empty(cls, v):
if not v or not v.strip():
raise ValueError("Empty values are n... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/domain/user/user_crud.py | ctfs/LINE/2023/pwn/catgle/catgle/domain/user/user_crud.py | import hashlib
from datetime import datetime
from sqlalchemy.orm import Session
from domain.user.user_schema import UserCreate
from models import User, Chall
def create_user(db: Session, user_create: UserCreate, ip_addr: str):
"""
username = Column(String, unique=True, nullable=False)
password = Column(Str... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/domain/user/user_router.py | ctfs/LINE/2023/pwn/catgle/catgle/domain/user/user_router.py | from datetime import timedelta, datetime
import os
import hashlib
from fastapi import APIRouter, Depends, Request, HTTPException
from fastapi.security import OAuth2PasswordRequestForm, OAuth2PasswordBearer
from jose import jwt, JWTError
from sqlalchemy.orm import Session
from starlette import status
from database imp... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/domain/answer/answer_router.py | ctfs/LINE/2023/pwn/catgle/catgle/domain/answer/answer_router.py | from datetime import datetime
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from starlette import status
from database import get_db
from domain.answer import answer_schema, answer_crud
from domain.question import question_crud
from domain.user.user_router import get_current_... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/domain/answer/answer_schema.py | ctfs/LINE/2023/pwn/catgle/catgle/domain/answer/answer_schema.py | import datetime
from pydantic import BaseModel, validator
from domain.user.user_schema import User
class Answer(BaseModel):
id: int
content: str
create_date: datetime.datetime
user: User | None
question_id: int
modify_date: datetime.datetime | None = None
voters: list[User] = []
is_mark... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/domain/answer/answer_crud.py | ctfs/LINE/2023/pwn/catgle/catgle/domain/answer/answer_crud.py | from datetime import datetime
from sqlalchemy.orm import Session
from domain.answer.answer_schema import AnswerCreate, AnswerUpdate
from models import Question, Answer, User
def create_answer(db: Session,
question: Question,
answer_create: AnswerCreate,
user: User):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/domain/question/question_crud.py | ctfs/LINE/2023/pwn/catgle/catgle/domain/question/question_crud.py | from datetime import datetime
from domain.question.question_schema import QuestionCreate, QuestionUpdate
from models import Question, Answer, User
from sqlalchemy.orm import Session
def get_question_list(db: Session, skip: int = 0, limit: int = 10, keyword: str = ''):
question_list = db.query(Question)
if key... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/domain/question/question_schema.py | ctfs/LINE/2023/pwn/catgle/catgle/domain/question/question_schema.py | import datetime
from pydantic import BaseModel, validator
from domain.answer.answer_schema import Answer
from domain.user.user_schema import User
class Question(BaseModel):
id: int
subject: str
content: str
create_date: datetime.datetime
answers: list[Answer] = []
user: User | None
modify... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/catgle/catgle/domain/question/question_router.py | ctfs/LINE/2023/pwn/catgle/catgle/domain/question/question_router.py | from datetime import datetime
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from starlette import status
from database import get_db
from domain.question import question_schema, question_crud
from domain.user.user_router import get_current_user
from models import User
router... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/pwn/simple-blogger/agent/admin_janitor.py | ctfs/LINE/2023/pwn/simple-blogger/agent/admin_janitor.py | from pwn import *
import struct, os, binascii
HOST = 'server'
ADMIN_USER = os.getenv('ADMIN_USER')
ADMIN_PASS = os.getenv('ADMIN_PASS')
PORT = 13443
TIMEOUT = 3
def auth():
payload = b'\x01\x02'
payload += b'\x41'*16
cred = '{0}:{1}'.format(ADMIN_USER, ADMIN_PASS)
cred_len = len(cred)
payload += s... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/crypto/malcheeeeese/client.py | ctfs/LINE/2023/crypto/malcheeeeese/client.py | #!/usr/bin/env python3
# crypto + misc challenge
# How to generate the authentication token
# Given as secret; key for AES, sign_key_pair for EdDSA ( sign_key, verify_key ), token, password
# key for AES, token, password were pre-shared to server.
# 1. Generate Signature for token over Ed25519 ( RFC8032 )
# 2. Encryp... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/crypto/malcheeeeese/challenge_server.py | ctfs/LINE/2023/crypto/malcheeeeese/challenge_server.py | from server import decrypt, generate_new_auth_token
import socket, signal, json, threading
from socketserver import BaseRequestHandler, TCPServer, ForkingMixIn
address = ('0.0.0.0', 11223)
class ChallengeHandler(BaseRequestHandler):
def challenge(self, req, verifier, verify_counter):
authtoken = req.rec... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/crypto/malcheeeeese/server.py | ctfs/LINE/2023/crypto/malcheeeeese/server.py | #!/usr/bin/env python3
# crypto + misc challenge
# See generate_new_auth_token() in this file and client.py for details on the authentication token.
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), './secret/'))
from server_secret import FLAG
from common_secret import AES_KEY_HEX, TOKEN_HEX, PA... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/web/flag-masker/web/app.py | ctfs/LINE/2023/web/flag-masker/web/app.py | from flask import Flask, Response, session, render_template, abort, request, redirect
from captcha.image import ImageCaptcha
from core.database import Database
from core.report import Report
from core.config import Config
from string import digits
from base64 import b64encode
from random import choice
from uuid import ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/web/flag-masker/web/core/report.py | ctfs/LINE/2023/web/flag-masker/web/core/report.py | from redis import Redis
class Report:
def __init__(self):
try:
self.conn = Redis(host="redis", port=6379)
except Exception as error:
print(error, flush=True)
def submit(self, data: object):
try:
self.conn.lpush("query", data["url"])
except Exception as error:
print(error,... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/web/flag-masker/web/core/database.py | ctfs/LINE/2023/web/flag-masker/web/core/database.py | from sqlite3 import connect
from core.config import Config
class Database:
def __init__(self):
try:
self.conn = connect("./memo.db", check_same_thread=False)
cursor = self.conn.cursor()
with open("init.sql", "r") as fp:
cursor.executescript(fp.read())
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/web/flag-masker/web/core/config.py | ctfs/LINE/2023/web/flag-masker/web/core/config.py | from os import getenv
class Config:
secret = getenv("secret")
quries = {
"write": "insert into memo (uid, memo, secret) values (:uid, :memo, :secret)",
"loads": "select memo, secret from memo where uid = :uid",
}
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/web/imagexif/backend/src/app.py | ctfs/LINE/2023/web/imagexif/backend/src/app.py |
import os, queue, secrets, uuid
from random import seed, randrange
from flask import Flask, request, redirect, url_for, session, render_template, jsonify, Response
from flask_executor import Executor
from flask_jwt_extended import JWTManager
from werkzeug.utils import secure_filename
from werkzeug.exceptions import ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/web/imagexif/backend/src/common/error.py | ctfs/LINE/2023/web/imagexif/backend/src/common/error.py | class APIError(Exception):
"""Base class for other exceptions"""
def __init__(self, description, reason: str):
self.description = description
self.reason = reason
class FileNotAllowed(Exception):
def __init__(self, _file_extension,message="File Not Allowed"):
self.message = messag... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2023/web/imagexif/backend/src/common/config.py | ctfs/LINE/2023/web/imagexif/backend/src/common/config.py | import os
import random
import yaml
current_dir = os.path.join(os.path.dirname(__file__), "../../conf/")
class Config(object):
"""set app config in here"""
SECRET_KEY = os.urandom(12).hex()
JSON_AS_ASCII = False
def merge_dicts(dict1, dict2) -> dict:
"""
Recursively merges dict2 into dict1
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/crypto/forward-or/present.py | ctfs/LINE/2022/crypto/forward-or/present.py | '''
Python3 PRESENT implementation
original code (implementation for python2) is here:
http://www.lightweightcrypto.org/downloads/implementations/pypresent.py
'''
'''
key = bytes.fromhex("00000000000000000000")
plain = bytes.fromhex("0000000000000000")
cipher = Present(key)
encrypted = cipher.encrypt(plain)
print(en... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/crypto/forward-or/main.py | ctfs/LINE/2022/crypto/forward-or/main.py | from present import Present
from Crypto.Util.strxor import strxor
import os, re
class CTRMode():
def __init__(self, key, nonce=None):
self.key = key # 20bytes
self.cipher = DoubleRoundReducedPresent(key)
if None==nonce:
nonce = os.urandom(self.cipher.block_size//2)
self.... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/crypto/ss_puzzle/ss_puzzle.py | ctfs/LINE/2022/crypto/ss_puzzle/ss_puzzle.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 64 bytes
FLAG = b'LINECTF{...}'
def xor(a:bytes, b:bytes) -> bytes:
return bytes(i^j for i, j in zip(a, b))
S = [None]*4
R = [None]*4
Share = [None]*5
S[0] = FLAG[0:8]
S[1] = FLAG[8:16]
S[2] = FLAG[16:24]
S[3] = FLAG[24:32]
# Ideally, R should be random stream. ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/web/memo-drive/memo-drive/index.py | ctfs/LINE/2022/web/memo-drive/memo-drive/index.py | import os
import hashlib
import shutil
import datetime
import uvicorn
import logging
from urllib.parse import unquote
from starlette.applications import Starlette
from starlette.responses import HTMLResponse
from starlette.routing import Route, Mount
from starlette.templating import Jinja2Templates
from starlette.stat... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/web/title_todo/dist/src/app/models.py | ctfs/LINE/2022/web/title_todo/dist/src/app/models.py | from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from sqlalchemy import Column, Integer, String, Boolean,ForeignKey, UniqueConstraint, Text, DateTime
from sqlalchemy_utils import UUIDType
from sqlalchemy.orm import relationship, backref
from sqlalchemy.sql.func... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/web/title_todo/dist/src/app/database.py | ctfs/LINE/2022/web/title_todo/dist/src/app/database.py | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
def init_db(app):
db.init_app(app)
with app.app_context():
db.create_all()
return db | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/web/title_todo/dist/src/app/config.py | ctfs/LINE/2022/web/title_todo/dist/src/app/config.py | import os
import secrets
class Config(object):
SECRET_KEY = secrets.token_bytes()
FLAG = os.getenv('FLAG')
APP_HOST = os.getenv('APP_HOST')
BASE_URL = f"http://{APP_HOST}/"
SQLALCHEMY_DATABASE_URI = 'sqlite:///db.sqlite3'
UPLOAD_FOLDER = './static/image'
REDIS_HOST = os.getenv('REDIS_HOST')... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/web/title_todo/dist/src/app/app.py | ctfs/LINE/2022/web/title_todo/dist/src/app/app.py | import os
import re
from uuid import uuid4
from flask import Flask, json, request, redirect, url_for, flash, render_template, jsonify
from flask_login import LoginManager, login_manager, login_required, login_user, current_user, logout_user
from redis import Redis
from sqlalchemy.exc import IntegrityError
from datab... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/web/me7ball/backend/src/app.py | ctfs/LINE/2022/web/me7ball/backend/src/app.py |
import os, queue, secrets
from random import seed, randrange
import logging.config
from flask import Flask, request, redirect, url_for, session, render_template, jsonify, Response
from flask_executor import Executor
from flask_jwt_extended import JWTManager
from werkzeug.utils import secure_filename
from werkzeug.ex... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/web/me7ball/backend/src/common/error.py | ctfs/LINE/2022/web/me7ball/backend/src/common/error.py | class APIError(Exception):
"""Base class for other exceptions"""
def __init__(self, description, reason: str):
self.description = description
self.reason = reason
class FileNotAllowed(Exception):
def __init__(self, _file_extension,message="File Not Allowed"):
self.message = message... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/web/me7ball/backend/src/common/logger.py | ctfs/LINE/2022/web/me7ball/backend/src/common/logger.py | import os
import sys
from logging import getLogger, Formatter, StreamHandler, WARN, INFO, DEBUG
from logging.handlers import TimedRotatingFileHandler
def get_common_logger(name: str, log_level: str = "DEBUG", log_file_path: str = None, std_out: bool = True, backup_count: int = 180):
"""
:param name:
:para... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/web/me7ball/backend/src/common/config.py | ctfs/LINE/2022/web/me7ball/backend/src/common/config.py | import os
import random
import yaml
current_dir = os.path.join(os.path.dirname(__file__), "../../conf/")
class Config(object):
"""set app config in here"""
SECRET_KEY = os.urandom(12).hex()
JSON_AS_ASCII = False
def merge_dicts(dict1, dict2) -> dict:
"""
Recursively merges dict2 into dict1
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/web/hariboteSecureNote/dist/src/app/models.py | ctfs/LINE/2022/web/hariboteSecureNote/dist/src/app/models.py | import uuid
import werkzeug.security
from flask_login import UserMixin
from sqlalchemy import Column, Integer, String, Boolean, DateTime, ForeignKey, UniqueConstraint
from sqlalchemy.orm import relationship, backref
from sqlalchemy.sql.functions import current_timestamp
from sqlalchemy_utils import UUIDType
from dat... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/web/hariboteSecureNote/dist/src/app/database.py | ctfs/LINE/2022/web/hariboteSecureNote/dist/src/app/database.py | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/web/hariboteSecureNote/dist/src/app/config.py | ctfs/LINE/2022/web/hariboteSecureNote/dist/src/app/config.py | import os
import secrets
class Config(object):
APP_NAME = "Haribote Secure Note"
BASE_URL = os.getenv('BASE_URL', 'http://nginx/')
SECRET_KEY = secrets.token_bytes()
RATELIMIT_HEADERS_ENABLED = True
FLAG = os.getenv('FLAG', 'linectf{dummy}')
REDIS_HOST = os.getenv('REDIS_HOST', '127.0.0.1')... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/LINE/2022/web/hariboteSecureNote/dist/src/app/app.py | ctfs/LINE/2022/web/hariboteSecureNote/dist/src/app/app.py | import http
import re
import secrets
import string
from base64 import b64encode
from urllib.parse import urljoin
from flask import Flask, render_template, request, redirect, url_for, flash, make_response, jsonify
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address
from flask_login impor... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Akasec/2024/misc/pyJail/chall.py | ctfs/Akasec/2024/misc/pyJail/chall.py | import sys
from string import printable
print('''
#################################################################
# #
# Welcome to pyJail! #
# #
# Y... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Akasec/2024/crypto/DODOLOUF/chall.py | ctfs/Akasec/2024/crypto/DODOLOUF/chall.py | from os import urandom
from random import getrandbits
from Crypto.Cipher import AES
from Crypto.Util.number import long_to_bytes
from Crypto.Util.Padding import pad
import pickle
import time
def generate_number(bits):
return getrandbits(bits)
class myencryption():
def __init__(self):
self.key_counter ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Akasec/2024/crypto/Twin/chall.py | ctfs/Akasec/2024/crypto/Twin/chall.py | from Crypto.Util.number import getPrime, bytes_to_long
from SECRET import FLAG
e = 5
p = getPrime(256)
q = getPrime(256)
n = p * q
m1 = bytes_to_long(FLAG)
m2 = m1 >> 8
if __name__ == "__main__":
c1, c2 = pow(m1, e, n), pow(m2, e, n)
print("n = {}\nc1 = {}\nc2 = {}".format(n, c1, c2)) | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Akasec/2024/crypto/Power_Over_All/chall.py | ctfs/Akasec/2024/crypto/Power_Over_All/chall.py | from Crypto.Util.number import getPrime, bytes_to_long
from random import randint
from SECRET import FLAG
def key_gen():
ps = []
n = randint(2,2**6)
for _ in range(n):
p = getPrime(256)
ps.append(p)
return ps
def encrypt(m, ps):
ps.sort()
for p in ps:
e = 1<<1
m... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Akasec/2024/crypto/Lost/chall.py | ctfs/Akasec/2024/crypto/Lost/chall.py | from random import getrandbits
from Crypto.Util.number import getPrime, bytes_to_long
from SECRET import FLAG
e = 2
p = getPrime(256)
q = getPrime(256)
n = p * q
m = bytes_to_long(FLAG)
cor_m = m - getrandbits(160)
if __name__ == "__main__":
c = pow(m, e, n)
print("n = {}\nc = {}\ncor_m = {}".format(n, c, co... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Akasec/2024/crypto/GCL/chall.py | ctfs/Akasec/2024/crypto/GCL/chall.py | from random import getrandbits
from Crypto.Util.number import getPrime
from SECRET import FLAG
BITS = 128
m = getPrime(BITS)
s = getrandbits(BITS - 1)
a = getrandbits(BITS - 1)
b = getrandbits(BITS - 1)
def lcg(s, c):
return c*(a*s + b) % m
if __name__ == "__main__":
c = []
r = s
for i in FLAG:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SpaceHeroes/2024/crypto/CRYPTIC/encrypt.py | ctfs/SpaceHeroes/2024/crypto/CRYPTIC/encrypt.py | from Crypto.Cipher import AES
import binascii, os
key = b"3153153153153153"
iv = os.urandom(16)
plaintext = open('message.txt', 'rb').read().strip()
cipher = AES.new(key, AES.MODE_CBC, iv)
encrypted_flag = open('message.enc', 'wb')
encrypted_flag.write(binascii.hexlify(cipher.encrypt(plaintext)))
encrypted_flag.cl... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SpaceHeroes/2024/crypto/Comms_Array/comms_array.py | ctfs/SpaceHeroes/2024/crypto/Comms_Array/comms_array.py | #!/use/bin/env python3
import os, sys, zlib, fcntl
flag = os.getenvb(b'FLAG', b'UNSET')
size = sys.stdin.buffer.read(1)
size = size[0] if size else 0
flags = fcntl.fcntl(sys.stdin, fcntl.F_GETFL)
fcntl.fcntl(sys.stdin, fcntl.F_SETFL, flags | os.O_NONBLOCK)
max_sz = 255 - len(flag)
buf = sys.stdin.buffer.read(min(si... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SpaceHeroes/2023/pwn/OneByte/shell/pyshell.py | ctfs/SpaceHeroes/2023/pwn/OneByte/shell/pyshell.py | import os
import tempfile
print("One Small Byte For Pwn, One Giant Leap For Flag")
print("Leap >>>")
leap = int(input())
print("Byte >>>")
new_byte = int(input())
with open("chal.bin", "rb") as f:
contents = f.read()
contents = contents[:leap] + bytes([new_byte]) + contents[leap+1:]
with tempfile.NamedTemporary... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SpaceHeroes/2023/crypto/CryptographicSpaceRover/nasa_crypto.py | ctfs/SpaceHeroes/2023/crypto/CryptographicSpaceRover/nasa_crypto.py | import psutil
import datetime
import os
import signal
import subprocess
import uuid
import setproctitle
#python3 -m pip install setproctitle
def get_dashes(perc):
dashes = "|" * int((float(perc) / 10 * 4))
empty_dashes = " " * (40 - len(dashes))
return dashes, empty_dashes
def print_top(guess, uuid):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SpaceHeroes/2023/crypto/Ive-got-the-same-combination-on-my-luggage/luggage_combination.py | ctfs/SpaceHeroes/2023/crypto/Ive-got-the-same-combination-on-my-luggage/luggage_combination.py | from pwn import *
plaintext = b'****************************************'
key1 = b'****************************************'
key2 = b'****************************************'
def shield_combination(p, k1, k2):
A = xor(p, k1, k2)
B = xor(p, k1)
C = xor(p, k2)
return A + B + C
print(shield_combination(plaintext, ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SpaceHeroes/2023/crypto/DSAlien/DSAlien.py | ctfs/SpaceHeroes/2023/crypto/DSAlien/DSAlien.py | #!/usr/bin/python3
import sys
import random, time
from Crypto.PublicKey import DSA
from Crypto.Hash import SHA256
from Crypto.Util.number import inverse
MASTER_KEY = DSA.generate(1024)
USER_KEY = None
CHALL = None
LAST_SIGNED_MSG = None
def get_opts():
opt = 0
while opt < 1 or opt > 4:
print("1) Generate ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SpaceHeroes/2022/rev/CapeKennedy/moon.py | ctfs/SpaceHeroes/2022/rev/CapeKennedy/moon.py | import sys
def main():
if len(sys.argv) != 2:
print("Invalid args")
return
password = sys.argv[1]
builder = 0
for c in password:
builder += ord(c)
if builder == 713 and len(password) == 8 and (ord(password[2]) == ord(password[5])):
if (ord(password[3]) == ord(password[4])) and ((ord(pa... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FooBarCTF/2021/crypto/Lost-N/enc.py | ctfs/FooBarCTF/2021/crypto/Lost-N/enc.py | from Crypto.Util.number import getPrime, bytes_to_long, inverse
p = getPrime(512)
q = getPrime(512)
n = p * q
e = 65537
plain = open('plaintext.txt','r').read().lower()
ct = []
f = open('encrypted','w')
for i in plain:
ct.append(pow(ord(i),e,n))
f.write('ct = ' + str(ct) + '\n')
#f.write('n = ' + str(n) + '\n') | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FooBarCTF/2021/crypto/Back-to-the-future/server.py | ctfs/FooBarCTF/2021/crypto/Back-to-the-future/server.py | #!/usr/bin/env python3
import arrow
import json
import random
import sys
keys = {
"a": 15498798452335698516189763255,
"b": 4
}
with open('flag') as f:
flag = f.read()
with open('/dev/urandom', 'rb') as f:
rand = f.read(8)
rand_int = int(rand.hex(), 16)
random.seed(rand_int)
offset = random.rand... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FooBarCTF/2025/rev/Bitmap_Mystery/compressed.py | ctfs/FooBarCTF/2025/rev/Bitmap_Mystery/compressed.py | import struct
def compress_bmp(input_file, output_file):
with open(input_file, "rb") as f:
header = f.read(54) # BMP header (first 54 bytes)
pixel_data = f.read()
compressed_data = bytearray()
prev_byte = None
count = 0
for byte in pixel_data:
transformed_byte = byte ^ 0x... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FooBarCTF/2022/crypto/TrailingBits/chall.py | ctfs/FooBarCTF/2022/crypto/TrailingBits/chall.py |
from Crypto.Util.number import getPrime, bytes_to_long, GCD
from random import randint
flag = bytes_to_long(b"#REDACTED")
p = getPrime(1024)
q = getPrime(1024)
N= p*q
e = 0x10001
x = 20525505347673424633540552541653983694845618896895730522108032420068957585904662258035635517965886817710455542800215902662848701181206... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FooBarCTF/2022/crypto/new-intern/server.py | ctfs/FooBarCTF/2022/crypto/new-intern/server.py | #!/usr/bin/env python3
from Crypto.Util.number import *
from random import getrandbits
flag = b'***********************REDACTED***********************'
FLAG = bytes_to_long(flag)
p = getStrongPrime(512)
q = getStrongPrime(512)
N = p * q
e = 17
menu = """
[1].CURR STATE
[2].ENCRYPT FLAG
[3].EXIT
"""
class PRNG(ob... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FooBarCTF/2022/crypto/RandomFandom/enc.py | ctfs/FooBarCTF/2022/crypto/RandomFandom/enc.py | #!/usr/bin/env python3
import random
import math
secret = #REDACTED
flag = #REDACTED
def keygen(n):
privKey = [0]*n
privKey[0] = #REDACTED
for i in range(1, n):
total = sum(privKey)
privKey[i] = random.randint(total*2 ,total*3)
privKey = tuple(privKey)
total = sum(privKey)
modulo = random.randint(total*2... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FooBarCTF/2022/crypto/BG/chall.py | ctfs/FooBarCTF/2022/crypto/BG/chall.py | #!/usr/bin/env python3
from Crypto.Util.number import *
import math
flag = b'***************REDACTED******************'
def keygen(bits):
while True:
p,q = getPrime(bits),getPrime(bits)
if (p % 4 == 3) and (q % 4 == 3 ) and (p != q):
n = p * q
break
return n
def keyge... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FooBarCTF/2022/crypto/babyRSA/enc.py | ctfs/FooBarCTF/2022/crypto/babyRSA/enc.py | from Crypto.Util.number import *
flag = b"GLUG{**********REDACTED***************}"
p,q = getPrime(1024),getPrime(1024)
N = p * p * q
e = 0x10001
phi = p * (p-1) * (q-1)
d = inverse(e, phi)
m = bytes_to_long(flag)
c = pow(m, e, N)
x = (p * q) % 2**1337
print("N = {}".format(N))
print("e = {}".format(e))
print("c =... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FooBarCTF/2022/web/FileClub/app.py | ctfs/FooBarCTF/2022/web/FileClub/app.py | #!/usr/bin/python3
from asyncio import subprocess
from flask import Flask, Response, redirect, request, render_template
from werkzeug.exceptions import RequestEntityTooLarge
from string import ascii_lowercase, digits
from random import choice
import os, tarfile, wave
from PIL import Image
import yaml
import zipfile
a... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/VULNCON/2021/crypto/baby_crypto_1/baby_crypto_1.py | ctfs/VULNCON/2021/crypto/baby_crypto_1/baby_crypto_1.py | from Crypto.PublicKey import RSA
from labmath import nextprime
from Crypto.Util.number import bytes_to_long
flag = bytes_to_long(b"REDACTED")
key = RSA.generate(2048)
p, q = key.p, key.q
n1 = p * q
n2 = nextprime(p + 0x1337) * nextprime(q + 0x69420)
e = 0x10001
print(n1)
print(n2)
# for alice
c1 = pow(flag, e, n1)... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/VULNCON/2021/crypto/baby_crypto_2/baby_crypto_2.py | ctfs/VULNCON/2021/crypto/baby_crypto_2/baby_crypto_2.py | from hashlib import sha1
from os import urandom
from Crypto.Util.number import bytes_to_long, getPrime
from collections import namedtuple
from textwrap import dedent
DIFFICULTY = 20
PubKey = namedtuple("PubKey", "p q g")
privkey = bytes_to_long(b"REDACTED")
class LCG:
def __init__(self, m: int, a: int, b: int) ->... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/VULNCON/2021/crypto/BitSafe/output.py | ctfs/VULNCON/2021/crypto/BitSafe/output.py | pub = [4137647121585689892896857389719115062097018396547624922152046732016089470545279070365457643449895773668970323820174704202537439284526191771643603977395707778536757021700921771897949761238702247541194865802841222849654485737378352751794043519210686210516863226229300477478518250194477037191759491947326954644465224... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | true |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/VULNCON/2021/crypto/BitSafe/chal.py | ctfs/VULNCON/2021/crypto/BitSafe/chal.py | from Crypto.Util.number import getRandomRange, long_to_bytes, bytes_to_long, inverse, GCD
class BitSafe:
def __init__(self, msg):
self.mbits = bin(bytes_to_long(msg))[2:]
self.tbits = len(self.mbits)
def keygen(self):
self.pub = []
self.priv = [ getRandomRange(2, 1 << 10) ]
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/VULNCON/2021/crypto/mfine/chal.py | ctfs/VULNCON/2021/crypto/mfine/chal.py | import random
def encrypt(plaintext):
ciphertext = ''
for letter in plaintext:
i = ALPHA.index(letter)
c = (a*i + b) % m
ciphertext += ALPHA[c]
return ciphertext
ALPHA = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ{}_ #"
m = len(ALPHA)
a = random.randrange(1, m)
b = random.randrange(1, m... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrateCTF/2024/rev/Extraterrestriell_Kommunikation/alien.py | ctfs/CrateCTF/2024/rev/Extraterrestriell_Kommunikation/alien.py | from PIL import Image
from math import lcm
morse_code_dict = {
'a': '.-', 'b': '-...', 'c': '-.-.', 'd': '-..', 'e': '.', 'f': '..-.',
'g': '--.', 'h': '....', 'i': '..', 'j': '.---', 'k': '-.-', 'l': '.-..',
'm': '--', 'n': '-.', 'o': '---', 'p': '.--.', 'q': '--.-', 'r': '.-.',
's': '...', 't': '-', ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrateCTF/2024/crypto/Skyltsmedjan/skyltsmedjan.py | ctfs/CrateCTF/2024/crypto/Skyltsmedjan/skyltsmedjan.py | from sympy import nextprime, randprime
from secrets import randbits, randbelow
from os import getenv
from sys import stdin
def get_flag(n: int, e: int, userid: int) -> None:
print("Var god skriv in ett meddelande som säger att du får hämta flaggan\n> ", end="")
msg = stdin.buffer.readline()[:-1]
m = int.fr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrateCTF/2025/misc/Echo_Service/echo_service.py | ctfs/CrateCTF/2025/misc/Echo_Service/echo_service.py | #!/usr/local/bin/python3
from os import chdir, system, remove
from shutil import rmtree, unpack_archive
from hashlib import sha256
chdir("/tmp")
ok = {}
if __name__ == "__main__":
while True:
rmtree("files", True)
try: remove("archive.tar.gz")
except: pass
match input("[v]alidate ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrateCTF/2025/pwn/Sandbox/chall.py | ctfs/CrateCTF/2025/pwn/Sandbox/chall.py | #!/usr/local/bin/python
# pip install capstone==5.0.6 pyelftools==0.32
from capstone import *
from capstone.x86 import *
from elftools.elf.elffile import ELFFile
import fcntl, io, os, sys, tempfile
md = Cs(CS_ARCH_X86, CS_MODE_64)
md.detail = True
checked = set()
def check(offset: int):
if offset in checked:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrateCTF/2025/rev/Eventually_a_Flag/printflag.py | ctfs/CrateCTF/2025/rev/Eventually_a_Flag/printflag.py | import string, time
alphabet = string.ascii_lowercase + string.ascii_uppercase + string.digits + "!#$%&()*+,-./:;<=>?@[]^_{|}~åäö "
ciphertext = "cq rbäl{%$0eYXm&5bV( Z&j@|2VoT2fVzö5)äXMömlfpmhhtawc]eiwvl2ö26a4Vm$3bP6@Rm5#r)ToR2p!XlZ.B8@);äfkldq=<}{[:#RkY4h55m8!r(,E{g:#z)-yRRäAs#nH?rbi|$|"
# TODO: Too much recursion... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrateCTF/2025/crypto/Julius_Caesar/julius_caesar.py | ctfs/CrateCTF/2025/crypto/Julius_Caesar/julius_caesar.py | import string, random, sys
alphabet = string.ascii_lowercase + "åäö "
def substitute(s: str, sub: str) -> str:
assert set(sub) == set(alphabet) and len(sub) == len(alphabet)
return "".join(alphabet[sub.index(c)] if c in alphabet else c for c in s.lower())
CHUNK_SIZE = 32
def substitute_better(s: str, init_su... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrateCTF/2025/crypto/collision/kollision.py | ctfs/CrateCTF/2025/crypto/collision/kollision.py | #!/usr/local/bin/python3
from collections.abc import Iterable
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
from itertools import batched
from sys import stdin
from os import system
def xor(a: Iterable[int], b: Iterable[int]) -> bytes:
return bytes(x ^ y for x, y in zip(a, b))
def hash(b: byt... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/CrateCTF/2025/crypto/Fiats_and_Shamirs_Sign_Forge/fiats_och_shamirs_skyltsmedja.py | ctfs/CrateCTF/2025/crypto/Fiats_and_Shamirs_Sign_Forge/fiats_och_shamirs_skyltsmedja.py | #!/usr/bin/env python3
from sympy import randprime
from secrets import randbelow
from hashlib import sha512
from itertools import batched
from os import getenv
from sys import stdin
from tqdm import tqdm
import readline # python can't read more than 4095 bytes on a line without this!?!?!?!!?
bits = 1024
# P = randpri... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/involuntaryCTF/2025/rev/Basic_python/basicPython.py | ctfs/involuntaryCTF/2025/rev/Basic_python/basicPython.py | def getFLag():
file=open("flag.txt","rt")
fileContents=file.read().strip()
return fileContents
def main():
a=getFLag()
b=[]
for i in range(len(a)):
if(i%2==0):
b.append(ord(a[i])+i)
else:
b.append(ord(a[i])-i)
for i in range(len(b)//2):
temp=... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UrchinSecAware/2024/code/Heart/app.py | ctfs/UrchinSecAware/2024/code/Heart/app.py | from flask import Flask, request, render_template_string
app = Flask(__name__)
@app.route('/name/<input_name>', methods=['GET'])
def say_name(input_name):
if request.method == 'GET':
if input_name is not None:
return render_template_string(f"Hello {input_name}")
if __name__ == '__main__':
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/UrchinSecAware/2024/crypto/Tr3ppl3_Stuffs/script.py | ctfs/UrchinSecAware/2024/crypto/Tr3ppl3_Stuffs/script.py | #!/usr/bin/env python3
from Crypto.Util.number import getPrime, bytes_to_long
with open('flag.txt', 'rb') as f:
flag = f.read()
p = getPrime(1024)
q = getPrime(1024)
r = getPrime(1024)
n1 = p * q
n2 = p * r
n3 = q * r
moduli = [n1, n2, n3]
e = 65537
c = bytes_to_long(flag)
for n in moduli:
c = pow(c, e, ... | 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.