Skip to content

Instantly share code, notes, and snippets.

@NicolaiSoeborg
NicolaiSoeborg / trio-https-raw-socket.py
Created December 28, 2023 16:26
nc/socat like raw socket access to HTTPS
import trio
DOMAIN = "example.com"
PATH = "/"
async def main():
s0 = await trio.open_ssl_over_tcp_stream(DOMAIN, 443, https_compatible=True)
# Request a connection to the website
await s0.send_all(f"GET {PATH} HTTP/1.1\r\nHost: {DOMAIN}\r\n\r\n".encode())

adduser --system coredns --home /var/lib/coredns

Create /etc/systemd/system/coredns.service:

[Unit]
Description=CoreDNS DNS server
Documentation=https://coredns.io
After=network.target

[Service]
@NicolaiSoeborg
NicolaiSoeborg / simple-mitm.py
Created November 15, 2024 14:22
Forward many ports
import asyncio
TARGET_IP = '1.2.3.4'
async def print_lines(port, process):
while True:
line = await process.stdout.readline()
if not line:
print(f"[{port}]: Died?")
break
@NicolaiSoeborg
NicolaiSoeborg / ctfd-to-ctftime.py
Created March 11, 2025 16:02
CTFd convert for having a live scoreboard on CTFTime.org
import httpx
from flask import Flask
app = Flask(__name__)
def ctfd_to_ctftime(data):
for row in data:
if row['account_type'] == 'team':
yield {'pos': row['pos'], 'team': row['name'], 'score': row['score']}