Beispiel #1
0
def _search(request):
    search = request_to_search(request).split(' ')
    search = ' '.join([strip_if_mac_with_colons(word) for word in search])

    objs, error_resp = compile_to_django(search)
    if not objs:
        return ([], [])
    (addrs, cnames, domains, static, dynamic, mxs, nss, ptrs, soas, srvs,
     sshfps, sys, txts, misc) = (
         objs['A'],
         objs['CNAME'],
         objs['DOMAIN'],
         objs['STATIC'],
         objs['DYNAMIC'],
         objs['MX'],
         objs['NS'],
         objs['PTR'],
         objs['SOA'],
         objs['SRV'],
         objs['SSHFP'],
         objs['SYSTEM'],
         objs['TXT'],
         [])

    meta = [
        (soas.count() if soas else 0, 'soa', 'SOA Records'),
        (addrs.count() if addrs else 0, 'address', 'Address Records'),
        (cnames.count() if cnames else 0, 'cname', 'CNAMEs'),
        (domains.count() if domains else 0, 'domain', 'Domains'),
        (static.count() if static else 0, 'static', 'Static Interfaces'),
        (dynamic.count() if dynamic else 0, 'dynamic', 'Dynamic Interfaces'),
        (mxs.count() if mxs else 0, 'mx', 'MXs'),
        (nss.count() if nss else 0, 'nameserver', 'Nameservers'),
        (ptrs.count() if ptrs else 0, 'ptr', 'PTRs'),
        (srvs.count() if srvs else 0, 'srv', 'SRVs'),
        (sys.count() if srvs else 0, 'sys', 'Systems'),
        (txts.count() if txts else 0, 'txt', 'TXTs'),
    ]

    tables = [
        (tablefy(soas, request=request), 'soa', 'SOA Records'),
        (tablefy(addrs, request=request), 'address', 'Address Records'),
        (tablefy(cnames, request=request), 'cname', 'CNAMEs'),
        (tablefy(domains, request=request), 'domain', 'Domains'),
        (tablefy(static, request=request), 'static', 'Static Interfaces'),
        (tablefy(dynamic, request=request), 'dynamic', 'Dynamic Interfaces'),
        (tablefy(mxs, request=request), 'mx', 'MXs'),
        (tablefy(nss, request=request), 'nameserver', 'Nameservers'),
        (tablefy(ptrs, request=request), 'ptr', 'PTRs'),
        (tablefy(srvs, request=request), 'srv', 'SRVs'),
        (tablefy(sys, request=request), 'sys', 'Systems'),
        (tablefy(txts, request=request), 'txt', 'TXTs'),
    ]

    return (meta, tables)
Beispiel #2
0
def _search(request):
    search = request_to_search(request)

    objs, error_resp = compile_to_django(search)
    if not objs:
        return ([], [])
    (addrs, cnames, domains, intrs, mxs, nss, ptrs, soas, srvs, sshfps, sys,
     txts, misc) = (
        objs['A'],
        objs['CNAME'],
        objs['DOMAIN'],
        objs['INTR'],
        objs['MX'],
        objs['NS'],
        objs['PTR'],
        objs['SOA'],
        objs['SRV'],
        objs['SSHFP'],
        objs['SYSTEM'],
        objs['TXT'],
        [])

    meta = [
        (soas.count() if soas else 0, 'soa', 'SOA Records'),
        (addrs.count() if addrs else 0, 'address', 'Address Records'),
        (cnames.count() if cnames else 0, 'cname', 'CNAMEs'),
        (domains.count() if domains else 0, 'domain', 'Domains'),
        (intrs.count() if intrs else 0, 'interface', 'Interfaces'),
        (mxs.count() if mxs else 0, 'mx', 'MXs'),
        (nss.count() if nss else 0, 'nameserver', 'Nameservers'),
        (ptrs.count() if ptrs else 0, 'ptr', 'PTRs'),
        (srvs.count() if srvs else 0, 'srv', 'SRVs'),
        (sys.count() if srvs else 0, 'sys', 'Systems'),
        (txts.count() if txts else 0, 'txt', 'TXTs'),
    ]

    tables = [
        (tablefy(soas), 'soa', 'SOA Records'),
        (tablefy(addrs), 'address', 'Address Records'),
        (tablefy(cnames), 'cname', 'CNAMEs'),
        (tablefy(domains), 'domain', 'Domains'),
        (tablefy(intrs), 'interface', 'Interfaces'),
        (tablefy(mxs), 'mx', 'MXs'),
        (tablefy(nss), 'nameserver', 'Nameservers'),
        (tablefy(ptrs), 'ptr', 'PTRs'),
        (tablefy(srvs), 'srv', 'SRVs'),
        (tablefy(sys), 'sys', 'Systems'),
        (tablefy(txts), 'txt', 'TXTs'),
    ]

    return (meta, tables)
Beispiel #3
0
def _search(request):
    search = request_to_search(request)

    objs, error_resp = compile_to_django(search)
    if not objs:
        return ([], [])
    (addrs, cnames, domains, intrs, mxs, nss, ptrs, soas, srvs, sshfps, sys,
     txts,
     misc) = (objs['A'], objs['CNAME'], objs['DOMAIN'], objs['INTR'],
              objs['MX'], objs['NS'], objs['PTR'], objs['SOA'], objs['SRV'],
              objs['SSHFP'], objs['SYSTEM'], objs['TXT'], [])

    meta = [
        (soas.count() if soas else 0, 'soa', 'SOA Records'),
        (addrs.count() if addrs else 0, 'address', 'Address Records'),
        (cnames.count() if cnames else 0, 'cname', 'CNAMEs'),
        (domains.count() if domains else 0, 'domain', 'Domains'),
        (intrs.count() if intrs else 0, 'interface', 'Interfaces'),
        (mxs.count() if mxs else 0, 'mx', 'MXs'),
        (nss.count() if nss else 0, 'nameserver', 'Nameservers'),
        (ptrs.count() if ptrs else 0, 'ptr', 'PTRs'),
        (srvs.count() if srvs else 0, 'srv', 'SRVs'),
        (sys.count() if srvs else 0, 'sys', 'Systems'),
        (txts.count() if txts else 0, 'txt', 'TXTs'),
    ]

    tables = [
        (tablefy(soas), 'soa', 'SOA Records'),
        (tablefy(addrs), 'address', 'Address Records'),
        (tablefy(cnames), 'cname', 'CNAMEs'),
        (tablefy(domains), 'domain', 'Domains'),
        (tablefy(intrs), 'interface', 'Interfaces'),
        (tablefy(mxs), 'mx', 'MXs'),
        (tablefy(nss), 'nameserver', 'Nameservers'),
        (tablefy(ptrs), 'ptr', 'PTRs'),
        (tablefy(srvs), 'srv', 'SRVs'),
        (tablefy(sys), 'sys', 'Systems'),
        (tablefy(txts), 'txt', 'TXTs'),
    ]

    return (meta, tables)
Beispiel #4
0
def _search(request):
    search = request_to_search(request)

    objs, error_resp = compile_to_django(search)
    if not objs:
        return ([], [])
    (addrs, cnames, domains, static, dynamic, mxs, networks, nss, ptrs, ranges,
     soas, srvs, sshfps, sys, txts, wgs, misc) = (
         objs['A'],
         objs['CNAME'],
         objs['DOMAIN'],
         objs['STATIC'],
         objs['DYNAMIC'],
         objs['MX'],
         objs['NETWORK'],
         objs['NS'],
         objs['PTR'],
         objs['RANGE'],
         objs['SOA'],
         objs['SRV'],
         objs['SSHFP'],
         objs['SYSTEM'],
         objs['TXT'],
         objs['WORKGROUP'],
         [])

    meta = [
        (soas.count() if soas else 0, 'soa', 'SOA Records'),
        (addrs.count() if addrs else 0, 'address', 'Address Records'),
        (cnames.count() if cnames else 0, 'cname', 'CNAMEs'),
        (domains.count() if domains else 0, 'domain', 'Domains'),
        (static.count() if static else 0, 'static', 'Static Interfaces'),
        (dynamic.count() if dynamic else 0, 'dynamic', 'Dynamic Interfaces'),
        (mxs.count() if mxs else 0, 'mx', 'MXs'),
        (networks.count() if networks else 0, 'network', 'Networks'),
        (nss.count() if nss else 0, 'nameserver', 'Nameservers'),
        (ptrs.count() if ptrs else 0, 'ptr', 'PTRs'),
        (ranges.count() if ranges else 0, 'range', 'Ranges'),
        (srvs.count() if srvs else 0, 'srv', 'SRVs'),
        (sys.count() if srvs else 0, 'sys', 'Systems'),
        (txts.count() if txts else 0, 'txt', 'TXTs'),
        (wgs.count() if wgs else 0, 'workgroup', 'Workgroups'),
    ]

    tables = [
        (tablefy(soas, request=request), 'soa', 'SOA Records'),
        (tablefy(addrs, request=request), 'address', 'Address Records'),
        (tablefy(cnames, request=request), 'cname', 'CNAMEs'),
        (tablefy(domains, request=request), 'domain', 'Domains'),
        (tablefy(static, request=request), 'static', 'Static Interfaces'),
        (tablefy(dynamic, request=request), 'dynamic', 'Dynamic Interfaces'),
        (tablefy(mxs, request=request), 'mx', 'MXs'),
        (tablefy(networks, request=request), 'network', 'Networks'),
        (tablefy(nss, request=request), 'nameserver', 'Nameservers'),
        (tablefy(ptrs, request=request), 'ptr', 'PTRs'),
        (tablefy(ranges, request=request), 'range', 'Ranges'),
        (tablefy(srvs, request=request), 'srv', 'SRVs'),
        (tablefy(sys, request=request), 'sys', 'Systems'),
        (tablefy(txts, request=request), 'txt', 'TXTs'),
        (tablefy(wgs, request=request), 'workgroup', 'Workgroups'),
    ]

    return (meta, tables)