Beispiel #1
0
def dotransform(request, response):
    ip = request.value
    ans = nslookup("www.google.ca", nameserver=ip)
    if ans is not None:
        for site in config['dnscachesnoop/wordlist']:
            debug('Resolving %s' % site)
            ans = nslookup(site, nameserver=ip, rd=0)
            if not ans[DNS].ancount:
                ans = nslookup('www.%s' % site, nameserver=ip, rd=0)
            if ans[DNS].ancount:
                e = DNSName(site)
                t = Table(['Name', 'Query Class', 'Query Type', 'Data', 'TTL'], 'Cached Answers')
                for i in range(0, ans[DNS].ancount):
                    rr = ans[DNS].an[i]
                    t.addrow([
                            rr.rrname.rstrip('.'),
                            rr.sprintf('%rclass%'),
                            rr.sprintf('%type%'),
                            rr.rdata.rstrip('.'),
                            rr.sprintf('%ttl%')
                        ])
                e += Label('Cached Answers', t, type='text/html')
                response += e
    else:
        response += UIMessage('DNS server did not respond to initial DNS request.')
    return response
Beispiel #2
0
def dotransform(request, response):
    nameserver = request.value

    if nslookup_raw("www.google.ca", resolver=nameserver).answer:
        for site in config["dnscachesnoop/wordlist"]:
            debug("Resolving %s" % site)

            msg = nslookup_raw(site, resolver=nameserver, recursive=False)
            if not msg.answer:
                msg = nslookup_raw("www.%s" % site, resolver=nameserver, recursive=False)
            if msg.answer:
                e = DNSName(site)
                t = Table(["Name", "Query Class", "Query Type", "Data", "TTL"], "Cached Answers")
                for rrset in msg.answer:
                    for rr in rrset:
                        t.addrow(
                            [
                                rrset.name.to_text(),
                                dns.rdataclass.to_text(rr.rdclass),
                                dns.rdatatype.to_text(rr.rdtype),
                                rr.to_text(),
                                rrset.ttl,
                            ]
                        )
                e += Label("Cached Answers from %s" % nameserver, t, type="text/html")
                response += e
    else:
        response += UIMessage("DNS server did not respond to initial DNS request.")
    return response
Beispiel #3
0
def dotransform(request, response):
    ip = request.value
    ans = nslookup("www.google.ca", nameserver=ip)
    if ans is not None:
        for site in config['dnscachesnoop/wordlist']:
            debug('Resolving %s' % site)
            ans = nslookup(site, nameserver=ip, rd=0)
            if not ans[DNS].ancount:
                ans = nslookup('www.%s' % site, nameserver=ip, rd=0)
            if ans[DNS].ancount:
                e = DNSName(site)
                t = Table(['Name', 'Query Class', 'Query Type', 'Data', 'TTL'],
                          'Cached Answers')
                for i in range(0, ans[DNS].ancount):
                    rr = ans[DNS].an[i]
                    t.addrow([
                        rr.rrname.rstrip('.'),
                        rr.sprintf('%rclass%'),
                        rr.sprintf('%type%'),
                        rr.rdata.rstrip('.'),
                        rr.sprintf('%ttl%')
                    ])
                e += Label('Cached Answers', t, type='text/html')
                response += e
    else:
        response += UIMessage(
            'DNS server did not respond to initial DNS request.')
    return response
Beispiel #4
0
def dotransform(request, response):
    nameserver = request.value

    if nslookup_raw('www.google.ca', resolver=nameserver).answer:
        for site in config['dnscachesnoop/wordlist']:
            debug('Resolving %s' % site)

            msg = nslookup_raw(site, resolver=nameserver, recursive=False)
            if not msg.answer:
                msg = nslookup_raw('www.%s' % site,
                                   resolver=nameserver,
                                   recursive=False)
            if msg.answer:
                e = DNSName(site)
                t = Table(['Name', 'Query Class', 'Query Type', 'Data', 'TTL'],
                          'Cached Answers')
                for rrset in msg.answer:
                    for rr in rrset:
                        t.addrow([
                            rrset.name.to_text(),
                            dns.rdataclass.to_text(rr.rdclass),
                            dns.rdatatype.to_text(rr.rdtype),
                            rr.to_text(), rrset.ttl
                        ])
                e += Label('Cached Answers from %s' % nameserver,
                           t,
                           type='text/html')
                response += e
    else:
        response += UIMessage(
            'DNS server did not respond to initial DNS request.')
    return response
Beispiel #5
0
def dotransform(request, response):
    try:
        s = SNMPManager(*snmpargs(request))
        nexthops = {}
        for i in s.walk('1.3.6.1.2.1.4.21.1.1'):
            nm = s.get('.'.join(['1.3.6.1.2.1.4.21.1.11', i['value']]))
            if nm['value'] != '255.255.255.255':
                nh = s.get('.'.join(['1.3.6.1.2.1.4.21.1.7', i['value']]))
                if nh['value'] not in nexthops:
                    nexthops[nh['value']] = []
                nexthops[nh['value']].append(i['value'])
        for nh in nexthops:
            e = IPv4Address(nh)
            t = Table(['Destination Network'], 'Routing Table')
            for r in nexthops[nh]:
                t.addrow([r])
            e += Label('Routing Table', t, type='text/html')
            response += e
    except SNMPError, s:
        response += UIMessage(str(s))
Beispiel #6
0
def dotransform(request, response):
    try:
        s = SNMPManager(*snmpargs(request))
        nexthops = {}
        for i in s.walk('1.3.6.1.2.1.4.21.1.1'):
            nm = s.get('.'.join(['1.3.6.1.2.1.4.21.1.11', i['value']]))
            if nm['value'] != '255.255.255.255':
                nh = s.get('.'.join(['1.3.6.1.2.1.4.21.1.7', i['value']]))
                if nh['value'] not in nexthops:
                    nexthops[nh['value']] = []
                nexthops[nh['value']].append(i['value'])
        for nh in nexthops:
            e = IPv4Address(nh)
            t = Table(['Destination Network'], 'Routing Table')
            for r in nexthops[nh]:
                t.addrow([r])
            e += Label('Routing Table', t, type='text/html')
            response += e
    except SNMPError, s:
        response += UIMessage(str(s))