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/RACTF/2021/web/Emojibook/notes/migrations/0001_initial.py | ctfs/RACTF/2021/web/Emojibook/notes/migrations/0001_initial.py | # Generated by Django 3.2.6 on 2021-08-10 21:55
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/RACTF/2021/web/Emojibook/notes/migrations/__init__.py | ctfs/RACTF/2021/web/Emojibook/notes/migrations/__init__.py | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false | |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2024/blockchain/Betray_your_master/solve-pow.py | ctfs/BackdoorCTF/2024/blockchain/Betray_your_master/solve-pow.py | import hashlib,random
x = 100000000+random.randint(0,200000000000)
for i in range(x,x+20000000000):
m = hashlib.sha256()
ticket = str(i)
m.update(ticket.encode('ascii'))
digest1 = m.digest()
m = hashlib.sha256()
m.update(digest1 + ticket.encode('ascii'))
if m.hexdigest().startswith('0000000'):
print(i)
break... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2024/blockchain/Curvy_Pool/solve-pow.py | ctfs/BackdoorCTF/2024/blockchain/Curvy_Pool/solve-pow.py | import hashlib,random
x = 100000000+random.randint(0,200000000000)
for i in range(x,x+20000000000):
m = hashlib.sha256()
ticket = str(i)
m.update(ticket.encode('ascii'))
digest1 = m.digest()
m = hashlib.sha256()
m.update(digest1 + ticket.encode('ascii'))
if m.hexdigest().startswith('0000000'):
print(i)
break... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2024/blockchain/EasyPeasyLemonSqueezy/solve-pow.py | ctfs/BackdoorCTF/2024/blockchain/EasyPeasyLemonSqueezy/solve-pow.py | import hashlib,random
x = 100000000+random.randint(0,200000000000)
for i in range(x,x+20000000000):
m = hashlib.sha256()
ticket = str(i)
m.update(ticket.encode('ascii'))
digest1 = m.digest()
m = hashlib.sha256()
m.update(digest1 + ticket.encode('ascii'))
if m.hexdigest().startswith('0000000'):
print(i)
break... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2024/misc/Decompressor/chall.py | ctfs/BackdoorCTF/2024/misc/Decompressor/chall.py | #!/usr/bin/env python3
import random
from collections import Counter
from numpy import poly1d
from queue import PriorityQueue
from src.secret import flag, coeff
assert len(flag) == 49
assert len(coeff) == 6
assert all(x > 0 and isinstance(x, int) for x in coeff)
P = poly1d(coeff)
class Node:
def __init__(self,... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2024/crypto/AESwap/chall.py | ctfs/BackdoorCTF/2024/crypto/AESwap/chall.py | from aes import *
from flag import flag
import os
NSWAPS = 42*6 - 42//2 + 4
msg = b'thoushaltnotpass'
assert len(msg) == 16
for i in range(NSWAPS):
indices = list(
map(int, input(f"({i+1}) Bribe soldiers to swap their positions: ").split()))
s_box[indices[0]], s_box[indices[1]] = s_box[indices[1]], s... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2024/crypto/AESwap/aes.py | ctfs/BackdoorCTF/2024/crypto/AESwap/aes.py | #!/usr/bin/env python3
"""
This is an exercise in secure symmetric-key encryption, implemented in pure
Python (no external libraries needed).
Original AES-128 implementation by Bo Zhu (http://about.bozhu.me) at
https://github.com/bozhu/AES-Python . PKCS#7 padding, CBC mode, PKBDF2, HMAC,
byte array and string support... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2024/crypto/I_Like_McDonalds/server.py | ctfs/BackdoorCTF/2024/crypto/I_Like_McDonalds/server.py | import hashlib
from typing import List
class CustomMAC:
def __init__(self):
self._internal_state = b""
def update(self, message: bytes) -> None:
if not self._internal_state:
self._internal_state = self.get_key() + message
else:
self._internal_state += me... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2023/blockchain/BabyBlackjack/solve-pow.py | ctfs/BackdoorCTF/2023/blockchain/BabyBlackjack/solve-pow.py | import hashlib,random
x = 100000000+random.randint(0,200000000000)
for i in range(x,x+20000000000):
m = hashlib.sha256()
ticket = str(i)
m.update(ticket.encode('ascii'))
digest1 = m.digest()
m = hashlib.sha256()
m.update(digest1 + ticket.encode('ascii'))
if m.hexdigest().startswith('0000000'):
print(i)
break... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2023/blockchain/VulnChain/solve-pow.py | ctfs/BackdoorCTF/2023/blockchain/VulnChain/solve-pow.py | import hashlib,random
x = 100000000+random.randint(0,200000000000)
for i in range(x,x+20000000000):
m = hashlib.sha256()
ticket = str(i)
m.update(ticket.encode('ascii'))
digest1 = m.digest()
m = hashlib.sha256()
m.update(digest1 + ticket.encode('ascii'))
if m.hexdigest().startswith('0000000'):
print(i)
break... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2023/misc/Not_So_Guessy/Guessy_1970.py | ctfs/BackdoorCTF/2023/misc/Not_So_Guessy/Guessy_1970.py | Secret_Number = "REDACTED"
Flag = "REDACTED"
coin = {1:'Heads', 0:'Tails'}
wins = 0
print("Welcome to The Guessy Game.")
print("To get The Flag, you have to beat me in Heads and Tails until I admit defeat.")
print("However if you lose once, You Lose.")
while Secret_Number:
draw = coin[Secret_Number % 2]
Secr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2023/misc/Not_So_Guessy/Guessy_2020.py | ctfs/BackdoorCTF/2023/misc/Not_So_Guessy/Guessy_2020.py | Secret_Number = "REDACTED"
Flag = "REDACTED"
AI = {2:'Scissors', 1:'Paper', 0:'Rock'}
win = {'Rock':'Paper','Paper':'Scissors','Scissors':'Rock'}
draws = 0
wins = 0
print("Welcome to The Guessy Game.")
print("To get The Flag, you have to beat the AI I made in Rock, Paper, Scissors until it can't take the losses and s... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2023/misc/mini_RSA_v2/chal.py | ctfs/BackdoorCTF/2023/misc/mini_RSA_v2/chal.py | from Crypto.Util.number import getPrime , bytes_to_long , GCD
import random
import time
random.seed(time.time())
flag = b"flag{REDACTED}" #Flag has been removed
KEY_SIZE = 512
RSA_E = 65537
def fast_exp(a, b, n):
output = 1
while b > 0:
if b & 1:
output = output * a % n
a = a * a ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2023/misc/mini_RSA/script.py | ctfs/BackdoorCTF/2023/misc/mini_RSA/script.py | from Crypto.Util.number import getPrime , bytes_to_long , GCD
import random
import time
random.seed(time.time())
flag = b"flag{REDACTED}" #Flag has been removed
KEY_SIZE = 512
RSA_E = 3
def fast_exp(a, b, n):
output = 1
while b > 0:
if b & 1:
output = output * a % n
a = a * a % n
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2023/misc/secret_of_j4ck4l/app.py | ctfs/BackdoorCTF/2023/misc/secret_of_j4ck4l/app.py | from flask import Flask, request, render_template_string, redirect
import os
import urllib.parse
app = Flask(__name__)
base_directory = "message/"
default_file = "message.txt"
def ignore_it(file_param):
yoooo = file_param.replace('.', '').replace('/', '')
if yoooo != file_param:
return "Illegal chara... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2023/misc/Something_in_Common/script.py | ctfs/BackdoorCTF/2023/misc/Something_in_Common/script.py | from Crypto.Util.number import *
flag = "This flag has been REDACTED"
moduli = "This array has been REDACTED"
m = bytes_to_long(flag.encode())
e = 3
remainders = [pow(m,e,n) for n in moduli]
f = open('output.txt','w')
for i in range(len(moduli)):
f.write(f"m ^ e mod {moduli[i]} = {remainders[i]}\n")
f.write(f"\n... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2023/crypto/ColL3g10n/script.py | ctfs/BackdoorCTF/2023/crypto/ColL3g10n/script.py | from hashlib import md5, sha256
import random
from Crypto.Util.number import *
alphanum = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
flag = "This flag has been REDACTED"
secret = ''.join(random.choices(alphanum,k=10))
sec_num = bytes_to_long(secret.encode())
history = []
tries = 3
while tries:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2023/crypto/Safe_Curvy_Curve/chall.py | ctfs/BackdoorCTF/2023/crypto/Safe_Curvy_Curve/chall.py | from Crypto.Util.number import getPrime, getRandomNBitInteger, bytes_to_long, long_to_bytes
from sage.all import *
n = 32532575518248105867058943923719522548379790154983883514638875650596251599273168290217484337847379311801382458768674380144322943509737902464340842995771759007227549873439684048926198636176493579108308... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2023/crypto/Curvy_Curves/chall.py | ctfs/BackdoorCTF/2023/crypto/Curvy_Curves/chall.py | from Crypto.Util.number import getRandomNBitInteger, bytes_to_long, long_to_bytes
from sage.all import *
# non-residue
D = 1364495724932358941050400633456489633827687412278292251558735294397880001419243020712471440683772231705024384693235952787119062136532279729590115735200038213722156167615557192472872499288791212785... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2023/crypto/Knapsack/script.py | ctfs/BackdoorCTF/2023/crypto/Knapsack/script.py | import random
import hashlib
from Crypto.Util.number import bytes_to_long
from Crypto.Cipher import AES
flag = b"The flag has been REDACTED"
secret = b"The seccret has been REDACTED"
key = hashlib.sha256(secret).digest()[:16]
cipher = AES.new(key, AES.MODE_ECB)
padded_flag = flag + b'\x00'*(-len(flag)%16)
ciphertext... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2025/crypto/The_Job/server.py | ctfs/BackdoorCTF/2025/crypto/The_Job/server.py | import random
rand = random.SystemRandom()
from flag import FLAG
k = 256
mod = 10**9+7
hash_table = [[] for i in range(k)]
print("Your friend, a full stack developer, was asked to implement a hash table by his boss. Your friend, being an experienced individual, created a hash table which has 256 slots, and each slot ca... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2025/crypto/p34kC0nj3c7ur3/chall.py | ctfs/BackdoorCTF/2025/crypto/p34kC0nj3c7ur3/chall.py | from Cryptodome.Util.number import isPrime, bytes_to_long, long_to_bytes
from message import message
def uniqueHash(x):
steps = 0
while x != 1:
steps += 1
if x % 2 == 0:
x = x // 2
else:
x = 3 * x + 1
if steps >= 10000:
return steps
return... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2025/crypto/Ambystoma_Mexicanum_Revenge/chall.py | ctfs/BackdoorCTF/2025/crypto/Ambystoma_Mexicanum_Revenge/chall.py | from cryptography.hazmat.primitives.ciphers.aead import AESGCMSIV
import binascii
import os
KEY_SIZE = 16
NONCE_SIZE = 12
FLAG = "flag{lol_this_is_obv_not_the_flag}"
KEYS = []
CIPHERTEXTS = []
CIPHERTEXTS_LEN = 1
REQUEST = "gib me flag plis"
class Service:
def __init__(self):
self.key = self.gen_key()
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2025/crypto/bolt_fast/chall.py | ctfs/BackdoorCTF/2025/crypto/bolt_fast/chall.py | from Crypto.Util.number import getPrime, inverse, bytes_to_long
def flash_key():
while True:
p = getPrime(1024)
q = getPrime(1024)
N = p * q
#you can't even use weiner's attack now hahaha
dp_smart= getPrime(16)
try:
e = inverse(dp_smart, p-1)
r... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2025/crypto/lcg_2/chall.py | ctfs/BackdoorCTF/2025/crypto/lcg_2/chall.py | import sys
from secrets import randbelow
from Crypto.Util.number import getPrime
FLAG = "flag{REDACTED}"
MAIN_BITS = 128
INTERVAL_MODULUS = 1031
class LCG:
"""A Linear Congruential Generator class."""
def __init__(self, a, c, m, seed=None):
self.a = a
self.c = c
self.m = m
if s... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2025/crypto/Ambystoma_Mexicanum/chall.py | ctfs/BackdoorCTF/2025/crypto/Ambystoma_Mexicanum/chall.py | from cryptography.hazmat.primitives.ciphers.aead import AESGCMSIV
import binascii
import os
KEY_SIZE = 16
NONCE_SIZE = 12
FLAG = "flag{lol_this_is_obv_not_the_flag}"
KEYS = []
CIPHERTEXTS = []
CIPHERTEXTS_LEN = 1
REQUEST = "gib me flag plis"
class Service:
def __init__(self):
self.key = self.gen_key()
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2025/crypto/m4candch3353/chall.py | ctfs/BackdoorCTF/2025/crypto/m4candch3353/chall.py | import math
from Crypto.Hash import CMAC
from Crypto.Util.number import long_to_bytes, getPrime, bytes_to_long, isPrime
from Crypto.Cipher import AES
from hidden import power_tower_mod, flag
assert bytes_to_long(flag).bit_length() == 1263
"""
power_tower_mod -> takes x, n and some data and returns
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2022/crypto/Fishy/chall.py | ctfs/BackdoorCTF/2022/crypto/Fishy/chall.py | from random import getrandbits as grb
from Crypto.Util.number import bytes_to_long as bl
modulus = pow(2, 32)
s_boxes = [[grb(32) for i in range(256)] for j in range(4)]
f = open("s_boxes.txt", "w")
f.write(str(s_boxes))
f.close()
initial_sub_keys = [
"243f6a88",
"85a308d3",
"13198a2e",
"03707344",
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2022/crypto/Morph/chall.py | ctfs/BackdoorCTF/2022/crypto/Morph/chall.py | #!/usr/bin/python
from sage.all import *
from Crypto.Util.number import bytes_to_long, long_to_bytes
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
import random
import os
import hashlib
from base64 import b64encode, b64decode
p = 100458505468885003633418577656224333902553170484436983273607309... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2022/crypto/RandomNonsense/chall.py | ctfs/BackdoorCTF/2022/crypto/RandomNonsense/chall.py | #!/usr/bin/python
from Crypto.Util.number import long_to_bytes, bytes_to_long
from math import gcd
import ecdsa
import random
import hashlib
import string
Curve = ecdsa.NIST384p
G = Curve.generator
n = Curve.order
counter = 7
flag = 'REDACTED'
msg_to_sign = b'''Sign me to get the flag'''
KEYS = string.ascii_letters +... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2022/crypto/WhatTheCure/chall.py | ctfs/BackdoorCTF/2022/crypto/WhatTheCure/chall.py | #!/usr/bin/python3
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
from Crypto.Util.number import long_to_bytes
from random import randint
from hashlib import sha256
import json
from secret import p, G, flag
def points_add(P, Q):
x1, y1 = P
x2, y2 = Q
m = (1 - x1 * x2) % p
x = ((x1 ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2022/web/S3KSU4L_INJ3C710N/chall/generate.py | ctfs/BackdoorCTF/2022/web/S3KSU4L_INJ3C710N/chall/generate.py | import random
from faker import Faker
from main import db,User
faker=Faker()
hexc=[]
for i in range(16):
hexc.append(hex(i)[2:])
for i in range(50):
random.shuffle(hexc)
passwords=[]
lucky=random.randint(100,400)
f=open('users.txt','w')
for i in range(500):
random.shuffle(hexc)
passwords.append("".join(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2022/web/S3KSU4L_INJ3C710N/chall/main.py | ctfs/BackdoorCTF/2022/web/S3KSU4L_INJ3C710N/chall/main.py | from flask import Flask, render_template, request
from flask_sqlalchemy import SQLAlchemy
from helpsort import helper
import random
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
class User(db.Model):
id... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BackdoorCTF/2022/web/S3KSU4L_INJ3C710N/chall/helpsort.py | ctfs/BackdoorCTF/2022/web/S3KSU4L_INJ3C710N/chall/helpsort.py | from collections import OrderedDict
def helper(data, prop, is_data=False):
pr = prop.split('.')
pr1= prop.split('.')
count=0
for p in pr:
if count == 2:
return None
count+=1
pr1=pr1[1:]
nextprop = '.'.join(pr1)
if hasattr(data, p):
if nex... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/misc/Alice_and_Bob_Flip_a_Bit_Easiest/main.py | ctfs/FE-CTF/2023/misc/Alice_and_Bob_Flip_a_Bit_Easiest/main.py | #!/usr/bin/env python3
import json, os, random, mmap
from seccomp import SyscallFilter, Arg, ALLOW, EQ, MASKED_EQ, KILL
random = random.SystemRandom()
ROUNDS = 1000
def recv(io):
fd, _ = io
r = b''
while True:
c = os.read(fd, 1)
if c in (b'', b'\0'):
break
r += c
if... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/misc/Alice_and_Bob_Flip_a_Bit_Easier/main.py | ctfs/FE-CTF/2023/misc/Alice_and_Bob_Flip_a_Bit_Easier/main.py | #!/usr/bin/env python3
import json, os, random, mmap
from seccomp import SyscallFilter, Arg, ALLOW, EQ, MASKED_EQ, KILL
random = random.SystemRandom()
ROUNDS = 1000
def recv(io):
fd, _ = io
r = b''
while True:
c = os.read(fd, 1)
if c in (b'', b'\0'):
break
r += c
if... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/misc/Asteroids_Cadet/course-correction.py | ctfs/FE-CTF/2023/misc/Asteroids_Cadet/course-correction.py | #!/usr/bin/env python3
from pwn import *
from Crypto.Cipher import AES
WARP_COORDINATES = b'00000000-0000-0000-0000-000000000000'
HOST = args.get('HOST', 'localhost')
PORT = int(args.get('PORT', 1337))
sock = remote(HOST, PORT)
def course_correction(asteroids):
'''We need to make this function run faster, sir''... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/misc/Alice_and_Bob_Flip_a_Bit_Easy/main.py | ctfs/FE-CTF/2023/misc/Alice_and_Bob_Flip_a_Bit_Easy/main.py | #!/usr/bin/env python3
import json, os, random, mmap
from seccomp import SyscallFilter, Arg, ALLOW, EQ, MASKED_EQ, KILL
random = random.SystemRandom()
ROUNDS = 1000
def recv(io):
fd, _ = io
r = b''
while True:
c = os.read(fd, 1)
if c in (b'', b'\0'):
break
r += c
if... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/pwn/Crackstation_Level_3/crackstation.py | ctfs/FE-CTF/2023/pwn/Crackstation_Level_3/crackstation.py | #!/usr/bin/env python3
# coding: utf-8
# 外国人想法真是不一样
import base64
import ctypes
import importlib
import os
import struct
import sys
import zlib
from Crypto.Cipher import AES
from hashlib import md5
assert sys.maxsize > 9876543210, 'Can\'t run on a steam engine :('
assert sys.platform[0] == 'l', 'Software update require... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/pwn/Crackstation_Level_3/server.py | ctfs/FE-CTF/2023/pwn/Crackstation_Level_3/server.py | #!/usr/bin/env -S python3 -u
import sys
import re
import os
import signal
import tempfile
ok = re.compile(r'^[a-z0-9_.-]+@[a-z0-9_.-]+\s+//\s+[a-f0-9]{32}$')
print('Send hash list, then end with a blank line')
sys.stdout.flush()
lines = ['import crackstation']
for lino, line in enumerate(sys.stdin.buffer.raw, 1):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/pwn/Crackstation_Level_1/crackstation.py | ctfs/FE-CTF/2023/pwn/Crackstation_Level_1/crackstation.py | #!/usr/bin/env python3
# coding: utf-8
# 外国人想法真是不一样
import base64
import ctypes
import importlib
import os
import struct
import sys
import zlib
from Crypto.Cipher import AES
from hashlib import md5
assert sys.maxsize > 9876543210, 'Can\'t run on a steam engine :('
assert sys.platform[0] == 'l', 'Software update require... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/pwn/Crackstation_Level_1/lolcat.py | ctfs/FE-CTF/2023/pwn/Crackstation_Level_1/lolcat.py | #!/usr/bin/env python3
import crackstation
webertanya@yahoo.com // cacd5501925ccf1736814dca112a57a2
stephanie71@cherry-carter.info // bd5428030cc01ccb2fdd52f533b24808
benjaminconrad@gmail.com // c980664827796011e26607b8b4dabd5e
klarson@gmail.com // b9d956700f8f80986e613ef969821274
p... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/pwn/Crackstation_Level_1/server.py | ctfs/FE-CTF/2023/pwn/Crackstation_Level_1/server.py | #!/usr/bin/env -S python3 -u
import sys
import re
import os
import signal
import tempfile
ok = re.compile(r'^[a-z0-9_.-]+@[a-z0-9_.-]+\s+//\s+[a-f0-9]{32}$')
print('Send hash list, then end with a blank line')
sys.stdout.flush()
lines = ['import crackstation']
for lino, line in enumerate(sys.stdin.buffer.raw, 1):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/pwn/Crackstation_Warmup/crackstation.py | ctfs/FE-CTF/2023/pwn/Crackstation_Warmup/crackstation.py | #!/usr/bin/env python3
# coding: utf-8
# 外国人想法真是不一样
import base64
import ctypes
import importlib
import os
import struct
import sys
import zlib
from Crypto.Cipher import AES
from hashlib import md5
assert sys.maxsize > 9876543210, 'Can\'t run on a steam engine :('
assert sys.platform[0] == 'l', 'Software update require... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/pwn/Crackstation_Warmup/runme.py | ctfs/FE-CTF/2023/pwn/Crackstation_Warmup/runme.py | #!/usr/bin/env python3
import crackstation
ethanking@yahoo.com // d3886f99adaf4a39da593981374810f9
robinsoncarol@jacobson.com // ec17a2968f8ce5f644e38b4a5f448f05
edwingray@gmail.com // bae55dc19b3ec29415ebc258ae145b6f
cindy00@hernandez.com // af2331661cc7943c71... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/pwn/Crackstation_Level_4/crackstation.py | ctfs/FE-CTF/2023/pwn/Crackstation_Level_4/crackstation.py | #!/usr/bin/env python3
# coding: utf-8
# 外国人想法真是不一样
import base64
import ctypes
import importlib
import os
import struct
import sys
import zlib
from Crypto.Cipher import AES
from hashlib import md5
assert sys.maxsize > 9876543210, 'Can\'t run on a steam engine :('
assert sys.platform[0] == 'l', 'Software update require... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/pwn/Crackstation_Level_4/server.py | ctfs/FE-CTF/2023/pwn/Crackstation_Level_4/server.py | #!/usr/bin/env -S python3 -u
import sys
import re
import os
import signal
import tempfile
ok = re.compile(r'^[a-z0-9_.-]+@[a-z0-9_.-]+\s+//\s+[a-f0-9]{32}$')
print('Send hash list, then end with a blank line')
sys.stdout.flush()
lines = ['import crackstation']
for lino, line in enumerate(sys.stdin.buffer.raw, 1):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/pwn/Crackstation_Level_2/crackstation.py | ctfs/FE-CTF/2023/pwn/Crackstation_Level_2/crackstation.py | #!/usr/bin/env python3
# coding: utf-8
# 外国人想法真是不一样
import base64
import ctypes
import importlib
import os
import struct
import sys
import zlib
from Crypto.Cipher import AES
from hashlib import md5
assert sys.maxsize > 9876543210, 'Can\'t run on a steam engine :('
assert sys.platform[0] == 'l', 'Software update require... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/pwn/Crackstation_Level_2/server.py | ctfs/FE-CTF/2023/pwn/Crackstation_Level_2/server.py | #!/usr/bin/env -S python3 -u
import sys
import re
import os
import signal
import tempfile
ok = re.compile(r'^[a-z0-9_.-]+@[a-z0-9_.-]+\s+//\s+[a-f0-9]{32}$')
print('Send hash list, then end with a blank line')
sys.stdout.flush()
lines = ['import crackstation']
for lino, line in enumerate(sys.stdin.buffer.raw, 1):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/crypto/Two_Time_Pad/imgcrypt.py | ctfs/FE-CTF/2023/crypto/Two_Time_Pad/imgcrypt.py | #!/usr/bin/env python3
import os
import sys
import itertools
from PIL import Image, ImageChops
from argon2.low_level import hash_secret_raw, Type
def expand_key(key, size):
return hash_secret_raw(
key,
hash_len=size,
salt=b'saltysalt',
time_cost=1,
memory_cost=1024,
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2023/crypto/Padding_Oracle/server.py | ctfs/FE-CTF/2023/crypto/Padding_Oracle/server.py | #!/usr/bin/env -S python3 -u
import os
import threading
import sys
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
from Crypto.Util.Padding import pad, unpad
from binascii import hexlify
os.chdir(os.path.dirname(__file__))
KEY = open("server.key", "rb").read()
FLAG_TXT = open("flag.txt").read(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2022/pwn/snake-oil/magic.py | ctfs/FE-CTF/2022/pwn/snake-oil/magic.py | import os,sys
_ = 'aIaabVaacaXadaaaeaaafaaagaaahaaaiaaajaaakaaalaaamaLanaaaoaaapaaaqaaaraaa'\
'saaataaauaaavaaawaaaxaaayaaaCaabbaabcaabdaabeaabfaabgaabhaabiaabjaabkaab'\
'laabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaabzaacbaaccaacdaac'\
'eaacfaacgaachaaciaacjaackaaclaacmaacnaacoaacpaacqaacraacsaact... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2022/pwn/snake-oil/runme.py | ctfs/FE-CTF/2022/pwn/snake-oil/runme.py | #!/usr/bin/env python3
import magic;_%_>_+_&_%_%_-_%_@_+_/_/_%_&_^_%_^_|_@_@_%_<_<_|_+_%_|_/_@_+_%_%_&_@_+_@_<\
_^_^_&_@_|_^_^_&_@_%_^_^_&_/_|_<_|_^_%_<_>_+_+_+_%_-_<_|_^_*_&_^_^_%_<_&_@_+_+_%_-_<_@_\
%_-_|_^_+_%_<_%_|_+_+_%_-_<_|_%_-_|_^_+_@_-_^_^_&_^_%_%_^_^_%_<_%_|_+_%_|_+_>_+_%_%_&_@\
_+_%_@_+_+_+_@_<_^_^_&_@_|_^_^... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2022/rev/snake-jazz/magic.py | ctfs/FE-CTF/2022/rev/snake-jazz/magic.py | import sys,os
class X(object):
def __init__(x,a=0,b=0,c=0):
x.a=a
x.b=b or ~-a
x.c=c
def __invert__(x):
x.c-=x.c
return X(x.a,x.b,x.c)
def __pow__(x, y):
x=~x
x.a*=y
x.b*=y
x.c+=3
return x
def __pos__(x):
x**=3
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2022/rev/snake-jazz/runme.py | ctfs/FE-CTF/2022/rev/snake-jazz/runme.py | #!/usr/bin/env python3
import magic;_+___+---+---+-__+++-+_-_+_++_++++-+-_+_++_-__-_-+++-++---\
_+_+-+++-+--++__-++___++++_-+_-+__+-+++_-+-_-_-_+_+++-_+--++-_+_-+_---_\
+_-+--_-++_+_--_--+_++_+__-++-+_++--+__+__++-___++_+_--__-_-__--+--_-_-\
--++__-+-____-_+++-_++---+-__+++++_+-+++-___+_++-__-_--_-_-_--+-+++--_-\
_++__... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2022/crypto/trust-issues/mac.py | ctfs/FE-CTF/2022/crypto/trust-issues/mac.py | #!/usr/bin/env python3
import sys
import random
import base64
import struct
KEY_LEN = 16
TAG_LEN = 16
def generate_key():
return random.randbytes(KEY_LEN)
def import_key(path):
key = base64.b64decode(open(path, 'rb').read().strip())
assert len(key) == KEY_LEN
return key
def export_key(key, path):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/FE-CTF/2022/crypto/trust-issues/vm.py | ctfs/FE-CTF/2022/crypto/trust-issues/vm.py | #!/usr/bin/env python3
import sys
import os
import time
import types
class VM(object):
OP_VLQ = 0x80
OP_NEW = 0x81
OP_SHOW = 0x82
OP_SAVE = 0x83
OP_DIG = 0x84
OP_BURY = 0x85
OP_ZAP = 0x86
OP_POP = 0x87
OP_PULL = 0x88
OP_PEEK = 0x89
OP_PUSH = 0x8a
OP_DUP = 0x8b
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Tamil/2021/crypto/AEXOR/enc.py | ctfs/Tamil/2021/crypto/AEXOR/enc.py | from Crypto.Cipher import AES
from os import *
from binascii import *
from pwn import xor
from TamilCTF import *
key = getkey()
rep_key = getsubkey()
enc = b''
for i in range(len(key)):
enc += hexlify(xor(key[i],rep_key[i%len(rep_key)]))
msg = flag()
iv = urandom(16)
cipher = AES.new(key,AES.MODE_XXX,iv)
ciphertext ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SpookyCTF/2024/crypto/encryption_activated/encrypt.py | ctfs/SpookyCTF/2024/crypto/encryption_activated/encrypt.py | def mycipher(myinput):
global myletter
rawdecrypt = list(myinput)
for iter in range(0,len(rawdecrypt)):
rawdecrypt[iter] = chr(ord(rawdecrypt[iter]) + ord(myletter))
myletter = chr(ord(myletter) + 1)
encrypted = "".join(rawdecrypt)
print("NICC{" + encrypted + "}")
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/ECW/2025/Quals/web/Alice_and_the_Literal_Escape/src.py | ctfs/ECW/2025/Quals/web/Alice_and_the_Literal_Escape/src.py | from fastapi import FastAPI, Request, Form
from fastapi.templating import Jinja2Templates
from fastapi.responses import HTMLResponse
from guard.middleware import SecurityMiddleware
from guard.models import SecurityConfig
import psycopg2, subprocess, textwrap, os, json
TRUSTED_IPS = ["127.0.0.1"]
app = FastAPI()
confi... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Kind4SUS/2025/misc/talking_to_the_void/server.py | ctfs/Kind4SUS/2025/misc/talking_to_the_void/server.py | from subprocess import run, PIPE
from secrets import token_bytes
from hashlib import sha256
from base64 import b64encode, b64decode
from time import sleep
class RNG:
def __init__(self):
secret = token_bytes(16).hex()
def digest(state):
state = secret + state
state = sha256(state.encode()).digest()
state ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Kind4SUS/2025/misc/gravity_well/server.py | ctfs/Kind4SUS/2025/misc/gravity_well/server.py | #!/bin/env python3
from subprocess import run
def test_len(*args):
return lambda x: len(x) in range(*args)
def test_ascii(x):
return str.isascii(x)
def test_alpha(x):
return str.isalpha(x)
def test_upper(x):
return str.isupper(x)
def test_on(x):
return lambda test: test(x)
def safe(x):
return "'" not in x
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Kind4SUS/2025/pwn/The_kindling_of_the_first_Flag/chall.py | ctfs/Kind4SUS/2025/pwn/The_kindling_of_the_first_Flag/chall.py | import hashlib
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
import os
import base64
import random
FLAG = "JlLScp2qTzfFZ7kIYP6Jm5Mv/2h6p26S0OWgmXYdEMAl1Sjg6hwW95bPsZdtiggvHVVv8zM+x7vRw2qOr3ORbw=="
RED = "\033[0;31m"
PURPLE = "\033[0;35m"
ITALIC = "\033[3m"
BOLD = "\033[1m"
UNDERLINE = "\033[... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Kind4SUS/2025/crypto/Lightning_Fast_Scrambling/lfs.py | ctfs/Kind4SUS/2025/crypto/Lightning_Fast_Scrambling/lfs.py | from hashlib import sha256
from base64 import b64encode, b64decode
# utility wrapper for hashing
def digest(message):
"Gives a bytes object representing the sha256 encoding of its argument (a sequence of bytes)"
return sha256(message).digest()
# utility wrapper for encoding and decoding
def base64_encode(x):
"En... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Kind4SUS/2025/crypto/Feistel_heart/challenge.py | ctfs/Kind4SUS/2025/crypto/Feistel_heart/challenge.py | from Crypto.Util.number import bytes_to_long, getPrime, long_to_bytes
from Crypto.Util.Padding import pad
import os, signal
assert("FLAG" in os.environ)
FLAG = os.environ["FLAG"]
assert(FLAG.startswith("KSUS{") and FLAG.endswith("}"))
def xor_bytes(bytes_a, bytes_b):
return bytes(a ^ b for a, b in zip(bytes_a, by... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TMUCTF/2021/crypto/Signed_Flag/challenge.py | ctfs/TMUCTF/2021/crypto/Signed_Flag/challenge.py | from string import ascii_uppercase, ascii_lowercase, digits
from random import randrange, choice
from Crypto.PublicKey import DSA
from hashlib import sha1
from gmpy2 import xmpz, to_binary, invert, powmod, is_prime
def gen_rand_str(size=40, chars=ascii_uppercase + ascii_lowercase + digits):
return ''.join(choice(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TMUCTF/2021/crypto/Broken_RSA/challenge.py | ctfs/TMUCTF/2021/crypto/Broken_RSA/challenge.py | from Crypto.Util.number import *
e = 65537
with open('n', 'rb') as f:
n = int(f.read())
with open('secret', 'rb') as f:
secret_msg = f.read()
pads = [b'\x04', b'\x02', b'\x00', b'\x01', b'\x03']
with open('out.txt', 'w') as f:
for i in range(len(pads)):
for j in range(len(pads)):
ms... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TMUCTF/2021/crypto/435/challenge.py | ctfs/TMUCTF/2021/crypto/435/challenge.py | import binascii
import hashlib
import sys
from Crypto.Cipher import AES
key = b'*XhN2*8d%8Slp3*v'
key_len = len(key)
def pad(message):
padding = bytes((key_len - len(message) % key_len) * chr(key_len - len(message) % key_len), encoding='utf-8')
return message + padding
def encrypt(message, key, iv):
ae... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TMUCTF/2021/crypto/Baby_Encoder/challenge.py | ctfs/TMUCTF/2021/crypto/Baby_Encoder/challenge.py | from Crypto.Util.number import bytes_to_long
def displace(a, base):
res = []
for i in range(base):
if base + i >= len(a):
for j in range(base - 1, i - 1, -1):
res.append(a[j])
return res
res.append(a[base + i])
res.append(a[i])
for j in range... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TMUCTF/2021/crypto/Common_Factor/challenge.py | ctfs/TMUCTF/2021/crypto/Common_Factor/challenge.py | from Crypto.Util.number import *
from functools import reduce
def encrypt(msg, n):
enc = pow(bytes_to_long(msg), e, n)
return enc
e = 65537
primes = [getPrime(2048) for i in range(5)]
n = reduce(lambda a, x: a * x, primes, 1)
print(n)
x1 = primes[1] ** 2
x2 = primes[2] ** 2
x3 = primes[1] * primes[2]
y1 =... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/TMUCTF/2021/web/Fake_Registration/app.py | ctfs/TMUCTF/2021/web/Fake_Registration/app.py | import os
from flask import Flask, render_template, request
from peewee import *
app = Flask(__name__)
db = SqliteDatabase("TMUCTF.db")
class Users(Model):
id = AutoField()
username = CharField(unique=True)
password = CharField()
class Meta:
database = db
@db.connection_context()
def initi... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2024/crypto/kRSA/kRSA.py | ctfs/1337UP/2024/crypto/kRSA/kRSA.py | from Crypto.Util.number import *
import signal
def timeout_handler(signum, frame):
print("Secret key expired")
exit()
signal.signal(signal.SIGALRM, timeout_handler)
signal.alarm(300)
FLAG = "INTIGRITI{fake_flag}"
SIZE = 32
class Alice:
def __init__(self):
self.p = getPrime(1024)
self.q =... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2024/crypto/Black_Box_Blackjack/blackjack.py | ctfs/1337UP/2024/crypto/Black_Box_Blackjack/blackjack.py | #!/usr/bin/env python3
import os
from Crypto.Util.number import getPrime, bytes_to_long, long_to_bytes
FLAG = os.getenv("FLAG", "INTIGRITI{REDACTED}").encode()
class HandStates:
OKAY = 0,
STANDING = 1,
BUST = 2,
BLACKJACK = 3,
@staticmethod
def get_state(score):
if score > 21:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2023/misc/PyJail/jail.py | ctfs/1337UP/2023/misc/PyJail/jail.py | import ast
import unicodedata
blacklist = "0123456789[]\"\'._"
check = lambda x: any(w in blacklist for w in x)
def normalize_code(code):
return unicodedata.normalize('NFKC', code)
def execute_code(code):
try:
normalized_code = normalize_code(code)
parsed = ast.parse(code)
for node in... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2023/pwn/Over_The_Edge/over_the_edge.py | ctfs/1337UP/2023/pwn/Over_The_Edge/over_the_edge.py | import numpy as np
import warnings
import socket, sys
import threading
warnings.filterwarnings("ignore", category=RuntimeWarning)
warnings.filterwarnings("ignore", category=DeprecationWarning)
def process_input(input_value):
num1 = np.array([0], dtype=np.uint64)
num2 = np.array([0], dtype=np.uint64)
num2[... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2023/crypto/Share_It_2/app.py | ctfs/1337UP/2023/crypto/Share_It_2/app.py | from flask import Flask, render_template, request, redirect, url_for, make_response
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
import os
import json
import base64
from uuid import uuid4
import time
from waitress import serve
app = Flask(__name__)
key = os.urandom(16)
id_to_iv = {}
last_... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2023/crypto/1_10/chall.py | ctfs/1337UP/2023/crypto/1_10/chall.py | from random import randint
from re import search
from flag import FLAG
cs = [randint(0, 2**1000) for _ in range(10)]
xs = [randint(0, 2**64) for _ in range(10)]
xs = [ord(f) + i - (i%1000) for i, f in zip(xs, search("{(.*)}", FLAG).group(1))]
print(f"{cs = }")
print(f"s = {sum(c*x for c, x in zip(cs, xs))}")
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2023/crypto/1_10/out.py | ctfs/1337UP/2023/crypto/1_10/out.py | cs = [8508903290440008966939565321248693758153261635170177499193552423579929500027826696702216711413627480472568726828904707392607240309148374882044455682656477650413559779578913981575195542381602155806438946382809049847521263107908111429547314575039079118614485792613461747911710760754291582134293099750060, 10234293217... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2023/crypto/Not_So_Smooth/notsosmooth.py | ctfs/1337UP/2023/crypto/Not_So_Smooth/notsosmooth.py | from Crypto.Util.number import long_to_bytes
from Crypto.Util.strxor import strxor
from random import randint
from flag import FLAG
def f(x, n):
return (pow(u,n,p)*x + v*(1-pow(u,n,p))*pow(1-u, -1, p)) % p
p = 9720199743113046263971347611941109192267738123996761106171776663985337687126016590598921833568156017... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2023/crypto/Keyless/encrypt.py | ctfs/1337UP/2023/crypto/Keyless/encrypt.py | def encrypt(message):
encrypted_message = ""
for char in message:
a = (ord(char) * 2) + 10
b = (a ^ 42) + 5
c = (b * 3) - 7
encrypted_char = c ^ 23
encrypted_message += chr(encrypted_char)
return encrypted_message
flag = "INTIGRITI{REDACTED}"
encrypted_flag = encrypt... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2023/crypto/Share_It_1/app.py | ctfs/1337UP/2023/crypto/Share_It_1/app.py | from flask import Flask, render_template, request, redirect, url_for, make_response
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
import os
import json
import base64
from waitress import serve
app = Flask(__name__)
key = os.urandom(16)
FLAG = os.getenv("FLAG")
if not FLAG:
FLAG = "FLAG... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2023/web/CTFC/IntCTFC/app.py | ctfs/1337UP/2023/web/CTFC/IntCTFC/app.py | from flask import Flask,render_template,request,session,redirect
import pymongo
import os
from functools import wraps
from datetime import timedelta
from hashlib import md5
from time import sleep
app = Flask(__name__)
app.secret_key = os.environ['SECRET_KEY']
# db settings
client = pymongo.MongoClient('localhost',270... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2023/web/CTFC/IntCTFC/user/models.py | ctfs/1337UP/2023/web/CTFC/IntCTFC/user/models.py | from flask import Flask,request,render_template,session,redirect
import uuid
from passlib.hash import pbkdf2_sha256
from app import db
class User:
def signup(self):
user = {
"_id":uuid.uuid4().hex,
"username":request.form['form_username'],
"password":pbkdf2_sha256.encrypt(request.form['form_password'])
}
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2023/web/CTFC/IntCTFC/user/__init__.py | ctfs/1337UP/2023/web/CTFC/IntCTFC/user/__init__.py | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false | |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2023/web/CTFC/IntCTFC/user/routes.py | ctfs/1337UP/2023/web/CTFC/IntCTFC/user/routes.py | from flask import Flask,render_template
from app import app
from user.models import User
@app.route('/user/signup',methods=['POST'])
def signup():
try:
return User().signup()
except KeyError:
return render_template('register.html',error="dont try to hack!!"),406
@app.route('/user/signin',methods=['POST'])
def s... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2022/crypto/BinomialWays/challenge.py | ctfs/1337UP/2022/crypto/BinomialWays/challenge.py | from secret import flag
val = []
flag_length = len(flag)
print(flag_length)
def factorial(n):
f = 1
for i in range(2, n+1):
f *= i
return f
def series(A, X, n):
nFact = factorial(n)
for i in range(0, n + 1):
niFact = factorial(n - i)
iFact = factorial(i)
aPow = pow(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2022/crypto/WarmupEncoder/encrypt.py | ctfs/1337UP/2022/crypto/WarmupEncoder/encrypt.py | # ENCRYPT.py
from sympy import isprime, prime
flag = '<REDACTED>'
def Ord(flag):
x0r([ord(i) for i in flag])
def x0r(listt):
ff = []
for i in listt:
if isprime(i) == True:
ff.append(prime(i) ^ 0x1337)
else:
ff.append(i ^ 0x1337)
b1n(ff)
def b1n(listt):
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/1337UP/2022/web/1_truth_2_lies/app.py | ctfs/1337UP/2022/web/1_truth_2_lies/app.py | from flask import Flask, request, render_template_string, render_template
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route("""/
'''''' ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/InCTF/2021/pwn/DeadlyFastGraph/server/server.py | ctfs/InCTF/2021/pwn/DeadlyFastGraph/server/server.py | #!/usr/bin/python3
import sys
import tempfile
import os
print ("Enter the file size and then the file >>")
size = int(input())
assert(size < 1024*1024) #1MB max
script = sys.stdin.read(size) # reads one byte at a time, similar to getchar()
temp = tempfile.mktemp()
with open(temp, "w") as f:
f.write(script)
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/InCTF/2021/crypto/Right_Now_Generator/main.py | ctfs/InCTF/2021/crypto/Right_Now_Generator/main.py | #!/usr/bin/env python3
import random, hashlib, os, gmpy2, pickle
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
FLAG = open('flag.txt', 'rb').read()
class RNG():
pad = 0xDEADC0DE
sze = 64
mod = int(gmpy2.next_prime(2**sze))
def __init__(self, seed_val, seed=None):
if seed == None:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/InCTF/2021/crypto/Trouble_With_Pairs/signer.py | ctfs/InCTF/2021/crypto/Trouble_With_Pairs/signer.py | from BLS import G2ProofOfPossession as bls
from secret import data
result = []
for i in data:
d = {}
d['Name'] = i['Name']
d['Vote'] = i['Vote']
d['Count'] = i['Count']
d['PK'] = i['PK'].hex()
d['Sign'] = bls.Sign(i['PrivKey'],i['Vote'].encode()).hex()
result.append(d)
# print(result)
''... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/InCTF/2021/crypto/Trouble_With_Pairs/BLS.py | ctfs/InCTF/2021/crypto/Trouble_With_Pairs/BLS.py | from typing import (
Sequence,
)
from math import (
ceil,
log2,
)
import abc
from eth_typing import (
BLSPubkey,
BLSSignature,
)
from eth_utils import (
ValidationError,
)
from hashlib import sha256
from py_ecc.fields import optimized_bls12_381_FQ12 as FQ12
from py_ecc.optimized_bls12_381 impor... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/InCTF/2021/crypto/Trouble_With_Pairs/server.py | ctfs/InCTF/2021/crypto/Trouble_With_Pairs/server.py | #!/usr/bin/env python3
from BLS import G2ProofOfPossession as bls
from secret import data, bytexor, fake_flag, flag
from json import loads
import sys
class Unbuffered(object):
def __init__(self, stream):
self.stream = stream
def write(self, data):
self.stream.write(data)
self.stream.flush(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/InCTF/2021/crypto/Gold_digger/gold_digger.py | ctfs/InCTF/2021/crypto/Gold_digger/gold_digger.py | import random
from Crypto.Util.number import *
flag=open("flag","rb").read()
def encrypt(msg, N,x):
msg, ciphertexts = bin(bytes_to_long(msg))[2:], []
for i in msg:
while True:
r = random.randint(1, N)
if gcd(r, N) == 1:
bin_r = bin(r)[2:]
c = (p... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/InCTF/2021/crypto/Lost_Baggage/main.py | ctfs/InCTF/2021/crypto/Lost_Baggage/main.py | #!/usr/bin/python3
from random import getrandbits as rand
from gmpy2 import next_prime, invert
import pickle
FLAG = open('flag.txt', 'rb').read()
BUF = 16
def encrypt(msg, key):
msg = format(int(msg.hex(), 16), f'0{len(msg)*8}b')[::-1]
assert len(msg) == len(key)
return sum([k if m=='1' else 0 for m, k in zip(msg... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/InCTF/2021/crypto/Tabula_Recta/matrix.py | ctfs/InCTF/2021/crypto/Tabula_Recta/matrix.py | class Matrix:
def __init__(self,dims , A=None) :
self.rows = dims[0]
self.cols = dims[1]
if(A == None) :
self.M = [[0] * self.cols for i in range(self.rows)]
else :
self.M = A
def __str__(self) :
m = ""
for i in range(self.rows) :... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/InCTF/2021/crypto/Tabula_Recta/crypto.py | ctfs/InCTF/2021/crypto/Tabula_Recta/crypto.py |
global allowed , matrix_entries
allowed = "%UQh13S2dbjj,V6K1g$PTdaN4f!T023KUe#hi0PMOQiVN&cOcLR74+MLfeSgbaR*"
matrix_entries = 37*37
class Cipher :
def __init__(self, master_pass) :
self.n = len(master_pass)
self.key = [ord(i) for i in master_pass]
self.mod = len(allowed)
def creat... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/InCTF/2021/web/json_analyser/waf/waf.py | ctfs/InCTF/2021/web/json_analyser/waf/waf.py | from flask import Flask, request
from flask_cors import CORS
import ujson
import json
import re
import os
os.environ['subscription_code'] = '[REDACTED]'
app=Flask(__name__)
cors = CORS(app)
CORS(app)
cors = CORS(app, resources={
r"/verify_roles": {
"origins": "*"
}
})
@app.route('/verify_roles',methods... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/InCTF/2019/ateles/pow_solver.py | ctfs/InCTF/2019/ateles/pow_solver.py | #!/usr/bin/python3
from hashlib import *
from string import hexdigits as chars
chars = chars[:16]
from tqdm import *
def brute(known, H):
for i in tqdm(chars):
for j in chars:
for k in chars:
for l in chars:
for m in chars:
for n in ch... | 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.