<head>
    <title>Evan Pratten</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />


    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
        integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <link rel="stylesheet" href="/assets/css/main.css">
    <link rel="stylesheet" href="/assets/css/github-syntax.css">
    <link href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono:400,400i|IBM+Plex+Sans:100,100i,400,400i,700,700i" rel="stylesheet">
    <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
</head>

<body>

    <div class="site-ctr">
        <!-- Navbar -->
        <nav class="navbar navbar-dark sticky-top bg-dark navbar-expand-lg">
    <!-- Navbar content -->
    <!-- <div class="container"> -->
    <a class="navbar-brand" href="/">Evan Pratten</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
        <div class="navbar-nav ml-auto">
            <a class="nav-item nav-link" href="/blog">Blog</a>
            <a class="nav-item nav-link" href="/projects">Projects</a>
            <!-- <a class="nav-item nav-link" href="/documentation">Documentation</a> -->
            <a class="nav-item nav-link" href="/about">About</a>
        </div>
        <!-- </div> -->
    </div>
</nav>
        <!-- <div style="height:5vh"></div> -->

        <!-- Header -->
        <!-- <div class="header">
            <div class="container">
                <div class="content">
                </div>
            </div>
            <div class="header-gap"></div>
        </div> -->

        <div class="reactive-bg">
            <div class="post container">
                <h1>devDNS

                </h1>
                <h4>The DNS over devRant service

                </h4>
                <hr>
                <p><em>2019-07-01 18:13:00 -0400
                        
                    </em></p>

                <br>

                <p>Over the past year and a half, I have been hacking my way around the undocumented <a href="https://devrant.com">devRant</a> 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 <a href="https://devrant.com/collabs/2163502">devDNS</a> over the past few days that uses this undocumented API. Why must I be so bad at writing intros?</p>

<h2 id="what-is-devdns">What is devDNS</h2>
<p>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:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>@devDNS example.com
</code></pre></div></div>
<p>or</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>@devDNS MX example.com
</code></pre></div></div>
<p>Of course, <code class="highlighter-rouge">MX</code> and <code class="highlighter-rouge">example.com</code> are to be replaced with the domain and entry of your choosing.</p>

<p>devDNS was inspired by <a href="https://twitter.com/1111resolver">@1111Resolver</a>, and the source is available on <a href="https://github.com/Ewpratten/devDNS">GitHub</a>.</p>

<h2 id="how-it-works">How it works</h2>
<p>The Python script behind devDNS is very simple. devDNS does the following every 10 seconds:</p>
<ul>
  <li>Fetch all new notifs</li>
  <li>Find only mentions</li>
  <li>Spin off a thread for each mention that passes a basic parser (Is the message 2 or 3 words long)</li>
  <li>In the thread, check if the message is a control message (allows me to view the status of the bot via devRant)</li>
  <li>Check if the request matches a required pattern</li>
  <li>Call <code class="highlighter-rouge">dnspython</code> with requested record and domain</li>
  <li>Receive answer from a custom <a href="https://pi-hole.net/">PIHole</a> server with caching and super low latency</li>
  <li>Send a comment with the results to the requester</li>
</ul>

<p>Thats it! Super simple, and only two days from concept to reality.</p>

<h2 id="where-is-this-hosted">Where is this hosted?</h2>
<p>This program is hosted on a raspberry pi laying in my room running docker. I also have <a href="https://www.portainer.io/">Portainer</a> set up so I can easily monitor the bot from my phone over my VPN.</p>

            </div>
        </div>

    </div>
    <!-- <div id="particles-js"></div> -->

<div class="container foot" style="text-align:center;">
    <br>
    <span class="site-info">
        Site design by: <a href="https://retrylife.ca">Evan Pratten</a> |

        This site was last updated at: 2019-08-31 14:25:59 -0400
    </span>
</div>

<!-- Brython -->
<script src="/assets/js/brython.js"></script>
<script src="/assets/js/brython_stdlib.js"></script>

<script>
    function startPY(){
        
        brython();
        console.log("Started Python")
    }

    window.onload = startPY;
</script>


<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

<!-- Offsets for links -->
<script>
    (function ($, window) {
        var adjustAnchor = function () {

            var $anchor = $(':target'),
                fixedElementHeight = 100;

            if ($anchor.length > 0) {

                window.scrollTo(0, $anchor.offset().top - fixedElementHeight);
            }

        };

        $(window).on('hashchange load', function () {
            adjustAnchor();
        });

    })(jQuery, window);
</script>

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-74118570-2"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag() { dataLayer.push(arguments); }
    gtag('js', new Date());

    gtag('config', 'UA-74118570-2');
</script>


<!-- particles -->
<script>
    var body = document.body

    var particles = document.getElementById("particles-js")

    particles.style.height  = body.scrollHeight + "px"

    console.log(body.scrollHeight)
</script>
<script src="/assets/js/particles.min.js"></script>
<script>
    particlesJS.load('particles-js', '/assets/js/particles.json', function () {
        console.log('callback - particles.js config loaded');
    });
</script>
    

</body>