From e9cb5dfbe4204c0a82f28def5b98441d3b416b86 Mon Sep 17 00:00:00 2001 From: David K Date: Sun, 19 Feb 2023 19:24:50 -0500 Subject: [PATCH] slight changes pt2 (of 2), prettier and other misc changes. --- index.js | 137 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 81 insertions(+), 56 deletions(-) diff --git a/index.js b/index.js index d2f7b13..ddb3751 100644 --- a/index.js +++ b/index.js @@ -1,65 +1,90 @@ -const express = require("express") -const dns2 = require("dns2") -const dns = new dns2() -const { Packet } = dns2 -const dnsServer = dns2.createServer({ udp: true }) -const localIp = require("local-ipv4-address") -const app = express() +const express = require("express"); +const dns2 = require("dns2"); +const dns = new dns2(); +const { Packet } = dns2; +const dnsServer = dns2.createServer({ udp: true }); +const localIp = require("local-ipv4-address"); +const app = express(); -app.use(express.text()) +app.use(express.text()); -var ip = null -localIp().then((yessir)=>{ - ip = yessir -}) +var ip = null; +localIp().then((yessir) => { + ip = yessir; +}); -shenaniganHandler = (req,res) => { - try { - return atob(req.query.p.slice(1, req.query.p.length)).split("r=")[1].split("&")[0] - } catch { - res.send() - } -} +shenaniganHandler = (req, res) => { + try { + return atob(req.query.p.slice(1, req.query.p.length)) + .split("r=")[1] + .split("&")[0]; + } catch { + res.send(); + } +}; app.get("/android/plus5?.php", (req, res) => { - try { - console.log("Cracked with verification token: " + shenaniganHandler(req,res)) - res.send("Q" + btoa(shenaniganHandler(req,res))) - } catch { - res.send() - } -}) + try { + console.log( + "Cracked with verification token: " + shenaniganHandler(req, res) + ); + res.send("Q" + btoa(shenaniganHandler(req, res))); + } catch { + res.send(); + } +}); app.get("*", (_, res) => { - res.send("POV: You forgor 💀 to change back the dns settings.") -}) - + switch (_.hostname) { + // switch fall-through + case "127.0.0.1": + case "localhost": + case "[::1]": + case "junefabrics.com": + /* + Turi ip ip ip + Ip ip ip ip tsha ik + */ + case ip: + res.send("Everything is functioning!"); + break; + case _.hostname.includes(".") ? _.hostname : false: + res.send("You prob forgor 💀 to change back the dns settings."); + break; + default: + res.send(); + break; + } +}); app.listen(80, () => { - console.log("Web Server Listening.") -}) -dnsServer.listen({ udp: 53 }).then(()=>{ - console.log("DNS Server Listening.") -}) - + console.log("Web Server Listening."); +}); +dnsServer.listen({ udp: 53 }).then(() => { + console.log("DNS Server Listening."); +}); -var tempInterval = setInterval(()=>{ - if (ip != null) { - clearInterval(tempInterval) - tempInterval = undefined - dnsServer.on('request', (request, send, client) => { - const response = Packet.createResponseFromRequest(request); - const [ question ] = request.questions; - const { name } = question; - response.answers = [] - response.answers.push({ - name, - type : Packet.TYPE.A, - class : Packet.CLASS.IN, - ttl : 0, - address : ip, - }); - send(response); - }); - console.log("If everything has loaded any you have accepted the windows prompt, use the ip: \""+ip+"\" as the dns server to start tinkering.") - } -},10) +var tempInterval = setInterval(() => { + if (ip != null) { + clearInterval(tempInterval); + tempInterval = undefined; + dnsServer.on("request", (request, send, client) => { + const response = Packet.createResponseFromRequest(request); + const [question] = request.questions; + const { name } = question; + response.answers = []; + response.answers.push({ + name, + type: Packet.TYPE.A, + class: Packet.CLASS.IN, + ttl: 1, + address: ip, + }); + send(response); + }); + console.log( + 'If everything has loaded any you have accepted the windows network prompt, use the ip: "' + + ip + + '" as the dns server to start tinkering. (high chance of breaking with multiple connections.)' + ); + } +}, 10);