From 063c19d526943bb673c41365dd8d8abe060d356a Mon Sep 17 00:00:00 2001 From: TheArrayser Date: Sat, 11 Jan 2025 16:23:23 +0100 Subject: [PATCH] amogus --- main.go | 68 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/main.go b/main.go index a9f0bb8..4758590 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "math/rand" "net/http" "strconv" + "strings" "github.com/miekg/dns" ) @@ -20,8 +21,46 @@ func (h *dnsHandler) ServeDNS(w dns.ResponseWriter, r *dns.Msg) { for _, question := range r.Question { fmt.Printf("Received query: %s (%d)\n", question.Name, question.Qtype) - if question.Qtype == dns.TypeCNAME || question.Qtype == dns.TypeA { - if question.Name == "random-number.dynamic.cringe-studios.com." { + if question.Qtype == dns.TypeCNAME || question.Qtype == dns.TypeA || question.Qtype == dns.TypeAAAA { + if question.Name == "google.com." { + msg.Answer = append(msg.Answer, &dns.CNAME{ + Hdr: dns.RR_Header{ + Name: question.Name, + Rrtype: dns.TypeCNAME, + Class: dns.ClassINET, + Ttl: 30, + }, + Target: "test0.imposter.cringe-studios.com.", + }) + + continue + } + if strings.HasPrefix(question.Name, "test") && strings.HasSuffix(question.Name, ".imposter.cringe-studios.com.") { + num := question.Name[4:strings.Index(question.Name, ".imposter.cringe-studios.com.")] + + number, err := strconv.ParseUint(num, 10, 64) + number++ + + log.Println(num) + + if err != nil { + log.Fatal("sus", err) + } + + msg.Answer = append(msg.Answer, &dns.CNAME{ + Hdr: dns.RR_Header{ + Name: question.Name, + Rrtype: dns.TypeCNAME, + Class: dns.ClassINET, + Ttl: 30, + }, + Target: "test" + strconv.Itoa(int(number)) + ".imposter.cringe-studios.com.", + }) + + continue + } + + if question.Name == "random-number.imposter.cringe-studios.com." { theNumber := rand.Intn(10000) msg.Answer = append(msg.Answer, &dns.CNAME{ @@ -31,13 +70,13 @@ func (h *dnsHandler) ServeDNS(w dns.ResponseWriter, r *dns.Msg) { Class: dns.ClassINET, Ttl: 30, }, - Target: "number-" + strconv.Itoa(theNumber) + ".dynamic.cringe-studios.com.", + Target: "number-" + strconv.Itoa(theNumber) + ".imposter.cringe-studios.com.", }) continue } - if question.Name == "amogus.dynamic.cringe-studios.com." { + if question.Name == "amogus.imposter.cringe-studios.com." { msg.Answer = append(msg.Answer, &dns.CNAME{ Hdr: dns.RR_Header{ Name: question.Name, @@ -45,21 +84,20 @@ func (h *dnsHandler) ServeDNS(w dns.ResponseWriter, r *dns.Msg) { Class: dns.ClassINET, Ttl: 30, }, - Target: "test(test.dynamic.cringe-studios.com.", + Target: "test(test.imposter.cringe-studios.com.", }) continue } - msg.Answer = append(msg.Answer, &dns.CNAME{ - Hdr: dns.RR_Header{ - Name: question.Name, - Rrtype: dns.TypeCNAME, - Class: dns.ClassINET, - Ttl: 30, - }, - Target: "homeipv4.graphite-official.com.", - }) + // msg.Answer = append(msg.Answer, &dns.NXNAME{ + // Hdr: dns.RR_Header{ + // Name: question.Name, + // Rrtype: dns.TypeNXNAME, + // Class: dns.ClassINET, + // Ttl: 30, + // }, + // }) } } @@ -74,7 +112,7 @@ func main() { handler := new(dnsHandler) server := &dns.Server{ - Addr: ":6953", + Addr: ":53", Net: "udp", Handler: handler, UDPSize: 65535,