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/WMCTF/2023/pwn/PDC_2_5/aiortc/tests/test_rtp.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/tests/test_rtp.py | import fractions
import math
import sys
from unittest import TestCase
from av import AudioFrame
from aiortc import rtp
from aiortc.rtcrtpparameters import RTCRtpHeaderExtensionParameters, RTCRtpParameters
from aiortc.rtp import (
RtcpByePacket,
RtcpPacket,
RtcpPsfbPacket,
RtcpRrPacket,
RtcpRtpfbPa... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/tests/test_rtcrtptransceiver.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/tests/test_rtcrtptransceiver.py | from unittest import TestCase
from aiortc.rtcrtpparameters import RTCRtpCodecCapability
from aiortc.rtcrtptransceiver import RTCRtpTransceiver
class RTCRtpTransceiverTest(TestCase):
def test_codec_preferences(self):
transceiver = RTCRtpTransceiver("audio", None, None)
self.assertEqual(transceiver... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/tests/test_rtcdtlstransport.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/tests/test_rtcdtlstransport.py | import asyncio
import datetime
from unittest import TestCase
from unittest.mock import patch
from OpenSSL import SSL
from aiortc.rtcdtlstransport import (
RTCCertificate,
RTCDtlsFingerprint,
RTCDtlsParameters,
RTCDtlsTransport,
RtpRouter,
)
from aiortc.rtcrtpparameters import (
RTCRtpCodecPara... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/docs/conf.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# aiortc documentation build configuration file, created by
# sphinx-quickstart on Thu Feb 8 17:22:14 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/videostream-cli/cli.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/videostream-cli/cli.py | import argparse
import asyncio
import logging
import math
import cv2
import numpy
from av import VideoFrame
from aiortc import (
RTCIceCandidate,
RTCPeerConnection,
RTCSessionDescription,
VideoStreamTrack,
)
from aiortc.contrib.media import MediaBlackhole, MediaPlayer, MediaRecorder
from aiortc.contri... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/janus/janus.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/janus/janus.py | import argparse
import asyncio
import logging
import random
import string
import time
import aiohttp
from aiortc import RTCPeerConnection, RTCSessionDescription, VideoStreamTrack
from aiortc.contrib.media import MediaPlayer, MediaRecorder
pcs = set()
def transaction_id():
return "".join(random.choice(string.as... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/webcam/webcam.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/webcam/webcam.py | import argparse
import asyncio
import json
import logging
import os
import platform
import ssl
from aiohttp import web
from aiortc import RTCPeerConnection, RTCSessionDescription
from aiortc.contrib.media import MediaPlayer, MediaRelay
from aiortc.rtcrtpsender import RTCRtpSender
ROOT = os.path.dirname(__file__)
r... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/datachannel-vpn/vpn.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/datachannel-vpn/vpn.py | import argparse
import asyncio
import logging
import tuntap
from aiortc import RTCIceCandidate, RTCPeerConnection, RTCSessionDescription
from aiortc.contrib.signaling import BYE, add_signaling_arguments, create_signaling
logger = logging.Logger("vpn")
def channel_log(channel, t, message):
logger.info("channel(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/datachannel-vpn/tuntap.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/datachannel-vpn/tuntap.py | import fcntl
import os
import socket
import struct
TUNSETIFF = 0x400454CA
TUNSETOWNER = TUNSETIFF + 2
IFF_TUN = 0x0001
IFF_TAP = 0x0002
IFF_NAPI = 0x0010
IFF_NAPI_FRAGS = 0x0020
IFF_NO_PI = 0x1000
IFF_PERSIST = 0x0800
IFF_NOFILTER = 0x1000
# net/if.h
IFF_UP = 0x1
IFF_RUNNING = 0x40
IFNAMSIZ = 16
# From linux/sockios... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/datachannel-filexfer/filexfer.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/datachannel-filexfer/filexfer.py | import argparse
import asyncio
import logging
import time
from aiortc import RTCIceCandidate, RTCPeerConnection, RTCSessionDescription
from aiortc.contrib.signaling import BYE, add_signaling_arguments, create_signaling
# optional, for better performance
try:
import uvloop
except ImportError:
uvloop = None
a... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/datachannel-cli/cli.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/datachannel-cli/cli.py | import argparse
import asyncio
import logging
import time
from aiortc import RTCIceCandidate, RTCPeerConnection, RTCSessionDescription
from aiortc.contrib.signaling import BYE, add_signaling_arguments, create_signaling
def channel_log(channel, t, message):
print("channel(%s) %s %s" % (channel.label, t, message))... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/server/server.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aiortc/examples/server/server.py | import argparse
import asyncio
import json
import logging
import os
import ssl
import uuid
import cv2
from aiohttp import web
from av import VideoFrame
from aiortc import MediaStreamTrack, RTCPeerConnection, RTCSessionDescription
from aiortc.contrib.media import MediaBlackhole, MediaPlayer, MediaRecorder, MediaRelay
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/setup.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/setup.py | import os.path
import sys
import setuptools
root_dir = os.path.abspath(os.path.dirname(__file__))
about = {}
about_file = os.path.join(root_dir, "src", "aioice", "about.py")
with open(about_file, encoding="utf-8") as fp:
exec(fp.read(), about)
readme_file = os.path.join(root_dir, "README.rst")
with open(readme_... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/stun.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/stun.py | import asyncio
import binascii
import enum
import hmac
import ipaddress
from collections import OrderedDict
from struct import pack, unpack
from typing import Callable, Dict, List, Optional, Tuple
from .utils import random_transaction_id
COOKIE = 0x2112A442
FINGERPRINT_LENGTH = 8
FINGERPRINT_XOR = 0x5354554E
HEADER_L... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/ice.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/ice.py | import asyncio
import copy
import enum
import ipaddress
import logging
import random
import secrets
import socket
import threading
from itertools import count
from typing import Dict, Iterable, List, Optional, Set, Text, Tuple, Union, cast
import netifaces
from . import mdns, stun, turn
from .candidate import Candida... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | true |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/turn.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/turn.py | import asyncio
import hashlib
import logging
import socket
import struct
import time
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Text,
Tuple,
TypeVar,
Union,
cast,
)
from . import stun
from .utils import random_transaction_id
logger = logging.getLogger(__name__)
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/utils.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/utils.py | import asyncio
import os
import random
import secrets
import string
from typing import Iterable, Optional, Tuple
def random_string(length: int) -> str:
allchar = string.ascii_letters + string.digits
return "".join(secrets.choice(allchar) for x in range(length))
def random_transaction_id() -> bytes:
retu... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/__init__.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/__init__.py | # flake8: noqa
import logging
from .about import __version__
from .candidate import Candidate
from .ice import Connection, ConnectionClosed, TransportPolicy
# Set default logging handler to avoid "No handler found" warnings.
logging.getLogger(__name__).addHandler(logging.NullHandler())
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/about.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/about.py | __author__ = "Jeremy Lainé"
__email__ = "jeremy.laine@m4x.org"
__license__ = "BSD"
__summary__ = "An implementation of Interactive Connectivity Establishment (RFC 5245)"
__title__ = "aioice"
__uri__ = "https://github.com/aiortc/aioice"
__version__ = "0.8.0"
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/mdns.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/mdns.py | import asyncio
import re
import socket
import sys
import uuid
from typing import Dict, List, Optional, Set, Text, Tuple, Union, cast
import dns.exception
import dns.flags
import dns.message
import dns.name
import dns.rdata
import dns.rdataclass
import dns.rdataset
import dns.rdatatype
import dns.zone
MDNS_ADDRESS = "... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/candidate.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/src/aioice/candidate.py | import hashlib
import ipaddress
from typing import Optional
def candidate_foundation(
candidate_type: str, candidate_transport: str, base_address: str
) -> str:
"""
See RFC 5245 - 4.1.1.3. Computing Foundations
"""
key = "%s|%s|%s" % (candidate_type, candidate_transport, base_address)
return h... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_ice.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_ice.py | import asyncio
import functools
import os
import random
import socket
import unittest
from unittest import mock
from aioice import Candidate, TransportPolicy, ice, mdns, stun
from .turnserver import run_turn_server
from .utils import asynctest, invite_accept
RUNNING_ON_CI = os.environ.get("GITHUB_ACTIONS") == "true"... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | true |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_candidate.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_candidate.py | import unittest
from aioice import Candidate
class CandidateTest(unittest.TestCase):
def test_can_pair_ipv4(self):
candidate_a = Candidate.from_sdp(
"6815297761 1 udp 659136 1.2.3.4 31102 typ host generation 0"
)
candidate_b = Candidate.from_sdp(
"6815297761 1 udp ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_ice_trickle.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_ice_trickle.py | import asyncio
import unittest
from aioice import ice
from .utils import asynctest
class IceTrickleTest(unittest.TestCase):
def assertCandidateTypes(self, conn, expected):
types = set([c.type for c in conn.local_candidates])
self.assertEqual(types, expected)
@asynctest
async def test_co... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/turnserver.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/turnserver.py | import argparse
import asyncio
import contextlib
import logging
import os
import ssl
import struct
import time
from typing import Optional, Tuple
from aioice import stun
from aioice.ice import get_host_addresses
from aioice.turn import (
DEFAULT_ALLOCATION_LIFETIME,
UDP_TRANSPORT,
TurnStreamMixin,
is_c... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_turn.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_turn.py | import asyncio
import ssl
import unittest
from aioice import stun, turn
from .echoserver import run_echo_server
from .turnserver import run_turn_server
from .utils import asynctest, read_message
PROTOCOL_KWARGS = {
"username": "foo",
"password": "bar",
"lifetime": turn.DEFAULT_ALLOCATION_LIFETIME,
"c... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/utils.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/utils.py | import asyncio
import functools
import logging
import os
def asynctest(coro):
@functools.wraps(coro)
def wrap(*args, **kwargs):
asyncio.run(coro(*args, **kwargs))
return wrap
async def invite_accept(conn_a, conn_b):
# invite
await conn_a.gather_candidates()
for candidate in conn_a.l... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_mdns.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_mdns.py | import asyncio
import contextlib
import unittest
from aioice import mdns
from .utils import asynctest
@contextlib.asynccontextmanager
async def querier_and_responder():
querier = await mdns.create_mdns_protocol()
responder = await mdns.create_mdns_protocol()
try:
yield querier, responder
fi... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_stun.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_stun.py | import unittest
from binascii import unhexlify
from collections import OrderedDict
from aioice import stun
from .utils import asynctest, read_message
class AttributeTest(unittest.TestCase):
def test_unpack_error_code(self):
data = unhexlify("00000457526f6c6520436f6e666c696374")
code, reason = st... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/__init__.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/__init__.py | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false | |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_exceptions.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/test_exceptions.py | import unittest
from aioice import stun
class ExceptionTest(unittest.TestCase):
def test_transaction_failed(self):
response = stun.Message(
message_method=stun.Method.BINDING, message_class=stun.Class.RESPONSE
)
response.attributes["ERROR-CODE"] = (487, "Role Conflict")
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/echoserver.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/tests/echoserver.py | import asyncio
import contextlib
class EchoServerProtocol(asyncio.DatagramProtocol):
def connection_made(self, transport):
self.transport = transport
def datagram_received(self, data, addr):
self.transport.sendto(data, addr)
class EchoServer:
async def close(self):
self.udp_serv... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/docs/conf.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# aioice documentation build configuration file, created by
# sphinx-quickstart on Thu Feb 8 17:22:14 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/examples/ice-client.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/examples/ice-client.py | #!/usr/bin/env python
import argparse
import asyncio
import json
import logging
import websockets
import aioice
STUN_SERVER = ("stun.l.google.com", 19302)
WEBSOCKET_URI = "ws://127.0.0.1:8765"
async def offer(options):
connection = aioice.Connection(
ice_controlling=True, components=options.components... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/examples/signaling-server.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/examples/signaling-server.py | #!/usr/bin/env python
#
# Simple websocket server to perform signaling.
#
import asyncio
import binascii
import os
import websockets
clients = {}
async def echo(websocket, path):
client_id = binascii.hexlify(os.urandom(8))
clients[client_id] = websocket
try:
async for message in websocket:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/zone.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/zone.py | from typing import Union
from .name import Name
from .rdataclass import IN
from .rdataset import Rdataset
from .rrset import RRset
class Zone:
def __init__(
self, origin: str, rdclass: int = IN, relativize: bool = False
) -> None:
...
def find_rrset(self, name: Union[Name, str], rdtype: ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/rdata.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/rdata.py | from typing import Any
class Rdata:
rdclass: int
rdtype: int
...
def to_generic(self) -> GenericRdata:
...
class GenericRdata(Rdata):
data: bytes
...
def __init__(self, rdclass: int, rdtype: int, data: bytes) -> None:
...
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/rdataset.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/rdataset.py | from typing import Optional
from .rdata import Rdata
class Rdataset:
...
def from_rdata(ttl: int, *rdatas: Rdata) -> Rdataset:
...
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/rrset.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/rrset.py | from typing import Iterator, List
from .name import Name
from .rdata import Rdata
class RRset:
name: Name
rdtype: int
def __iter__(self) -> Iterator[Rdata]:
...
...
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/rdatatype.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/rdatatype.py | import enum
class RdataType(enum.IntEnum):
...
A: RdataType
AAAA: RdataType
ANY: RdataType
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/message.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/message.py | from typing import List, Optional, Union
from .name import Name
from .rrset import RRset
class Message:
id: int
flags: int
answer: List[RRset]
question: List[RRset]
def __init__(self, id: Optional[int] = None) -> None:
...
def to_wire(self) -> bytes:
...
...
class Que... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/flags.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/flags.py | import enum
class Flag(enum.IntFlag):
...
AA: Flag
QR: Flag
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/__init__.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/__init__.py | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false | |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/rdataclass.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/rdataclass.py | import enum
class RdataClass(enum.IntEnum):
...
IN: RdataClass
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/name.py | ctfs/WMCTF/2023/pwn/PDC_2_5/aioice/stubs/dns/name.py | class Name:
...
def from_text(text: str) -> Name:
...
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/crypto/badprime/task.py | ctfs/WMCTF/2023/crypto/badprime/task.py | from Crypto.Util.number import *
from secret import flag
M = 0x7cda79f57f60a9b65478052f383ad7dadb714b4f4ac069997c7ff23d34d075fca08fdf20f95fbc5f0a981d65c3a3ee7ff74d769da52e948d6b0270dd736ef61fa99a54f80fb22091b055885dc22b9f17562778dfb2aeac87f51de339f71731d207c0af3244d35129feba028a48402247f4ba1d2b6d0755baff6
def getMypr... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/crypto/signin/task.py | ctfs/WMCTF/2023/crypto/signin/task.py | from Crypto.Util.number import *
from random import randrange
from secret import flag
def pr(msg):
print(msg)
pr(br"""
....''''''....
.`",:;;II;II;;;;:,"^'.
'"IlllI;;;;;;;;;;;;;Il!!l;^.
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/crypto/welcomesigner2/task.py | ctfs/WMCTF/2023/crypto/welcomesigner2/task.py | from Crypto.Util.number import *
from Crypto.Cipher import AES
from hashlib import md5
import random
flag = b"***********************************"
def pad(message):
return message + b"\x00"*((16-len(message)%16)%16)
def myfastexp(m,d,N,j,N_):
A = 1
B = m
d = bin(d)[2:][::-1]
n = len(d)
N = N
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/WMCTF/2023/crypto/welcomesigner1/task.py | ctfs/WMCTF/2023/crypto/welcomesigner1/task.py | from Crypto.Util.number import *
from Crypto.Cipher import AES
from hashlib import md5
from sympy import isprime
from tqdm import tqdm
import random
flag = b"***********************************"
def pad(message):
return message + b"\x00"*((16-len(message)%16)%16)
def myfastexp(m,d,N,j,N_):
A = 1
d = bin(... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Shakti/2021/crypto/z3r000/challenge.py | ctfs/Shakti/2021/crypto/z3r000/challenge.py | from Crypto.Util.number import *
from secret import flag
p = getPrime(1024)
q = getPrime(1024)
n = p*q
e = 3
flag = flag + "\x00"*200
ct = pow(bytes_to_long(flag),e,n)
print(n)
print(ct)
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Shakti/2021/crypto/Awesome_encryption_Scheme/encryptor.py | ctfs/Shakti/2021/crypto/Awesome_encryption_Scheme/encryptor.py | from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
from hashlib import md5
from os import urandom
from flag import flag
keys = [md5(urandom(3)).digest() for _ in range(2)]
def bytexor(da,ta): return bytes(i^j for i,j in zip(da,ta))
def get_ciphers(iv1, iv2):
return [
AES.new(keys[0], mod... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Shakti/2021/crypto/Drag_away_the_crib/ciphers.py | ctfs/Shakti/2021/crypto/Drag_away_the_crib/ciphers.py | c_message = "27c2b40fc28cc3aa72c3a3c2954873c283c39934056bc3a8317c5fc2b251"
c_flag = "4dc3af10c287c3a474c3b2c39c5f68c385c391381634c3bb07705ec2a02fc2a50bc39cc39a7cc3b4c39c5e3d"
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Shakti/2021/crypto/Drag_away_the_crib/generate.py | ctfs/Shakti/2021/crypto/Drag_away_the_crib/generate.py |
# test = ####REDACTED####
#What a wonderful welcome message to the CTF to test
#flag = ###REDACTED#####
import os
import base64
from itertools import cycle
key = os.urandom(20)
def xor(a,b) :
return ''.join(chr(ord(i)^j) for i,j in zip(a,cycle(b)))
c1 = base64.b16encode(xor(test,key).encode())
c2 = base64.b... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Shakti/2021/crypto/Rand-S-A/challenge.py | ctfs/Shakti/2021/crypto/Rand-S-A/challenge.py | import random
from Crypto.Util.number import *
from secret import flag, x
mod = 124912888168404777121624746046278221478415741204063939426455884264204774777990089137717126267769
g = 3
h = pow(g,x,mod)
def keyGen(x):
random.seed(x)
p = random.randint(2**511,2**512 - 1)
while isPrime(p) != 1:
p = random.randint(2*... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Shakti/2025/rev/gooGOOgaaGAA/googoogaagaa.py | ctfs/Shakti/2025/rev/gooGOOgaaGAA/googoogaagaa.py | def gaga(text, key):
result = []
for i in range(len(text)):
result += chr(ord(text[i]) ^ ord(key[i % len(key)]))
return result
key = "IWANTMOMOS"
encrypted= [':', '?', ' ', '%', ' ', '$', ',', '9', ')', '(', '+', 'c', '#', '7', '\x06', '~', '9', '\x12', '~', ' ', '\x16', '4', '4', ':', 'g', '0']
i... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Shakti/2025/crypto/Erasure_Failed/cipher.py | ctfs/Shakti/2025/crypto/Erasure_Failed/cipher.py | from secret import e,msg
from Crypto.Util.number import*
from gmpy2 import *
from Crypto.PublicKey import RSA
p = getPrime(2048)
q = getPrime(2048)
n = p*q
m = bytes_to_long(msg)
ct = pow(m,e,n)
with open("ciphertext.txt", "w") as f:
f.write(ct)
key = RSA.construct((int(n), int(e), int(d), int(p), int(q)))
pem = k... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Shakti/2025/web/Hooman/app.py | ctfs/Shakti/2025/web/Hooman/app.py | from flask import Flask, request, redirect, render_template, make_response
import jwt
app = Flask(__name__)
SECRET_KEY = 'Youcanneverhavethis'
@app.route('/login', methods=['POST', 'GET'])
def login():
error = None
if request.method == 'POST':
data = request.json if request.is_json else request.form... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/misc/Sqlmap_as_a_Service/server.py | ctfs/Bauhinia/2023/misc/Sqlmap_as_a_Service/server.py | from flask import Flask, request
from urllib.parse import urlencode
from urllib.request import urlopen
import subprocess
import os
G_SITEKEY = os.getenv("G_SITEKEY", '"><script>document.write("reCAPTCHA is broken")</script>')
G_SECRET = os.getenv("G_SECRET", "Victoria's Secret")
app = Flask(__name__)
def escapeshellc... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/pwn/Disconnect/src/setup.py | ctfs/Bauhinia/2023/pwn/Disconnect/src/setup.py | import subprocess
import os, sys
import tempfile
import time
def receive_data():
# Ask the user to provide the data length
data_length = int(input("Enter the data length: "))
if data_length > 0x100000:
print("File size too large")
return -1
# Receive the data from stdin
data = ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/pwn/Pyjail_3/chall.py | ctfs/Bauhinia/2023/pwn/Pyjail_3/chall.py | backup_len = len
backup_eval = eval
backup_print = print
backup_input = input
globals()['__builtins__'].__dict__.clear()
while True:
input = backup_input()
if backup_len(input) > 78 or '[' in input or ']' in input or '{' in input or '}' in input:
backup_print('[You failed to break the jail]')
else:
backup_prin... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/pwn/Image_Factory/src/nc_pow_guard.py | ctfs/Bauhinia/2023/pwn/Image_Factory/src/nc_pow_guard.py | #!/usr/bin/env python3
import secrets
import hashlib
from time import time
class NcPowser:
def __init__(self, difficulty=22, prefix_length=16):
self.difficulty = difficulty
self.prefix_length = prefix_length
def get_challenge(self):
return secrets.token_urlsafe(self.prefix_length)[:sel... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/crypto/Crypto_Chef/FruitHill.py | ctfs/Bauhinia/2023/crypto/Crypto_Chef/FruitHill.py | # Found a fruit hill!
# Let's use the fruits here too!
import galois # galois is used just because it's more lightweighted when compared to sage
import numpy as np
class Fruit:
def __init__(self, q, n, secret_sauce):
self.n = n
self.GF = galois.GF(q)
self.SS = self.GF(secret_sau... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/crypto/Crypto_Chef/OV.py | ctfs/Bauhinia/2023/crypto/Crypto_Chef/OV.py | # Found an Orange Vessel!
# Let's use the seasoning in it too!
import galois # galois is used just because it's more lightweighted when compared to sage
import numpy as np
class OilVinegar:
class LFSRSalt:
def __init__(self, q, water_tap, salt):
self.GF = galois.GF(2)
self.q = q
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/crypto/Crypto_Chef/chall.py | ctfs/Bauhinia/2023/crypto/Crypto_Chef/chall.py | import galois
import numpy as np
import base64
from OV import OilVinegar
from FruitHill import Fruit
from secret import WATER_TAP, flag
def getPepperOrSalt(q, v):
return galois.GF(q).Random(v // 2)
def getSauce(q, n):
secret_sauce = galois.GF(q).Random((n, n))
while np.linalg.matrix_rank(secret_sauce) <... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/crypto/Crypto_Chef/PoW.py | ctfs/Bauhinia/2023/crypto/Crypto_Chef/PoW.py | import hashlib
import random
import string
import itertools
LENGTH = 6
letter_set = string.ascii_letters + string.digits
hex_set = "0123456789abcdef"
def PoW_solve(given: str, h: str) -> str:
for ch in itertools.product(hex_set, repeat=LENGTH):
ch = ''.join(ch)
if h == hashlib.md5(f"CHEF:{given}:{... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/crypto/Crypto_Chef/secret.py | ctfs/Bauhinia/2023/crypto/Crypto_Chef/secret.py | # [!] ATTENTION [!]
# Sample secret.py for local testing only
# This file on the server is different!
import galois
# WATER_TAP on the server side is having a different value, but it's fixed during the whole CTF
WATER_TAP = [0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 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/Bauhinia/2023/crypto/How_to_Stop_Time/chall.py | ctfs/Bauhinia/2023/crypto/How_to_Stop_Time/chall.py | # Since the script is simple, I will just add a lot of useless information to
# distract you all. Good luck identifying whether one is a red herring!
# Although I am using the "os" package, I don't call "os.system". Now give up on
# that wacky thoughts.
import os
# I am using the `random` package, which is known to b... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/crypto/How_to_Stop_Time/mathy.py | ctfs/Bauhinia/2023/crypto/How_to_Stop_Time/mathy.py | # Functions copied from "That-crete log" from UIUCTF 2022. Thanks!
def miller_rabin(bases, n):
# I don't know how to annotate this because it involves of a bunch of
# mathematics that I could not understand, but I still want to be verbose.
# Maybe I should link you the wiki page so you could read that...
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/crypto/grhkms_babyRSA/chall.py | ctfs/Bauhinia/2023/crypto/grhkms_babyRSA/chall.py | from math import gcd
from Crypto.Util.number import getPrime, getRandomNBitInteger, bytes_to_long
from secret import flag
lcm = lambda u, v: u*v//gcd(u, v)
bits = 1024
given = bits // 5
e_bits = bits // 12
mask = (1 << given) - 1
while True:
p = getPrime(bits // 2)
q = getPrime(bits // 2)
N = p * q
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/crypto/YADE_Yet_Another_Diophantine_Equation/chall.py | ctfs/Bauhinia/2023/crypto/YADE_Yet_Another_Diophantine_Equation/chall.py | # TODO: Generate equation dynamically
# Load equation
with open("equation.py", "r") as eq_file:
eq_str = eq_file.read().strip()
print("Equation:", eq_str)
exec(eq_str)
assert "d" in globals(), "Contact admin."
seen = set()
for _ in range(1000):
a, b, c = [int(input(": ")) for _ in range(3)]
as... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/crypto/YADE_Yet_Another_Diophantine_Equation/yade_9bcc242c79329e1aacc1575d3a60e25f/chall.py | ctfs/Bauhinia/2023/crypto/YADE_Yet_Another_Diophantine_Equation/yade_9bcc242c79329e1aacc1575d3a60e25f/chall.py | # TODO: Generate equation dynamically
# Load equation
with open("equation.py", "r") as eq_file:
eq_str = eq_file.read().strip()
print("Equation:", eq_str)
exec(eq_str)
assert "d" in globals(), "Contact admin."
seen = set()
for _ in range(1000):
a, b, c = [int(input(": ")) for _ in range(3)]
as... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/crypto/Quantum_Entanglement/chall.py | ctfs/Bauhinia/2023/crypto/Quantum_Entanglement/chall.py | from qiskit import QuantumCircuit, QuantumRegister, Aer, ClassicalRegister
from bitarray import bitarray
import os
# Quantum is truly random
def generateTrulyRandomSeq(n: int) -> list:
qr = QuantumRegister(1)
cr = ClassicalRegister(n)
qc = QuantumCircuit(qr, cr)
for i in range(n):
# Apply H-ga... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/web/Kill_T_Browser/server.py | ctfs/Bauhinia/2023/web/Kill_T_Browser/server.py | from flask import Flask, request
from urllib.parse import urlencode
from urllib.request import urlopen
import subprocess
import os
G_SITEKEY = os.getenv("G_SITEKEY", '"><script>document.write("reCAPTCHA is broken")</script>')
G_SECRET = os.getenv("G_SECRET", "Victoria's Secret")
app = Flask(__name__)
def escapeshella... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/Bauhinia/2023/web/Hansel_and_Gretel/app/app.py | ctfs/Bauhinia/2023/web/Hansel_and_Gretel/app/app.py | from flask import Flask, render_template, session, request, Response
from werkzeug.exceptions import HTTPException
import os
import json
import requests
from random import randint
def set_(src, dst):
for k, v in src.items():
if hasattr(dst, '__getitem__'):
if dst.get(k) and type(v) == dict:
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SpamAndFlags/2020/Quals/secstore/serve.py | ctfs/SpamAndFlags/2020/Quals/secstore/serve.py | #!/usr/bin/python3 -u
import os
import sys
import random
import subprocess
import string
import shutil
class HashCash(object):
def __init__(self, bits=28):
import random, string
self.rand = ''.join(random.choice(string.ascii_lowercase) for _ in range(8))
self.bits = bits
self.msg = ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SpamAndFlags/2020/Quals/environmental_issues/challenge.py | ctfs/SpamAndFlags/2020/Quals/environmental_issues/challenge.py | #/usr/bin/env python3
import json
import os.path
import secrets
import subprocess
import sys
import signal
import tempfile
def die(*args, **kwargs):
print("ERROR:", *args, "Goodbye!", **kwargs)
exit(1)
def fix_stupid_python_stuff_and_set_up_alarm():
# Why don't you default to utf8 if there is no LOCALE,... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SpamAndFlags/2020/Quals/secstore2/serve.py | ctfs/SpamAndFlags/2020/Quals/secstore2/serve.py | #!/usr/bin/python3 -u
import os
import sys
import random
import subprocess
import string
import shutil
class HashCash(object):
def __init__(self, bits=28):
import random, string
self.rand = ''.join(random.choice(string.ascii_lowercase) for _ in range(8))
self.bits = bits
self.msg = ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/SpamAndFlags/2020/Quals/regulated_environmental_issues/challenge.py | ctfs/SpamAndFlags/2020/Quals/regulated_environmental_issues/challenge.py | #/usr/bin/env python3
import json
import os.path
import pprint
import secrets
import signal
import subprocess
import sys
import tempfile
def die(*args, **kwargs):
print("ERROR:", *args, "Goodbye!", **kwargs)
exit(1)
def fix_stupid_python_stuff_and_set_up_alarm():
# Why don't you default to utf8 if there... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/K17/2025/crypto/worsehelp/chall.py | ctfs/K17/2025/crypto/worsehelp/chall.py | from Crypto.Util.number import isPrime, getStrongPrime
from os import urandom
from math import gcd
from secrets import FLAG
a, b = map(int, input("Enter your secure parameters a, b (as comma-separated values) to seed the RNG: ").split(","))
if a.bit_length() < 1024 or b.bit_length() < 1024 or not isPrime(a) or isPrim... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/K17/2025/crypto/pass_me_the_salt/chall.py | ctfs/K17/2025/crypto/pass_me_the_salt/chall.py | from hashlib import sha1
import os
logins = {}
salts = {}
def create_account(login, pwd):
if login in logins.keys():
return False
salt = os.urandom(16)
salted_pwd = salt + (pwd).encode()
passw = sha1(salted_pwd).hexdigest()
logins[login] = passw
salts[login] = salt
retur... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/K17/2025/crypto/el_camel/chall.py | ctfs/K17/2025/crypto/el_camel/chall.py | from secrets import randbelow
from sympy import isprime
def findGenerator():
while True:
h = randbelow(p)
if pow(h, q, p) != 1:
continue
g = pow(h, 2, p)
if g != 1:
return g
def rng(key):
r = randbelow(p)
c = pow(g, r * x, p)
c += key
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/K17/2025/crypto/layers/chall.py | ctfs/K17/2025/crypto/layers/chall.py | from Crypto.PublicKey import RSA
from Crypto.Util.Padding import pad, unpad
from Crypto.Util.number import long_to_bytes, bytes_to_long, getPrime
from Crypto.Cipher import AES
from random import randint, randbytes
from secrets import FLAG
class LayeredEncryption:
def __init__(self, p, q, aes_key):
assert l... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/K17/2025/crypto/tricks/secrets.py | ctfs/K17/2025/crypto/tricks/secrets.py | FLAG = b"K17{FAKE_FLAG_FOR_TESTING______}"
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/K17/2025/crypto/tricks/chall.py | ctfs/K17/2025/crypto/tricks/chall.py | from Crypto.Util.number import getStrongPrime, long_to_bytes, bytes_to_long
from random import randint
from secrets import FLAG
assert len(FLAG) == 32
class Paillier:
# en.wikipedia.org/wiki/Paillier_cryptosystem
def __init__(self, p, q):
self.n = p * q
self.n2 = pow(self.n, 2)
self.l ... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BRICS+/2023/Quals/ppc/gif0day/server/gifgen.py | ctfs/BRICS+/2023/Quals/ppc/gif0day/server/gifgen.py | import random
from PIL import Image, ImageDraw, ImageFont
BG_COLOR = (255, 255, 255)
fonts = (
'JetBrainsMono-Regular.ttf',
'OpenSans.ttf',
'Roboto-Regular.ttf'
)
FONT = ImageFont.truetype('/fonts/JetBrainsMono-Regular.ttf', size=100)
def load_font():
size = random.randint(95, 115)
return Image... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BRICS+/2023/Quals/ppc/gif0day/server/gifcrop.py | ctfs/BRICS+/2023/Quals/ppc/gif0day/server/gifcrop.py | import glob
import sys
from PIL import Image, ImageSequence
def crop_image(img: Image) -> Image:
return img.crop((40, 40, 70, 70))
def crop_gif(gif_path: str):
with Image.open(gif_path) as im:
new_frames = ImageSequence.all_frames(im, crop_image)
duration = new_frames[0].info['duration']
... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BRICS+/2023/Quals/ppc/gif0day/server/server.py | ctfs/BRICS+/2023/Quals/ppc/gif0day/server/server.py | import asyncio
import hashlib
import os
import random
import string
import tempfile
import grpclib
from grpclib.server import Server
from grpclib.utils import graceful_exit
from pb import restore_grpc
from pb import restore_pb2
from gifgen import generate_gif
from gifcrop import crop_gif
class RestoreService(restor... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BRICS+/2023/Quals/ppc/gif0day/server/pb/restore_grpc.py | ctfs/BRICS+/2023/Quals/ppc/gif0day/server/pb/restore_grpc.py | # Generated by the Protocol Buffers compiler. DO NOT EDIT!
# source: restore.proto
# plugin: grpclib.plugin.main
import abc
import typing
import grpclib.const
import grpclib.client
if typing.TYPE_CHECKING:
import grpclib.server
from . import restore_pb2 as restore_pb2
class RestoreServiceBase(abc.ABC):
@a... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BRICS+/2023/Quals/ppc/gif0day/server/pb/restore_pb2.py | ctfs/BRICS+/2023/Quals/ppc/gif0day/server/pb/restore_pb2.py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: restore.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_da... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BRICS+/2023/Quals/crypto/sqrt/4.py | ctfs/BRICS+/2023/Quals/crypto/sqrt/4.py | from sage.all import *
import hashlib
P = Permutations(256).random_element()
print(P**2)
print([x^y for x,y in zip(hashlib.sha512(str(P).encode()).digest(), open('flag.txt', 'rb').read())])
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BRICS+/2023/Quals/crypto/arc3/2.py | ctfs/BRICS+/2023/Quals/crypto/arc3/2.py | import random
from secret import flag
def rc4():
S = list(range(256))
random.shuffle(S)
i = random.randrange(256)
j = random.randrange(256)
while True:
i = (i + 1) % 256
j = (j + S[i]) % 256
S[i], S[j] = S[j], S[i]
yield S[(S[i] + S[j]) % 256]
data = b'\x00'*1000 + fl... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/BRICS+/2023/Quals/crypto/sss/3.py | ctfs/BRICS+/2023/Quals/crypto/sss/3.py | FLAG = open('flag.txt', 'rb').read()
import random
import hashlib
MOD = 20000159
N = MOD
K = N - 3
poly = [random.randrange(MOD) for i in range(K)]
print([x^y for x,y in zip(hashlib.sha512(str(poly).encode()).digest(), FLAG)])
def eval_at(poly, x):
t = 1
ret = 0
for k in poly:
ret += t * k
t... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HITCON/2021/rev/baba-is-rev/BabaGUI/main.py | ctfs/HITCON/2021/rev/baba-is-rev/BabaGUI/main.py | import pygame
import pyBaba
import config
import sys
import sprites
if len(sys.argv[1]) < 2:
print('Usage: main.py [map]')
sys.exit(1)
game = pyBaba.Game(sys.argv[1])
screen_size = (game.GetMap().GetWidth() * config.BLOCK_SIZE,
game.GetMap().GetHeight() * config.BLOCK_SIZE)
screen = pygame.disp... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HITCON/2021/rev/baba-is-rev/BabaGUI/config.py | ctfs/HITCON/2021/rev/baba-is-rev/BabaGUI/config.py | import pygame
FPS = 60
BLOCK_SIZE = 48
COLOR_BACKGROUND = pygame.Color(0, 0, 0)
| python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HITCON/2021/rev/baba-is-rev/BabaGUI/images.py | ctfs/HITCON/2021/rev/baba-is-rev/BabaGUI/images.py | # Original code from https://github.com/nicksandau/GIFImage_ext/blob/master/GIFImage_ext.py
from PIL import Image
import pygame
from pygame.locals import SRCALPHA
import time
class GIFImage(object):
def __init__(self, filename):
self.filename = filename
self.image = Image.open(filename)
s... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HITCON/2021/rev/baba-is-rev/BabaGUI/sprites.py | ctfs/HITCON/2021/rev/baba-is-rev/BabaGUI/sprites.py | import pygame
import pyBaba
from images import GIFImage
class SpriteLoader:
def __init__(self):
self.icon_images = {
pyBaba.ObjectType.ICON_BABA: 'BABA',
pyBaba.ObjectType.ICON_BRICK: 'BRICK',
pyBaba.ObjectType.ICON_FLAG: 'FLAG',
pyBaba.ObjectType.IC... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HITCON/2021/crypto/dlog/prob.py | ctfs/HITCON/2021/crypto/dlog/prob.py | import os
from Crypto.Util.number import *
from hashlib import *
from binascii import unhexlify
LEN = 17
magic = os.urandom(LEN)
print("Magic:", magic.hex())
print('Coud you use it to solve dlog?')
magic_num = bytes_to_long(magic)
try:
P = int(input('P:>'))
e = int(input('E:>'))
data = unhexlify(input('da... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HITCON/2021/crypto/so_easy_rsa/prob.py | ctfs/HITCON/2021/crypto/so_easy_rsa/prob.py | from gmpy2 import next_prime, is_prime
from random import randint
from Crypto.Util.number import bytes_to_long
class Rand:
def __init__(self):
self.seed = randint(2, 2**512)
self.A = next_prime(randint(2, 2**512))
self.B = next_prime(randint(2, 2**512))
self.M = next_prime(randint(2... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HITCON/2021/crypto/magic_rsa/prob.py | ctfs/HITCON/2021/crypto/magic_rsa/prob.py | import os
from Crypto.Util.number import *
from hashlib import *
from binascii import unhexlify
LEN = 17
magic = os.urandom(LEN)
print("Magic:", magic.hex())
print('Coud you use it to do encryption as hash?')
magic_num = bytes_to_long(magic)
try:
N = int(input('N:>'))
e = int(input('E:>'))
data = unhexlif... | python | MIT | 129a3a9fe604443211fa4d493a49630c30689df7 | 2026-01-05T01:34:13.869332Z | false |
sajjadium/ctf-archives | https://github.com/sajjadium/ctf-archives/blob/129a3a9fe604443211fa4d493a49630c30689df7/ctfs/HITCON/2021/crypto/a_little_easy_rsa/prob.py | ctfs/HITCON/2021/crypto/a_little_easy_rsa/prob.py | from Crypto.Util.number import *
N = 1024
P = 211
p = getPrime(P)
q = getPrime(N-P)
n = p*q
print(n.bit_length())
d = p
e = inverse(d, (p-1)*(q-1))
flag = bytes_to_long(open('flag','rb').read())
print(n)
print(e)
print(pow(flag, e, n))
| 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.