41 lines
2.0 KiB
Markdown
41 lines
2.0 KiB
Markdown
---
|
|
title: devDNS
|
|
description: The DNS over devRant service
|
|
date: 2019-07-01
|
|
tags: project
|
|
aliases:
|
|
- /blog/2019/07/01/devdns
|
|
- /blog/devdns
|
|
---
|
|
|
|
Over the past year and a half, I have been hacking my way around the undocumented [devRant](https://devrant.com) auth/write API. At the request of devRant's creators, this API must not be documented due to the way logins work on the platform. That is besides the point. I have been working on a little project called [devDNS](https://devrant.com/collabs/2163502) over the past few days that uses this undocumented API. Why must I be so bad at writing intros?
|
|
|
|
## What is devDNS
|
|
devDNS is a devRant bot written in python. It will serve any valid DNS query from any user on the platform. A query is just a comment in one of the following forms:
|
|
```
|
|
@devDNS example.com
|
|
```
|
|
or
|
|
```
|
|
@devDNS MX example.com
|
|
```
|
|
Of course, `MX` and `example.com` are to be replaced with the domain and entry of your choosing.
|
|
|
|
devDNS was inspired by [@1111Resolver](https://twitter.com/1111resolver), and the source is available on [GitHub](https://github.com/Ewpratten/devDNS).
|
|
|
|
## How it works
|
|
The Python script behind devDNS is very simple. devDNS does the following every 10 seconds:
|
|
- Fetch all new notifs
|
|
- Find only mentions
|
|
- Spin off a thread for each mention that passes a basic parser (Is the message 2 or 3 words long)
|
|
- In the thread, check if the message is a control message (allows me to view the status of the bot via devRant)
|
|
- Check if the request matches a required pattern
|
|
- Call `dnspython` with requested record and domain
|
|
- Receive answer from a custom [PIHole](https://pi-hole.net/) server with caching and super low latency
|
|
- Send a comment with the results to the requester
|
|
|
|
Thats it! Super simple, and only two days from concept to reality.
|
|
|
|
## Where is this hosted?
|
|
This program is hosted on a raspberry pi laying in my room running docker. I also have [Portainer](https://www.portainer.io/) set up so I can easily monitor the bot from my phone over my VPN.
|