I buy domains in bulk for site vulnerability testing.

Right now for each domain that I purchase I have to manually go to my domain registrar's website and add a CNAME record. As an example, for the domain abc.com:

CNAME, www, www.abc.com.herokudns.com, 500

As I am purchasing about 100 domains per day, this gets pretty repetitive. My domain registrar is the cheapest out there (directnic.com) but they don't have an API.

Is it possible to write your own DNS server which spits out this record dynamically? If so, I can just point all my domains to this one DNS server.


I can't tell you how to do it, but there are companies who do provide dynamic dns services so it's possible. Maybe some kind of perl or python script that grabs the public IP and sends it over the the server you are hosting dns on, with another script that listens and updates DNS records based on the incoming data.

  • can you name me those companies?
    – Tinker
    Apr 23 '17 at 7:48

Powerdns has a pipe backend, you can use this and a short script of your own creation to accomplish what you want.

Here's some untested python code to get you started:

while True:
    req = sys.stdin.readline()
    if not req:
    req = req.split('\t')
    if req[0] == 'helo':
        print("OK\tbackend started")
    elif req[0] == 'q':
         _, qname, qclass, qtype, id, remote_ip, local_ip = req
         # Your awesome code goes here...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.