Skip to content

Instantly share code, notes, and snippets.

View yjlcoder's full-sized avatar

Yang Liu yjlcoder

View GitHub Profile
@samuelcolvin
samuelcolvin / dns_server.py
Last active August 14, 2026 16:11
requires python 3.5+ and dnslib, see https://github.com/samuelcolvin/dnserver for full/better implementation
from datetime import datetime
from time import sleep
from dnslib import DNSLabel, QTYPE, RD, RR
from dnslib import A, AAAA, CNAME, MX, NS, SOA, TXT
from dnslib.server import DNSServer
EPOCH = datetime(1970, 1, 1)
SERIAL = int((datetime.utcnow() - EPOCH).total_seconds())