Exemplo n.º 1
0
def connect_dns(source, job, conn_timeout, tcp=False, sockopts=None):
    """
    This helper function will perform a DNS query over a TCP connection. It
    will not perform any special action in the event that this is the
    experimental flow, it only performs a DNS query connection.

    :param str source: source address for the connection
    :param dict job: dictionary containing the job details
    :param bool tcp: perform connection using TCP if *True*, otherwise UDP
    :param list(tuple) sockopts: list of socket options to set on the
      connection socket as tuples containing the level, option and value
    """

    try:
        q = PSDNSRecord(q=DNSQuestion(job['domain'], QTYPE.A))
        response, sp = q.spider_send(source, job, conn_timeout, tcp=tcp,
                                     sockopts=sockopts)
        if response is None:
            return {'sp': sp, 'spdr_state': CONN_FAILED}
        return {'sp': sp, 'spdr_state': CONN_OK}
    except TimeoutError:
        return {'sp': 0, 'spdr_state': CONN_TIMEOUT}
    except TypeError:  # Caused by not having a v4/v6 address when trying to bind
        return {'sp': 0, 'spdr_state': CONN_FAILED}
    except OSError:
        return {'sp': 0, 'spdr_state': CONN_FAILED}
    except ValueError: # Caused by domain names that don't fit in a DNS query (this should never happen)
        return {'sp': 0, 'spdr_state': CONN_FAILED}
Exemplo n.º 2
0
    def smart_route_dns_query(self):
        xlog.info("Start testing SmartRouter DNS Query")
        domain = "appsec.hicloud.com"
        d = DNSRecord(DNSHeader(123))
        d.add_question(DNSQuestion(domain, 1))
        req4_pack = d.pack()

        for port in [8053, 53]:
            sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            sock.sendto(req4_pack, ("127.0.0.1", port))
            sock.settimeout(5)

            try:
                response, server = sock.recvfrom(8192)
            except Exception as e:
                xlog.warn("recv fail for port:%s e:%r", port, e)
                continue

            p = DNSRecord.parse(response)
            for r in p.rr:
                ip = utils.to_bytes(str(r.rdata))
                xlog.info("IP:%s" % ip)
                self.assertEqual(utils.check_ip_valid(ip), True)

            xlog.info("Finished testing SmartRouter DNS Query")
            return
Exemplo n.º 3
0
 def gen_packet(self, p_id, qname, rcode, ttl, q_type, rdata):
     header = DNSHeader(id=p_id, qr=1, ra=1, aa=1, bitmap=rcode)
     packet = DNSRecord(header)
     packet.add_question(DNSQuestion(qname))
     packet.add_answer(
         *RR.fromZone("{} {} {} {}".format(qname, ttl, q_type, rdata)))
     return packet
Exemplo n.º 4
0
    def handle_job(self, job):
        domain = job["domain"]
        server = job["server"]
        port = job["port"]
        result_contains = job.get("result_contains", None)

        try:
            q = DNSRecord(q=DNSQuestion(domain))  #, getattr(QTYPE,"A")))

            a_pkt = q.send(server, port, tcp=False, timeout=10)
            a = DNSRecord.parse(a_pkt)

            found_record = False
            for record in a.rr:
                if (not result_contains):
                    if ((record.rtype == QTYPE_A)
                            or (record.qtype == QTYPE_CNAME)):
                        found_record = True
                else:
                    tmp = QTYPE.get(record.rtype) + str(record.rdata)
                    if (result_contains in tmp):
                        found_record = True

            if not found_record:
                if result_contains:
                    job["status"] = "%s,No %s records" % (domain,
                                                          result_contains)
                else:
                    job["status"] = "%s,No A or CNAME records" % domain

                return

        except Exception, e:
            job["status"] = "%s,Exception: %s" % (domain, str(e))
            return
Exemplo n.º 5
0
 def _recursive_query(self, questions, region, tracking_chain, records):
     unanswers_questions, recursive_questions = [], []
     for question in questions:
         has_reply = False
         for record in records:
             if question.qname == record.full_subdomain \
                     and record.status == 1 \
                     and question.qclass == record.rclass:
                 if question.qtype == record.rtype:
                     has_reply = True
                 elif record.rtype == QTYPE.CNAME:
                     has_reply = True
                     question = DNSQuestion(qname=record.content,
                                            qtype=question.qtype,
                                            qclass=record.rclass)
                     if question in tracking_chain: continue
                     tracking_chain.append(question)
                     recursive_questions.append(question)
         if not has_reply: unanswers_questions.append(question)
     if len(unanswers_questions) > 0:
         request = DNSRecord()
         request.add_question(*unanswers_questions)
         records = [
             Record(full_subdomain=r.rname,
                    rtype=r.rtype,
                    rclass=r.rclass,
                    content=str(r.rdata),
                    ttl=r.ttl,
                    status=1) for r in self.remote.query(request).rr
         ]
         self._set_cached_records(records, region)
         yield from records
     yield from self._query(recursive_questions, region, tracking_chain)
Exemplo n.º 6
0
 def query(self, c_id, m_addr):
     header = DNSHeader(qr=0, aa=1, ra=1)
     transfer_packet = DNSRecord(header)
     transfer_packet.add_question(DNSQuestion(c_id))
     response = transfer_packet.send(dest=m_addr, port=10053)
     ans = DNSRecord.parse(response)
     rcode, rdata = ans.header.rcode, str(ans.a.rdata)
     return rcode, rdata
Exemplo n.º 7
0
 def gen_packet(self, p_id, qname, rcode, q_typeid, rdata):
     header = DNSHeader(id=p_id, qr=1, ra=1, aa=1, bitmap=rcode)
     packet = DNSRecord(header)
     packet.add_question(DNSQuestion(qname))
     if rcode == 0:  #NOERROR
         packet.add_answer(
             RR.fromZone("{} {} {} {}".format(name, answer_data.a.ttl,
                                              q_typeid, str(rdata))))
         return packet
     else:
         return packet
Exemplo n.º 8
0
    async def query(self, query_type: str, dns_query: str) -> None:
        query = DNSRecord(q=DNSQuestion(dns_query, getattr(QTYPE, query_type)))
        stream_id = self._quic.get_next_available_stream_id()
        logger.debug(f"Stream ID: {stream_id}")
        end_stream = False
        self._quic.send_stream_data(stream_id, bytes(query.pack()), end_stream)
        waiter = self._loop.create_future()
        self._ack_waiter = waiter
        self.transmit()

        return await asyncio.shield(waiter)
Exemplo n.º 9
0
    def smart_route_dns_query(self):
        xlog.info("Start testing SmartRouter DNS Query")
        domain = "appsec.hicloud.com"
        d = DNSRecord(DNSHeader(123))
        d.add_question(DNSQuestion(domain, 1))
        req4_pack = d.pack()

        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.sendto(req4_pack, ("127.0.0.1", 53))
        sock.sendto(req4_pack, ("127.0.0.1", 8053))

        response, server = sock.recvfrom(8192)
        p = DNSRecord.parse(response)
        for r in p.rr:
            ip = utils.to_bytes(str(r.rdata))
            xlog.info("IP:%s" % ip)
            self.assertEqual(utils.check_ip_valid(ip), True)

        xlog.info("Finished testing SmartRouter DNS Query")
Exemplo n.º 10
0
def connect_dns(source, job, conn_timeout, tcp=False):
    """
    This helper function will perform a DNS query over a TCP connection. It
    will not perform any special action in the event that this is the
    experimental flow, it only performs a DNS query connection.
    """

    try:
        q = PSDNSRecord(q=DNSQuestion(job['domain'], QTYPE.A))
        response, sp = q.spider_send(source, job, conn_timeout, tcp=tcp)
        if response is None:
            return {'sp': sp, 'spdr_state': CONN_FAILED}
        return {'sp': sp, 'spdr_state': CONN_OK}
    except TimeoutError:
        return {'sp': 0, 'spdr_state': CONN_TIMEOUT}
    except TypeError:  # Caused by not having a v4/v6 address when trying to bind
        return {'sp': 0, 'spdr_state': CONN_FAILED}
    except OSError:
        return {'sp': 0, 'spdr_state': CONN_FAILED}
    except ValueError:  # Caused by domain names that don't fit in a DNS query (this should never happen)
        return {'sp': 0, 'spdr_state': CONN_FAILED}
Exemplo n.º 11
0
def nslookup(domain, nservers=['8.8.8.8', '114.114.114']):
    global tested_ips, ip_is_enough, inactive_servers, good_servers

    if ip_is_enough: return
    try:
        q = DNSRecord(q=DNSQuestion(domain, getattr(QTYPE,'A')))
        a_pkt = q.send(nservers[0], 53, tcp=False, timeout=3)
        a = DNSRecord.parse(a_pkt)
        if a.header.tc:
            # Truncated - retry in TCP mode
            a_pkt = q.send(nservers[0], 53, tcp=True, timeout=3)
            a = DNSRecord.parse(a_pkt)
        a = a.short()
        if not a:
            raise Exception('no response.')
    except Exception as e:
        with lock:
            if nservers[0] not in inactive_servers:
                inactive_servers.add(nservers[0])
                #print(inactive_servers)
            if nservers[0] in good_servers:
                good_servers.remove(nservers[0])
            print('dns error: ', domain, nservers[0], e)
        return
    a = a.split('\n')

    if nservers[0] in inactive_servers:
        inactive_servers.remove(nservers[0])
    for ip in a:
        if ip[-1] != '.':  ##  maybe CNAME
            with lock:
                if ip_is_enough:
                    break
                if ip in tested_ips:
                    continue
                tested_ips.add(ip)
            if checkip(ip, domain):
                with lock:
                    if nservers[0] not in good_servers:
                        good_servers.add(nservers[0])
Exemplo n.º 12
0
def query(request):
    qname = request.GET.get('qname')
    qtype = int(request.GET.get('qtype', 1))
    qclass = int(request.GET.get('qclass', 1))
    origin = request.GET.get('origin', request.META.get(
        'HTTP_X_FORWARDED_FOR', request.META['REMOTE_ADDR']))
    return JsonResponse({
        "qname": qname,
        "qtype": qtype,
        "qclass": qclass,
        "rr":[
            {
                "rname": "%s" % r.rname,
                "rtype": r.rtype,
                "rclass": r.rclass,
                "rdata": "%s" % r.rdata,
                "ttl": r.ttl,
            }
            for r in LocalQueryProxy().query(DNSRecord(
                q=DNSQuestion(qname=qname, qtype=qtype, qclass=qclass)),
                origin).rr
        ]
    })
Exemplo n.º 13
0
 def parseQuestions(self,q,dns):
     for qname,qclass,qtype in q:
         dns.add_question(DNSQuestion(qname,
                                      getattr(QTYPE,qtype),
                                      getattr(CLASS,qclass)))
Exemplo n.º 14
0
 def query(self, c_id, m_addr):
     header = DNSHeader(qr=0, aa=1, ra=1)
     transfer_packet = DNSRecord(header)
     transfer_packet.add_question(DNSQuestion(c_id))
     response = transfer_packet.send(dest=m_addr, port=10053)
     return response
def pan_dig(domain):
    import argparse, sys, time

    p = argparse.ArgumentParser(description="DNS Client")
    p.add_argument(
        "--server",
        "-s",
        default="8.8.8.8",
        metavar="<address:port>",
        help="Server address:port (default:8.8.8.8:53) (port is optional)")
    p.add_argument("--query",
                   action='store_true',
                   default=False,
                   help="Show query (default: False)")
    p.add_argument("--hex",
                   action='store_true',
                   default=False,
                   help="Dump packet in hex (default: False)")
    p.add_argument("--tcp",
                   action='store_true',
                   default=True,
                   help="Use TCP (default: UDP)")
    p.add_argument(
        "--noretry",
        action='store_true',
        default=False,
        help="Don't retry query using TCP if truncated (default: false)")
    p.add_argument(
        "--diff",
        default="",
        help=
        "Compare response from alternate nameserver (format: address:port / default: false)"
    )
    p.add_argument(
        "--dig",
        action='store_true',
        default=False,
        help=
        "Compare result with DiG - if ---diff also specified use alternative nameserver for DiG request (default: false)"
    )
    p.add_argument("--short",
                   action='store_true',
                   default=True,
                   help="Short output - rdata only (default: false)")
    p.add_argument("--debug",
                   action='store_true',
                   default=False,
                   help="Drop into CLI after request (default: false)")
    p.add_argument("domain", metavar="<domain>", help="Query domain")
    p.add_argument("qtype",
                   metavar="<type>",
                   default="A",
                   nargs="?",
                   help="Query type (default: A)")
    args = p.parse_args(['--tcp', '--short', domain])

    # Construct request
    q = DNSRecord(q=DNSQuestion(args.domain, getattr(QTYPE, args.qtype)))

    address, _, port = args.server.partition(':')
    port = int(port or 53)

    if args.query:
        print(";; Sending%s:" % (" (TCP)" if args.tcp else ""))
        if args.hex:
            print(";; QUERY:", binascii.hexlify(q.pack()).decode())
        print(q)
        print()

    a_pkt = q.send(address, port, tcp=args.tcp)
    a = DNSRecord.parse(a_pkt)

    if a.header.tc and args.noretry == False:
        # Truncated - retry in TCP mode
        a_pkt = q.send(address, port, tcp=True)
        a = DNSRecord.parse(a_pkt)

    if args.dig or args.diff:
        if args.diff:
            address, _, port = args.diff.partition(':')
            port = int(port or 53)

        if args.dig:
            dig = getoutput("dig +qr -p %d %s %s @%s" %
                            (port, args.domain, args.qtype, address))
            dig_reply = list(iter(DigParser(dig)))
            # DiG might have retried in TCP mode so get last q/a
            q_diff = dig_reply[-2]
            a_diff = dig_reply[-1]
        else:
            q_diff = DNSRecord(header=DNSHeader(id=q.header.id),
                               q=DNSQuestion(args.domain,
                                             getattr(QTYPE, args.qtype)))
            q_diff = q
            diff = q_diff.send(address, port, tcp=args.tcp)
            a_diff = DNSRecord.parse(diff)
            if a_diff.header.tc and args.noretry == False:
                diff = q_diff.send(address, port, tcp=True)
                a_diff = DNSRecord.parse(diff)

    if args.short:
        return a.short()
    else:
        print(";; Got answer:")
        if args.hex:
            print(";; RESPONSE:", binascii.hexlify(a_pkt).decode())
            if args.diff and not args.dig:
                print(";; DIFF    :", binascii.hexlify(diff).decode())
        print(a)
        print()

        if args.dig or args.diff:
            if q != q_diff:
                print(";;; ERROR: Diff Question differs")
                for (d1, d2) in q.diff(q_diff):
                    if d1:
                        print(";; - %s" % d1)
                    if d2:
                        print(";; + %s" % d2)
            if a != a_diff:
                print(";;; ERROR: Diff Response differs")
                for (d1, d2) in a.diff(a_diff):
                    if d1:
                        print(";; - %s" % d1)
                    if d2:
                        print(";; + %s" % d2)

    if args.debug:
        code.interact(local=locals())

    return None
Exemplo n.º 16
0
 def gen_error(self, p_id, qname, q_type, rcode):
     header = DNSHeader(id=p_id, qr=1, ra=1, aa=1, bitmap=rcode)
     packet = DNSRecord(header)
     packet.add_question(DNSQuestion(qname))
     return packet
Exemplo n.º 17
0
                   default=False,
                   help="Short output - rdata only (default: false)")
    p.add_argument("--debug",
                   action='store_true',
                   default=False,
                   help="Drop into CLI after request (default: false)")
    p.add_argument("domain", metavar="<domain>", help="Query domain")
    p.add_argument("qtype",
                   metavar="<type>",
                   default="A",
                   nargs="?",
                   help="Query type (default: A)")
    args = p.parse_args()

    # Construct request
    q = DNSRecord(q=DNSQuestion(args.domain, getattr(QTYPE, args.qtype)))

    address, _, port = args.server.partition(':')
    port = int(port or 53)

    if args.query:
        print(";; Sending%s:" % (" (TCP)" if args.tcp else ""))
        if args.hex:
            print(";; QUERY:", binascii.hexlify(q.pack()).decode())
        print(q)
        print()

    a_pkt = q.send(address, port, tcp=args.tcp)
    a = DNSRecord.parse(a_pkt)

    if a.header.tc and args.noretry == False:
Exemplo n.º 18
0
 def _resolve_record(self, domain, qtype='A'):
     q = DNSRecord(q=DNSQuestion(domain, getattr(QTYPE, qtype)))
     a_pkt = q.send(self.address, self.port, tcp=False)
     reply = DNSRecord.parse(a_pkt)
     return reply
Exemplo n.º 19
0
def index():
    if request.method == 'GET' and 'site' in request.values and 'type' in request.values:
        query_domain = request.values.get('site')
        query_type = request.values.get('type').upper()
        query_mode = request.values.get('mode')
        show_history = request.values.get('history')
        if show_history == 'true':
            f = open('%s.txt' % query_mode, 'r')
            result = list()
            for line in f.readlines():
                line = line.strip()
                if not len(line) or line.startswith('#'):  # 判断是否是空行或注释行
                    continue
                result.append(line)
            lines = result
            return render_template('index.html', lines=lines)
        if query_mode == 'iter':
            open('tmp.txt', 'w').close()
            import iterative
            iterative.iter_query(query_domain)
            f = open('tmp.txt', 'r')
            result = list()
            for line in f.readlines():
                line = line.strip()
                if not len(line) or line.startswith('#'):  # 判断是否是空行或注释行
                    continue
                result.append(line)
            return render_template('index.html', result=result)
        address = '127.0.0.1'
        port = 5053
        from dnslib.bimap import Bimap
        QTYPE = Bimap(
            'QTYPE', {
                1: 'A',
                2: 'NS',
                5: 'CNAME',
                6: 'SOA',
                12: 'PTR',
                15: 'MX',
                16: 'TXT',
                17: 'RP',
                18: 'AFSDB',
                24: 'SIG',
                25: 'KEY',
                28: 'AAAA',
                29: 'LOC',
                33: 'SRV',
                35: 'NAPTR',
                36: 'KX',
                37: 'CERT',
                38: 'A6',
                39: 'DNAME',
                41: 'OPT',
                42: 'APL',
                43: 'DS',
                44: 'SSHFP',
                45: 'IPSECKEY',
                46: 'RRSIG',
                47: 'NSEC',
                48: 'DNSKEY',
                49: 'DHCID',
                50: 'NSEC3',
                51: 'NSEC3PARAM',
                52: 'TLSA',
                55: 'HIP',
                99: 'SPF',
                249: 'TKEY',
                250: 'TSIG',
                251: 'IXFR',
                252: 'AXFR',
                255: 'ANY',
                257: 'CAA',
                32768: 'TA',
                32769: 'DLV'
            }, DNSError)
        q = DNSRecord(q=DNSQuestion(query_domain, getattr(QTYPE, query_type)))
        a_pkt = q.send(address, port, tcp=False)
        a = DNSRecord.parse(a_pkt)
        if a.header.tc:
            # Truncated - retry in TCP mode
            a_pkt = q.send(address, port, tcp=True)
            a = DNSRecord.parse(a_pkt)
        out = str(a)
        pattern = re.compile(r";; ANSWER SECTION:\n(.*)", re.DOTALL)
        out = pattern.findall(out)
        if out:
            lines = out[0].splitlines()
            for line in lines:
                print(line, file=open('recur.txt', 'a+'))
            return render_template('index.html', lines=lines)
        else:
            not_found = ['No answer section']
            return render_template('index.html', lines=not_found)
    return render_template('index.html')
Exemplo n.º 20
0
from dnslib.dns import DNSRecord, DNSQuestion, QTYPE
import socket
from binascii import unhexlify

q = DNSRecord(
    q=DNSQuestion('check.infinite.thecatch.cz', getattr(QTYPE, 'SOA')))
soa = DNSRecord.parse(q.send('8.8.8.8', 53))
print soa.auth[0]
dnsserver = str(soa.auth[0].rdata.mname)

q = DNSRecord(q=DNSQuestion(dnsserver, getattr(QTYPE, 'A')))
a = DNSRecord.parse(q.send('8.8.8.8', 53))
print a.rr[0]
dnsserver_ip = str(a.rr[0].rdata)

done = []
code = ''
nsl = 'dustoff.infinite.thecatch.cz'
while True:
    q = DNSRecord(q=DNSQuestion(nsl, getattr(QTYPE, 'NS')))
    try:
        a = DNSRecord.parse(q.send(dnsserver_ip, 53, timeout=0.5, tcp=False))
    except socket.timeout:
        continue

    nsl = str(a.auth[0].rdata)
    if nsl in done:
        break
    done.append(nsl)

    if nsl.endswith('.'): nsl = nsl[:-1]
Exemplo n.º 21
0
def sendmsg(m_type, message=""):
    global MSGerror
    message = str(message)
    if len(message) == 0:
        message = "PING"
    logging.debug("sendmsg enter")

    port = 53
    timeout = 10
    i = 0
    part = ""
    c_msg = ""
    protohdr = ""
    dnsresponse = ""
    # dns params max size definition
    s_request = 255  # max size of the domain
    s_section = 127  # max size of the message
    s_dns_section = 63  # max size of the dns section
    s_protohdr = 50  # protocol max size headers - hostid + msg m_type + msgid
    GConfig['msgid'] = GConfig['msgid'] + 1

    if m_type == "RG":
        protohdr = str(GConfig['hostid']) + ";" + str(m_type) + ";" + str(GConfig['msgid'])
        logging.debug("protohdr: % s " % protohdr)
        c_protohdr = base64.b64encode(protohdr)
        logging.debug("base64 protohrd: %s " % c_protohdr)
        c_msg = base64.b64encode(message)
        logging.debug("base64 RG message: %s" % c_msg)
        dnsreq = c_protohdr
        for i_msg in range(0, (len(c_msg) / s_dns_section) + 1):
            dnsreq = dnsreq + "." + c_msg[i_msg * (s_dns_section):i_msg * (s_dns_section) + (s_dns_section)]

        dnsreq = dnsreq + "." + GConfig['domain']
        logging.debug("dns req: %s " % dnsreq)
        # Construct request
        q = DNSRecord(q=DNSQuestion(dnsreq, getattr(QTYPE, "TXT")))
        try:
            a_pkt = q.send(GConfig['dnsserver'], port, False, timeout)
            a = DNSRecord.parse(a_pkt).get_a()
            response = decryptmsg(string.split(str(a))[4])
        except:
            logging.debug("Registration failed!")
            return(0)
        logging.debug("response %s" % response)

        if response == "OK":
            logging.debug("Registration success!")
            return(1)
        else:
            logging.debug("Registration failed!")
            return(0)
    else:
        if s_request < s_section + s_protohdr + 10 + len(GConfig['domain']):
            logging.critical("ERROR: domain too long" + str(s_section + s_protohdr + 10 + len(GConfig['domain'])))
            exit(1)

        # chunk msq to s_section character pieces
        msgcount = (len(message) / s_section) + 1
        # encrypt every piece of message with protocol header
        logging.debug("MSGcount: " + str(msgcount))
        # proto header
        for i in range(0, msgcount):
            time.sleep(GConfig['beacontime'])
            protohdr = str(GConfig['hostid']) + ";" + str(m_type) + ";" + str(GConfig['msgid'])
            logging.debug("protohdr: % s " % protohdr)
            c_protohdr = base64.b64encode(protohdr)
            logging.debug("base64 protohrd: %s " % c_protohdr)
            part = (message[i * (s_section):i * (s_section) + (s_section)])
            logging.debug("send message: %s " % part)
            c_msg = cryptmsg(part)
            logging.debug("enc message: %s" % c_msg)
            dnsreq = c_protohdr
            for i_msg in range(0, (len(c_msg) / s_dns_section) + 1):
                dnsreq = dnsreq + "." + c_msg[i_msg * (s_dns_section):i_msg * (s_dns_section) + (s_dns_section)]

            dnsreq = dnsreq + "." + GConfig['domain']
            logging.debug("dns req: %s " % dnsreq)
            # Construct request
            q = DNSRecord(q=DNSQuestion(dnsreq, getattr(QTYPE, "TXT")))
            try:
                a_pkt = q.send(GConfig['dnsserver'], port, False, timeout)
                a = DNSRecord.parse(a_pkt).get_a()
                response = decryptmsg(string.split(str(a))[4])
            except:
                logging.debug("Sending request failed!")
                # pocitani chyb, pak zavolat znovy registraci
                MSGerror = MSGerror + 1
                logging.debug("MSGerror %i" % MSGerror)
                if MSGerror > GConfig['retry_error']:
                    logging.debug("New registration enforce due to retry error count")
                    MSGerror = 0
                    registerAgent()
                return(0)
            GConfig['msgid'] = GConfig['msgid'] + 1
            logging.debug("response %s" % response)

    logging.debug("sendmsg finish")
    return response
Exemplo n.º 22
0
 def get_dns_txt_record(self):
     txt_record = self.token + '.' + self.domain
     q = DNSRecord(q=DNSQuestion(txt_record, getattr(QTYPE, 'TXT')))
     record_pkt = q.send(DNS_VALIDATION_SERVER, 53)
     record = DNSRecord.parse(record_pkt)
     return record