Giter Site home page Giter Site logo

Two or more records per domain about dnschef HOT 3 OPEN

iphelix avatar iphelix commented on August 19, 2024
Two or more records per domain

from dnschef.

Comments (3)

gokalper avatar gokalper commented on August 19, 2024

HI This would be really useful, I also need this functionality

from dnschef.

adfoster-r7 avatar adfoster-r7 commented on August 19, 2024

Would love this functionality too 👍

from dnschef.

adfoster-r7 avatar adfoster-r7 commented on August 19, 2024

I hacked this in to support only the scenario that I needed, ipv4 and ipv6 lookups.

Multiple values are separated by commas:

sudo -E python3 ./dnschef.py --interface 0.0.0.0 --fakeip '127.0.0.1,192.168.200.201' --fakeipv6 '2001:db8:3333:4444:5555:6666:7777:8888,2001:db8:3333:4444:5555:6666:7777:5555'

Changes:

diff --git a/dnschef.py b/dnschef.py
index c57924d..bfe509b 100755
--- a/dnschef.py
+++ b/dnschef.py
@@ -127,9 +127,17 @@ class DNSHandler():
                     log.info(f"{self.client_address[0]}: cooking the response of type '{qtype}' for {qname} to {fake_record}")
 
                     # IPv6 needs additional work before inclusion:
+
                     if qtype == "AAAA":
-                        ipv6_hex_tuple = list(map(int, ip_address(fake_record).packed))
-                        response.add_answer(RR(qname, getattr(QTYPE,qtype), rdata=RDMAP[qtype](ipv6_hex_tuple)))
+                        for ipv6 in fake_record.split(','):
+                            ipv6_hex_tuple = list(map(int, ip_address(ipv6).packed))
+                            response.add_answer(RR(qname, getattr(QTYPE,qtype), rdata=RDMAP[qtype](ipv6_hex_tuple)))
+
+                    elif qtype == "A":
+                        for ipv4 in fake_record.split(','):
+                            # dnslib doesn't like trailing dots
+                            if ipv4[-1] == ".": ipv4 = ipv4[:-1]
+                            response.add_answer(RR(qname, getattr(QTYPE,qtype), rdata=RDMAP[qtype](ipv4)))
 
                     elif qtype == "SOA":
                         mname,rname,t1,t2,t3,t4,t5 = fake_record.split(" ")

from dnschef.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.