Beispiel #1
0
def handleHostAJAX(sDomain):
    typo = objtypo()
    
    typo.strDomain = sDomain
    
    # IP address for domain
    try:
        ipv4addresses = _hostinfo.getIPv4(sDomain)
        if ipv4addresses:
            for hostData in ipv4addresses:
                typo.IPv4Address.append(hostData.address)
        #Else, found a domain with no IP associated with it.

        ipv6addresses = _hostinfo.getIPv6(sDomain)
        if ipv6addresses:
            for hostData in ipv6addresses:
                typo.IPV6Address.append(hostData.address)
    except dns.resolver.NXDOMAIN:
        #Shortcut - If the domain query results in an NXDOMAIN, don't bother looking for subdomains.
        return typo

    # MX
    mxRecords = _hostinfo.getMX(sDomain)
    if mxRecords:
        for hostData in mxRecords:
            typo.aMX.append(str(hostData.exchange).strip("."))

            try:
                ipv4addresses = _hostinfo.getIPv4(str(hostData.exchange).strip("."))

                if ipv4addresses:
                    for hostDataInnerv4 in ipv4addresses:
                        if str(hostData.exchange).strip(".") in typo.aMXIPv4:
                            typo.aMXIPv4[str(hostData.exchange).strip(".")].append(hostDataInnerv4.address)
                        else:
                            typo.aMXIPv4[str(hostData.exchange).strip(".")] = [hostDataInnerv4.address]

                ipv6addresses = _hostinfo.getIPv6(str(hostData.exchange).strip("."))
                if ipv6addresses:
                    for hostDataInnerv6 in ipv6addresses:
                        if str(hostData.exchange).strip(".") in typo.aMXIPv6:
                            typo.aMXIPv6[str(hostData.exchange).strip(".")].append(hostDataInnerv6.address)
                        else:
                            typo.aMXIPv6[str(hostData.exchange).strip(".")] = [hostDataInnerv6.address]
            except dns.resolver.NXDOMAIN:
                #This MX record points at non-existent domain
                pass
    # Safe Browsing
    try:
        typo.SafeBrowsing = safebrowsing.safebrowsingqueryv2("www." + sDomain, KEY)
    except:
        pass

    resolve_www(sDomain, typo)

    resolve_webmail(sDomain, typo)

    resolve_m(sDomain, typo)

    return typo
Beispiel #2
0
def handleHostAJAXLight(sDomain, iTimeouts, iTimeoutsMax):
    typo = objtypo()
    typo.strDomain = sDomain

    try:
        typo.nameservers = _hostinfo.getNSServers(sDomain)
    except dns.resolver.NXDOMAIN:
        typo.bError = True
        typo.strError = "NXDOMAIN"
    except dns.resolver.Timeout:
        if iTimeouts > iTimeoutsMax:
            typo.bError = True
            typo.strError = "TIMEOUT"
        else:
            iTimeouts=iTimeouts+1   
            typo = handleHostAJAXLight(sDomain,iTimeouts,iTimeoutsMax)
    except dns.resolver.NoAnswer:
        if iTimeouts > iTimeoutsMax:
            typo.bError = True
            typo.strError = "TIMEOUT"
        else:
            iTimeouts=iTimeouts+1   
            typo = handleHostAJAXLight(sDomain,iTimeouts,iTimeoutsMax)
    except:
        type, value, traceback = sys.exc_info()
        typo.bError = True
        typo.strError = "OTHER"
        print("[i] Other error" + str(type) + " - " + str(value))
                     
    return typo
Beispiel #3
0
def handleHostAJAX(sDomain):
    typo = objtypo()
    
    typo.strDomain = sDomain
    
    # IP address for domain
    try:
        for hostData in _hostinfo.getIPv4(sDomain):
            typo.IPv4Address.append(hostData.address)
    except dns.resolver.NXDOMAIN:
        #Shortcut - If the domain query results in an NXDOMAIN, don't bother looking for subdomains.
        return typo
    except:
        pass

    try:
        for hostData in _hostinfo.getIPv6(sDomain):
            typo.IPV6Address.append(hostData.address)
    except:
        pass

    # MX
    try:
        for hostData in _hostinfo.getMX(sDomain):
            typo.aMX.append(str(hostData.exchange).strip("."))

            for hostDataInnerv4 in _hostinfo.getIPv4(str(hostData.exchange).strip(".")):
                if str(hostData.exchange).strip(".") in typo.aMXIPv4:
                    typo.aMXIPv4[str(hostData.exchange).strip(".")].append(hostDataInnerv4.address)
                else:
                    typo.aMXIPv4[str(hostData.exchange).strip(".")] = [hostDataInnerv4.address]

            for hostDataInnerv6 in _hostinfo.getIPv6(str(hostData.exchange).strip(".")):
                if str(hostData.exchange).strip(".") in typo.aMXIPv6:
                    typo.aMXIPv6[str(hostData.exchange).strip(".")].append(hostDataInnerv6.address)
                else:
                    typo.aMXIPv6[str(hostData.exchange).strip(".")] = [hostDataInnerv6.address]
    except:
        pass


    # Safe Browsing
    try:
        typo.SafeBrowsing = safebrowsing.safebrowsingqueryv2("www." + sDomain, KEY)
        pass
    except:
        pass

    resolve_www(sDomain, typo)

    resolve_webmail(sDomain, typo)

    resolve_m(sDomain, typo)

    return typo
Beispiel #4
0
def handleHostAJAX(sDomain):
    typo = objtypo()
    
    typo.strDomain = sDomain
    
    # IP address for domain
    try:
        for hostData in _hostinfo.getIPv4(sDomain):
            typo.IPv4Address.append(hostData.address)
    except:
        pass

    try:
        for hostData in _hostinfo.getIPv6(sDomain):
            typo.IPV6Address.append(hostData.address)
    except:
        pass

    # MX
    try:
        for hostData in _hostinfo.getMX(sDomain):
            typo.aMX.append(str(hostData.exchange).strip("."))

            for hostDataInnerv4 in _hostinfo.getIPv4(str(hostData.exchange).strip(".")):
                if str(hostData.exchange).strip(".") in typo.aMXIPv4:
                    typo.aMXIPv4[str(hostData.exchange).strip(".")].append(hostDataInnerv4.address)
                else:
                    typo.aMXIPv4[str(hostData.exchange).strip(".")] = [hostDataInnerv4.address]

            for hostDataInnerv6 in _hostinfo.getIPv6(str(hostData.exchange).strip(".")):
                if str(hostData.exchange).strip(".") in typo.aMXIPv6:
                    typo.aMXIPv6[str(hostData.exchange).strip(".")].append(hostDataInnerv6.address)
                else:
                    typo.aMXIPv6[str(hostData.exchange).strip(".")] = [hostDataInnerv6.address]
    except:
        pass


    # Safe Browsing
    try:
        typo.SafeBrowsing = safebrowsing.safebrowsingqueryv2("www." + sDomain)
        pass
    except:
        pass

    # WWW
    try:
        for hostData in _hostinfo.getWWW(sDomain):
            typo.wwwv4.append(hostData.address)
    except:
        pass

    try:
        for hostData in _hostinfo.getWEBMailv6(sDomain):
            typo.wwwv6 .append(hostData.address)
    except:
        pass

    # WebMail
    try:
        for hostData in _hostinfo.getWEBMail(sDomain):
            typo.webmailv4.append(hostData.address)
    except:
        pass

    try:
        for hostData in _hostinfo.getWEBMailv6(sDomain):
            typo.webmailv6.append(hostData.address)
    except:
        pass
    
    # M
    try:
        for hostData in _hostinfo.getM(sDomain):
            typo.mv4.append(hostData.address)
    except:
        pass

    try:
        for hostData in _hostinfo.getMv6(sDomain):
            typo.mv6.append(hostData.address)
    except:
        pass
    
        
    return typo
Beispiel #5
0
def handleHostAJAX(sDomain):
    typo = objtypo()

    typo.strDomain = sDomain

    # IP address for domain
    try:
        ipv4addresses = _hostinfo.getIPv4(sDomain)
        if ipv4addresses:
            for hostData in ipv4addresses:
                typo.IPv4Address.append(hostData.address)
        # Else, found a domain with no IP associated with it.

        ipv6addresses = _hostinfo.getIPv6(sDomain)
        if ipv6addresses:
            for hostData in ipv6addresses:
                typo.IPV6Address.append(hostData.address)
    except dns.resolver.NXDOMAIN:
        # Shortcut - If the domain query results in an NXDOMAIN, don't bother looking for subdomains.
        return typo

    nameservers = _hostinfo.getNS(sDomain)
    if nameservers:
        for nameserver in nameservers:
            typo.nameservers.append(str(nameserver.target).strip(".").lower())

    # MX
    mxRecords = _hostinfo.getMX(sDomain)
    if mxRecords:
        for hostData in mxRecords:
            typo.aMX.append(str(hostData.exchange).strip("."))

            try:
                ipv4addresses = _hostinfo.getIPv4(str(hostData.exchange).strip("."))

                if ipv4addresses:
                    for hostDataInnerv4 in ipv4addresses:
                        if str(hostData.exchange).strip(".") in typo.aMXIPv4:
                            typo.aMXIPv4[str(hostData.exchange).strip(".")].append(hostDataInnerv4.address)
                        else:
                            typo.aMXIPv4[str(hostData.exchange).strip(".")] = [hostDataInnerv4.address]

                ipv6addresses = _hostinfo.getIPv6(str(hostData.exchange).strip("."))
                if ipv6addresses:
                    for hostDataInnerv6 in ipv6addresses:
                        if str(hostData.exchange).strip(".") in typo.aMXIPv6:
                            typo.aMXIPv6[str(hostData.exchange).strip(".")].append(hostDataInnerv6.address)
                        else:
                            typo.aMXIPv6[str(hostData.exchange).strip(".")] = [hostDataInnerv6.address]
            except dns.resolver.NXDOMAIN:
                # This MX record points at non-existent domain
                pass
    # Safe Browsing
    try:
        typo.SafeBrowsing = safebrowsing.safebrowsingqueryv2("www." + sDomain, KEY)
    except:
        pass

    resolve_www(sDomain, typo)

    resolve_webmail(sDomain, typo)

    resolve_m(sDomain, typo)

    check_for_parked(typo)

    return typo